This project was developed as a part of Udacity's Deep Learning Nanodegree. In this project, i have created a convolutional neural network from scratch using pytorch and also created a cnn using transfer learning in pytorch.
Just run the ipynb notebook. Tune the hyper parameters for better accuracy.
Download dog image file from https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/dogImages.zip
Download dog image file from https://s3-us-west-1.amazonaws.com/udacity-aind/dog-project/lfw.zip
- Python 3.
- Numpy
- Pandas
- MatPlotLib
- OpenCv
- Pytorch.
- Download the project materials from our GitHub repository. You can get download the repository with
git clone https://github.com/vickipedia6/Dog-Breed-Classification.git
-
Download anaconda or miniconda based on the instructions in the Anaconda documentation.
-
Create a new conda environment:
conda create --name deep-learning python=3
- Enter your new environment:
- Mac/Linux: >>
source activate deep-learning - Windows: >>
activate deep-learning
- Ensure you have numpy, matplotlib, pandas, and jupyter notebook installed by doing the following:
conda install numpy matplotlib pandas jupyter notebook
- Run the following to open up the notebook server:
jupyter notebook dog_app.ipynb
-
Execute all the cells in the code.
-
Load the pre trained model using the following code in jupyter notebook
model_scratch.load_state_dict(torch.load('model_scratch.pt'))
This project met the following specifications:
- The submission includes all required, complete notebook files.
- The submission returns the percentage of the first 100 images in the dog and human face datasets that include a detected, human face.
- Used a pre-trained VGG16 Net to find the predicted class for a given image. Used this to complete a dog_detector function below that returns True if a dog is detected in an image (and False if not).
- The submission returns the percentage of the first 100 images in the dog and human face datasets that include a detected dog.
- Wrote three separate data loaders for the training, validation, and test datasets of dog images. These images were pre-processed to be of the correct size.
- Answer describes how the images were pre-processed and/or augmented.
- The submission specifies a CNN architecture.
- Answer describes the reasoning behind the selection of layer types.
- Choosing appropriate loss and optimization functions for this classification task. Trained the model for a number of epochs and saved the "best" result.
- The trained model attains at least 10% accuracy on the test set.
- The submission specifies a model architecture that uses part of a pre-trained model.
- The submission details why the chosen architecture is suitable for this classification task.
- Train your model for a number of epochs and save the result wth the lowest validation loss.
- Accuracy on the test set is 60% or greater.
- The submission includes a function that takes a file path to an image as input and returns the dog breed that is predicted by the CNN.
- The submission uses the CNN from the previous step to detect dog breed. The submission has different output for each detected image type (dog, human, other) and provides either predicted actual (or resembling) dog breed.
- The submission uses the CNN from the previous step to detect dog breed. The submission has different output for each detected image type (dog, human, other) and provides either predicted actual (or resembling) dog breed.
- Submission provides at least three possible points of improvement for the classification algorithm.
Training loss: 4.158 ... Validation loss: 3.442
Training loss: 0.0951 ... Validation loss: 0.025
During Training this error can occur "OSError: image file is truncated (49 bytes not processed)". Use this code to solve it
from PIL import ImageFile /n
ImageFile.LOAD_TRUNCATED_IMAGES = True
Accuracy : 14%
Accuracy : 79%
- Python 3
This project is licensed under the MIT License - see the LICENSE file for details
- The data comes from Udacity.

