This repo contains code and models trained to classify day and night images.
The data for this project was scraped from Pexels website using the Download all images extension for Mozilla Firefox.
The training set contains approximately 1000 images and validation set contains 200 images. An additional data cleaning phase was done manually to avoid noisy labels.
Three different approaches have been used.
- Baseline model - Basic model that uses average brightness from Value channel of HSV image as threshold to classify image. Achieves an accuracy of 88.5% on the validation set.
- Simple FCN-CNN - A Simple 5-layer Fully Convolutional Neural Network that works on Value channel of HSV image. Achieves an accuracy of 89.5% on the validation set.
- MobileNetv2 - MobileNetv2 is trained by using transfer learning from an imagenet pretrained model. Achieves an accuracy of 94.5% on the validation set.
- baseline.ipynb - Training of baseline model
- simple_hsv_model.ipynb - Training of Simple 5-layer CNN model
- mobilenetv2_transfer_learning.ipynb - Training of MobileNetv2 model
- predict_simple_model.py - Perform prediction on image using the Simple 5-layer CNN
- predict_mbv2.py - Perform prediction on image using the MobileNetv2 model.
- predict_all_models.py - Performs prediction on image using all 3 models and outputs the results side by side for comparision.
python predict_file.py -i /path/to/image.jpg
Example:
python predict_all_models.py -i day_night_dataset/val/night/pexels-photo-2403202.jpeg
These sample results are generated using the predict_all_models.py file.