/dog-breed-classifier

A CNN based project where trying to predict the breed of the dog in the image and detect human faces

Primary LanguageJupyter NotebookMIT LicenseMIT

Dog Breed Classifier

This project classifies dog breeds into one of 133 dog breeds using Pytorch

It includes a notebook with 6 parts

  1. Human Face Detection(Two methods used)
  2. Dog Detection(Two pretrained models used)
  3. Classiying Dogs by training Neural Network From Scratch(Got 48% accuracy)
  4. Classifying Dogs By using pretrained model(Got 87% accuracy)
  5. Algorithm to detect human or dogs with the appropriate message
    • If dog detected then predict the breed
    • If human detected then predict the most similar dog
    • If neither print a message indication nothing detected
  6. Testing the algorithm in step 5

Installation

Using conda

The file environment.yaml has all the necessary packages to install so all you need to do is

git clone https://github.com/mohshawky5193/dog-breed-classifier.git
cd dog-breed-classifier
conda env create -f environment.yaml

Using pip

All the packages included in the file requirements.txt but you should modify the line for torch == 1.0.0 and replace it with your version of Pytorch here then copy and paste the link in the file requirements.txt

then do the following

git clone https://github.com/mohshawky5193/dog-breed-classifier.git
cd dog-breed-classifier
pip install -r requirements.txt

Usage

After cloning and changing the directory run the app from the command line as follows

python dog-breed-classifier.py <input image file here> --output_path <output image file here>

if no path specified the output image name will be output.jpg

  • If the image is of human then it will lay a snapchat like filter of dog on the person's face like this
    Person Face Example
  • If the image is of dog the it prints the dog breed in the console in addition to writing it on the dog image like this
    Dog Image Example
  • If the image file contains neither human face nor a dog then print output message indicating so

Web App

There is also a web application deployed on Heroku you can also try it and have fun 😄

License

MIT