Skip to content

A general image classifier using Visual Bag of Words and SIFT, with OpenCV and scikit-learn

Notifications You must be signed in to change notification settings

IanLondon/general_img_classifier

Repository files navigation

This code creates and trains an image detector to recognize pandas in images. By changing the directory paths and getting different training data you can classify any type of image you like.

The image detector operates using SIFT (Scale-Invariant Feature Transform) features, with a Visual Bag of Words model. For a detailed description see my blog posts:

My slide deck for this project is available to view. The slides are from a 5-minute lightning presentation at Metis.

Panda images for training the classifier used in the Flask app are from the Caltech101 dataset and from several hundred additional photos and drawings ripped from Google Images. The negative non-panda images used to train the classifier are also from the Caltech101 dataset.

To scrape images from Google Images yourself, check out my selenium_google_img_rip.py script in this repo.

Live Example

  1. Check out the Flask app: http://54.210.9.61/panda_app/

  2. Use the simple API. Eg with curl: curl -X POST -F "file=@path/to/cat.jpg" 'http://54.210.9.61/panda_app/'

  3. Upload webcam images to the flask server, eg using webcam-upload.py on the command line or panda-webcam-test.ipynb in Jupyter Notebook. Both require OpenCV 3.1.0 with nonfree packages included -- install instructions here (scroll down a bit)

About

A general image classifier using Visual Bag of Words and SIFT, with OpenCV and scikit-learn

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published