Skip to content

Day and night image classification using a Support Vector Machine and Neural Network

Notifications You must be signed in to change notification settings

cameronfabbri/Day-Night-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Day and Night

This compares the difference of using a neural network and a support vector machine for classifying images based on color. The exact application is differentiating between pictures taken during the day and pictures taken during the night.

Data

Both scripts assume that the data is all in a root folder, with each subfolder (being a label) containing images. Ex.

images/
--- day/
------ image1.png
------ image2.png
------ ...

--- night/
------ image1.png
------ image2.png
------ ...

Feature computing

A complex feature extraction is not needed for classifying images based on color. This uses the image's RGB matrix flattened and normalized, i.e each entry in the flattened matrix is divided by the mean of all the entries.

Comparison

The SVM takes a much shorter time to train, and does much better in testing. The SVM gets about 89% accuracy whereas the neural network gets about 78% accuracy, both resizing the images to 30x30.

Usage

python neural.py images/
python svm.py images/

neural_model.pkl and svm_model.pkl respectively will be saved to the same directory and loaded automatically if it is detected.

About

Day and night image classification using a Support Vector Machine and Neural Network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages