Project code for Udacity's AI Programming with Python Nanodegree program. In this project, code was developed for an image classifier built with PyTorch.
The image classifier recognizes different breeds of dogs. The dataset used contains 50 images of dogs.
In Image Classifier Project Resnet18, Alexnet, VGG16 from torchvision.models pre-trained models were used. It was loaded as a pre-trained network, in which input images are transformed and resized for better prediction.
- Dog Breed Images from ImageNet
- Dog images can be downloaded from here
You can download Resnet18 here
You can download VGG16 here
You can download Alexnet here
Gradient Descent
Backpropogation
For command-line applications, there is an option to select either Alexnet or VGG16 or Resnet models.
Following arguments mandatory or optional for check_images.py
--dir
. 'Provide data directory of Dog Images.', type = str, default = 'pet_images/'--dogfile
. 'Provide data directory of names of dogs,' type = str, default = 'dognames.txt'--arch
. 'Alexnet or Resnet can be used if this argument is specified, otherwise, VGG16 will be used', type = str
Make sure you have installed Python, Pytorch and Jupyter Notebook.
- Download all the folders and files
git clone https://github.com/GauravG-20/Dog-Image-Classifier.git
- Then open Visual Studio Code (or powershell) and change the directory to the path where all the files are located.
cd Dog-Image-Classifier
- Now run the following commands -
1.python check_images.py
-- will download the models and then will predict the breeds of the dogs with default parameters.
2.sh run_models_batch.sh
-- will run the program from the command line within Project Workspace (see run_models_batch.sh for further clarification)
3.sh run_models_batch_uploaded.sh
-- will run the program from the command line within Project Workspace (see run_models_batch_uploaded.sh for further clarification)