Skip to content

mtwichan/Applied-ML-project

Repository files navigation

Applied ML Project

Summary

Our task was to build a machine learning algorithim that could determine if a square was in an image. We decided to use a linear support vector machine as our classifier, that ingested feature vectors extracted using the histogram of gradients algorithim (also known as H.O.G).

Examples of our test data set taken from (https://data.mendeley.com/datasets/wzr2yv7r53/1):

square-1 square-10 square-16 square-3

Since the square we were trying to classifiy varied in shape, location, and rotation we had to incorporate additonal techniques such as a sliding window and the image pyramid in order for our histogram of gradient algorithim to correctly extract the feature vectors from the image.

The result of our classifier yielded a 91% success rate. We noticed that the classifer failed to classifiy very small squares correctly. This is due to the image pyramid scaling down the image (zooming out) which works to fit squares that are larger than the sliding window, but not smaller squares. In order to correct this we would need to introduce an image pyramid that also scales the image up, such that smaller squares fill up a larger portion of the sliding window, and more features are extracted.

Example histogram of gradients, prediction label, actual label, and bounding box selected by the algorithim:

hog_5 hog_6 hog_0 pred_5 pred_6 pred_2

How to Run

Install Python 3 if you have not already (https://www.python.org/downloads/).

When you are ready run the following commands in the terminal at the root folder containing the project.

Install Dependencies

Install Python packages (only need to run once): pip install -r requirements.txt

Python File

  1. python square_detection.py.

Jupyter Notebook

  1. Run this line in your terminal at the root folder: jupyter notebook. It will open up a window in your browser. Look for square_detection.ipynb file and click on it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published