/Day-Night-Classifier

Day and Night Image Classification

Primary LanguageJupyter Notebook

Day-Night-Classifier

This repo contains code and models trained to classify day and night images.

Requirements

Dataset

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.

Models

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.

Files

Inference

Syntax for inference

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

Sample Results

These sample results are generated using the predict_all_models.py file.

result1.png result2.png result5.png result4.png result6.png result3.png