Skip to content

kanakmi/dogvscat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dog vs Cat


Cover Image

Tech Stack

Python Tensorflow Flask HTML CSS JS

Overview

The classic AI problem to classify images of Cats and Dogs.
The CNN model uses 8000 images (4000 each of Cat and Dog) for the classification task.
The Dataset is taken from Kaggle and the link for the same is https://www.kaggle.com/chetankv/dogs-cats-images
After Image Augmentation, the total number of training Images come out to be 16000.
For testing the best model, 2000 different images (1000 each of cat and dog) are used out of which 50% (1000) images form the Validation Set. The model with the least Validation Loss is saved for future predictions.
The best saved model gives an Accuracy of 89% with a good balance between Precision and Recall.

Classification Report -

Confusion Report

About the Model

The Model contains 4 layers of Convolutional Neural Networks with different hyperparameters. Each CNN layer is followed by a MaxPooling2D layer. The second convolutional layer also uses padding to give importance to the features lying in the corners of the images. The dropout layers are added for regularization (to prevent the model from overfitting the training data).
The output from the last Convolutional layer is then Flattened and passed over to a dense Artificial Neural Network containing 4 hidden layers (also some dropout layers) and finally an output layer.
The model has over 5 Million trainable parameters.

Libraries Required for running the code inside Jupyter Notebook

  1. tensorflow 2.3.0 (or above)
  2. opencv-python 4.5.2.54
  3. scikit-learn 0.24.2
  4. matplotlib 3.4.2 (only for visualization)
  5. seaborn 0.11.1 (only for visualization)

UI for the APP

The basic UI for the app is taken from Sports Classifier project made by Dhaval Patel. I have made multiple changes in his code but the html and css file are essentially the same. Link to his Youtube Channel - https://www.youtube.com/channel/UCh9nVJoWXmFb7sLApWGcLPQ

The server.py file contains the Flask server required to run this app on the system.
The util.py file contains the steps that are performed once the user uploads an image to the app. The saved model is loaded from the memory and input image is preprocessed, predictions are made and the result is routed to the app.js file which maps the output onto the Webpage.

Libraries Required for GUI & Server -

The required libraries are mentioned in the requirements.txt file inside UI folder and can be simply installed using command pip install requirements.txt

Steps to Run UI on your system -

  1. Download the UI and Trained_Model folder from the repository.
  2. Install the required libraries.
  3. Run the server.py file and you are ready to go.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages