Skip to content

convolutional neural network employed to classify images of dogs according to their breed

Notifications You must be signed in to change notification settings

chucklesoclock/dog-project

Repository files navigation

Project Overview

This project uses face detection algorithms, keras CNNs, and transfer learning to classify an image of a dog into its breed, and further identifies a picture as containing a person or a dog.

Project Instructions

The main project is documented and viewable in the dog_app.ipynb jupyter notebook.

Reproducibility

  1. Clone the repository and navigate to the downloaded folder.

  2. Download the dog dataset. Unzip the folder and place it in the repo, at location path/to/dog-project/dogImages.

  3. Download the human dataset. Unzip the folder and place it in the repo, at location path/to/dog-project/lfw. If you are using a Windows machine, you are encouraged to use 7zip to extract the folder.

  4. Donwload the VGG-16 bottleneck features for the dog dataset. Place it in the repo, at location path/to/dog-project/bottleneck_features.

  5. Obtain the necessary Python packages, and switch Keras backend to Tensorflow.

    For Mac/OSX:

    	conda env create -f requirements/aind-dog-mac.yml
    	source activate aind-dog
    	KERAS_BACKEND=tensorflow python -c "from keras import backend"
    

    For Linux:

    	conda env create -f requirements/aind-dog-linux.yml
    	source activate aind-dog
    	KERAS_BACKEND=tensorflow python -c "from keras import backend"
    

    For Windows:

    	conda env create -f requirements/aind-dog-windows.yml
    	activate aind-dog
    	set KERAS_BACKEND=tensorflow
    	python -c "from keras import backend"
    
  6. Open the notebook and execute the code.

    	jupyter notebook dog_app.ipynb
    

Amazon Web Services

Instead of training your model on a local CPU (or GPU) which could take unnecessarily long, you could use Amazon Web Services to launch an EC2 GPU instance. Please refer to the Udacity instructions for setting up a GPU instance for this project. (link for AIND students, link for MLND students)

Future Ideas

(1) Augment the Training Data more effectively (partially implemented)

Augmenting the training and/or validation set might help improve model performance.

(2) Turn your Algorithm into a Web App

Turn code web app using Flask or web.py

(3) Overlay Dog Ears on Detected Human Heads

Overlay a Snapchat-like filter with dog ears on detected human heads. You can determine where to place the ears through the use of the OpenCV face detector, which returns a bounding box for the face. If you would also like to overlay a dog nose filter, some nice tutorials for facial keypoints detection exist here.

(4) Add Functionality for Dog Mutts

Currently, if a dog appears 51% German Shephard and 49% poodle, only the German Shephard breed is returned. The algorithm is currently guaranteed to fail for every mixed breed dog. Of course, if a dog is predicted as 99.5% Labrador, it is still worthwhile to round this to 100% and return a single breed; so a balance is necessary.

(5) Experiment with Multiple Dog/Human Detectors

Perform a systematic evaluation of various methods for detecting humans and dogs in images. Provide improved methodology for the face_detector and dog_detector functions.

About

convolutional neural network employed to classify images of dogs according to their breed

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published