Imagine an iphone app that tells you the name of the flower your camera is looking at.
In practice, we train an image classifier to recognize different species of flowers, then we export for use use in an application.
Once the project completed in a jupyter notebook, we create a standalone command line application that can be trained on any set of labeled images.
We use the trained model to predict this image
Here is the result:
We use matplotlib
to plot the probabilities for the top 5 classes as a bar graph, along with the input image.
The Accuracy of the network on the test images is 86%
To build and train a classifier, we use one of the pretrained models from torchvision.models
: VGG16, to get the image features. We build and train a new feed-forward classfier using those features.
This project requires Python 3.x and the following Python libraries installed:
You will also need to have software installed to run and execute an iPython Notebook
We recommend to install Anaconda, a pre-packaged Python distribution that contains all of the necessary libraries and software for this project.
The code is provided in the image_classifier.ipynb
notebook file. The code included in visuals.py
is meant to provide the visualizations created in the notebook.
In a terminal or command window, navigate to the top-level project directory classify_images_with_PyTorch/
(that contains this README) and run one of the following commands:
ipython notebook image_classifier.ipynb
or
jupyter notebook image_classifier.ipynb
This will open the iPython Notebook software and project file in your browser.
We use this dataset of 102 flower categories.