Giter Site home page Giter Site logo

gone2808 / day-night-classifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arunnthevapalan/day-night-classifier

0.0 1.0 0.0 27.76 MB

Classification of Day-Night images by Image Processing using OpenCV

Home Page: https://towardsdatascience.com/how-i-built-an-image-classifier-with-absolutely-no-machine-learning-1480d77d9d3f

Jupyter Notebook 100.00%

day-night-classifier's Introduction

Day Night Images Classfier

This repo contains the implementation of a classification of day-night images by Image Processing using OpenCV and zero Machine Learning.

Pre-requisites

The project was developed using python 3.6.7 with the following packages. GPU is not required.

  • numpy==1.16.4
  • pandas==0.24.2
  • seaborn==0.9.0
  • matplotlib==3.0.3
  • opencv-python
  • jupyterlab

Installation with pip:

pip install -r requirements.txt

Dataset

The day/night image dataset consists of 200 RGB color images in two categories: day and night. There are equal numbers of each example: 100 day images and 100 night images. This would give us a balanced dataset.

Note: All images come from the AMOS dataset (Archive of Many Outdoor Scenes).

Approach

Step 1: Load the datasets and visualize

  • Visualizng the dataset gives us an understanding of the data. We try to find some distinguishing features: day images are much brighter, generally, than night images. Night images also have these really bright small spots, so the brightness over the whole image varies a lot more than the day images. There is a lot more of a gray/blue color palette in the day images.

Step 2: Preprocess the data

  • All the input data should be in a consistent form. We resize all the images to a fixed size and encode the target variables. Multiple approaches like One-Hot, Label encoding can be used for this.

Step 3: Feature Extraction

  • The average brightness using HSV colorspace. Specifically, we'll use the V channel (a measure of brightness), add up the pixel values in the V channel, then divide that sum by the area of the image to get the average Value of the image.

Step 4: Build the classifier

  • A simple classifier that sets a threshold value of average brighness to separate between the two classes.

Step 5: Evaluate the model and optimize

  • Here the model is tested for metrics such as accuarcy and the optimal threshold value is chosen.

Conclusion

Often when it comes to AI problems, we try to use our Machine Learning algorithms, or Deep Learning concpets to gain the best accuracy. However these methods are data hungry and requires high computational power, and works well only when there are sufficient such resources. Here we try to classify the images as if it was taken in day or night using traditional basic Image Processing technique and got an accuracy of 93.75%.

day-night-classifier's People

Contributors

arunnthevapalan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.