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.
The main project is documented and viewable in the dog_app.ipynb jupyter notebook.
-
Clone the repository and navigate to the downloaded folder.
-
Download the dog dataset. Unzip the folder and place it in the repo, at location
path/to/dog-project/dogImages
. -
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. -
Donwload the VGG-16 bottleneck features for the dog dataset. Place it in the repo, at location
path/to/dog-project/bottleneck_features
. -
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"
-
Open the notebook and execute the code.
jupyter notebook dog_app.ipynb
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)
Augmenting the training and/or validation set might help improve model performance.
Turn code web app using Flask or web.py
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.
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.
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.