Cat, Dog Wild Animal Face Classification in Deep Learning

About the Cat, Dog Wild Animal Face Classification

Cat, Dog and Wild Animal Face Classification is a Convolution Neural Network in Deep Learning which classifies that the given face image is a dog face or cat face or wild animal face. Cat Dog and Wild Animal Face classifier is trained by following steps which are given below:

  1. Import required libraries (tensorflow, numpy, keras etc).
  2. Data Preprocessing (Data Augmentation) => Data Augmentation is basically used to generate multiple images from a single.
  3.  Transfer Learning => Transfer Learning is the reuse of a pre-trained model on a new problem. It's currently very popular in deep learning because it can train deep neural network with comparatively little data.
  4. Train model. 
  5. Evaluation.
  6. Test a model

A convolutional neural network (CNN) is a type of artificial neural network used in image recognition and processing that is specifically designed to process pixel data.

CNNs are powerful image processing, artificial intelligence (AI) that use deep learning to perform both generative and descriptive tasks, often using machine vison that includes image and video recognition, along with recommender systems and natural language processing (NLP).

About the dataset

This dataset, also known as Animal Faces-HQ (AFHQ), consists of 16,130 high-quality images at 512×512 resolution and this dataset contains only the face images of the animals.

There are three domains of classes, each providing about 5000 images. By having multiple (three) domains and diverse images of various breeds per each domain, AFHQ sets a challenging image-to-image translation problem. The classes are:

  • Cat
  • Dog
  • Wildlife

Let's Start
I have implemented this model on jupiter notebook. My suggestion is for you guys that if you have a GPU laptop then you can train model on your local system or if you don't have the GPU laptop then you can run this on Google Colab which provides you a GPU, because of that training is much faster than your local system.
I implemented this model on my jupiter notebook by using the following steps which are already mentioned above.
Firstly i trained a model and test a model on my jupiter notebook and then deploy this model on the web using the python framework Flask which provides a simple web development facility.
1. This is the one short screenshot of training my model.


I deployed this model on the web with the help of python framework flask which provides a facility for the web development. 
2. You can see below the screenshot of our project.


3. This is the screenshot of uploading a wild animal's face image on the web by using the file upload button(Choose button). Let's click on the Predict button to see the result.


4.  This is the screenshot of prediction of our given image which you can see in the below screenshot. The given image is a wild animal's face and our model predict correctly that the given image is a Wild Animal Face.


Source code and how to use:

  1. Go to my github  and download code : Cat Dog and Wild Animal's Face Classification
  2. Download pretrained mode :  dog_cat_wild_face_classifier.h5
  3. After download, Extract the folder where you will get a two folders static and templates , one python file, one dataset file, one jupiter notebook file and some test images.
  4. Go into the folder.
  5. Open the command prompt and go to the project folder with cd command.
  6. Write (python Image_Classification.py) in your prompt.
  7. You get a link like this (http://127.0.0.1:5000/).
  8. Paste in the Chrome or any browser.
  9. Now you can use the model.

If you want to train your own model then you can again run the jupiter notebook file (CAT_DOG_WILD_ANIMAL_FACE_CLASSIFIER.ipynb) and follow all process to train the model and after traing you got a trained model with .h5 file extension.


Video Tutorial



Thanks for reading

If you have any doubts, Please let me know

Post a Comment (0)
Previous Post Next Post