Skip to content

This project predicts the dog breed from 150 different breeds.

License

Notifications You must be signed in to change notification settings

amirdy/dog-breed-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dog Breed Classification

This is a Classification project. A Web Application that receives a dog picture as input and returns its breed as output. The model predicts the breed from 150 different breeds. CLICK HERE TO START THE APP

Demo LIVE DEMO   Computer Preview    Mobile Preview    Setup    Web Application Section    AI Section    

Computer Preview:

Web Demo

Mobile Preview:

mobile Demo

Setup

Ubuntu 16 LTS

First install python3.7 and python3.7-venv on the OS.

Check:

By typing python3.7 and hiting Enter, python shell will appear (version 3.7).

Leave the python shell and run the commands below:

Commands:

 $ git clone https://github.com/amirdy/dog-breed-classification.git 
 $ cd dog-breed-classification/Web_App
 $ python3.7 -m venv env 
 $ source ./env/bin/activate
 (env)$ pip install -r requirements.txt
 (env)$ pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
 (env)$ pip install efficientnet_pytorch==0.6.3
 (env)$ flask run

It will run a Flask development server.

Important Notice:

For enabling Fontawesome icons, you must add Fontawesome CDN into the index.html ( inside the <head> tag ).

You can find this CDN from here.

Web Application Section

Stack:

HTML - CSS - Js - Jquery - Bootstrap - Chart.js - Flask - Python

Icon Set:

Fontawesome

Source of Images:

Unsplash

AI Section:

Dataset:

Combination of 3 datasets:

Number of total images:

  • 22790

Model:

  • Using pretrained EfficientNet-B31 model2

  • Image was fed into the model and the last Conv features were saved

  • These features were fed into a one layer classifier (Training)

Details of Implementation:

  • Genreralization:

    • Drop out (0.8) [in classifier] + 5 Fold Cross-Validation
  • Dropout:

    • 0.8
  • Batch size (Train):

    • 25
  • Learning rate:

    • 0.0001
  • Optimizer:

    • ADAM
  • Train-Validation vs Test Split:

    • Approximately : 0.8 | 0.2
  • Train vs Validation Split:

    • Approximately : 0.8 | 0.2
  • Tools:

    • Python - Pytorch ( Using Google Colab Pro )
  • Processing:

    • Resize (H = 400, W = 350) | Rotate | Normalize
  • Test Result:

5 Fold Cross-Validation:

  • Fold1:

    • Loss & Accuracy (150 Epochs):
        - Best Validation Loss : 0.2477
        - (In Epoch 134 | Accuracy : 92.60 %) [This model is selected]
        - Test Accuracy on this model : 92.48 %
      

alt text alt text

  • Fold2:

    • Loss & Accuracy (150 Epochs):
        - Best Validation Loss : 0.2262
        - (In Epoch 147 | Accuracy : 92.39 %) [This model is selected]  
        - Test Accuracy on this model : 92.68 %
      

alt text alt text

  • Fold3:

    • Loss & Accuracy (150 Epochs):
        - Best Validation Loss : 0.2489
        - (In Epoch 111 | Accuracy : 91.86 %) [This model is selected]
        - Test Accuracy on this model : 92.39 %
      

alt text alt text

  • Fold4:

    • Loss & Accuracy (150 Epochs):
        - Best Validation Loss : 0.2630
        - (In Epoch 134 | Accuracy : 91.59 %) [This model is selected]
        - Test Accuracy on this model : 92.46 %
      

alt text alt text

  • Fold5:

    • Loss & Accuracy (150 Epochs):
        - Best Validation Loss : 0.2425
        - (In Epoch 135 | Accuracy : 92.46 %) [This model is selected]
        - Test Accuracy on this model : 92.33 %
      

alt text alt text

References

[1] Tan, M., & Le, Q. V. (2019). Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946.

[2] https://github.com/lukemelas/EfficientNet-PyTorch

About

This project predicts the dog breed from 150 different breeds.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published