Skip to content

Dog vs Cat classifier Flask app using Convolutional Neural Network with pretrained model MobileNetV2 from Keras. Model has 98% accuracy on both train and validation sets. Heroku app at https://dogvscat-mobilenet.herokuapp.com/

Notifications You must be signed in to change notification settings

tamlthari/dogvscatCNN-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dog vs Cat Convolutional Neural Network classification

Our model is also deployed on Heroku here

Data

The model is trained on Kaggle dataset kernels edition

Model

We use Tensorflow 2.0.0 and Keras MobileNetV2 to build our model. The last layer is Softmax with 2 classes (dog and cat). See jupyter notebook CatvsDogCNN.ipynb for more details.

Training

  • The data from the Kaggle dataset is processed to fit into MobileNetV2 input. See jupyter notebook CatvsDogCNN.ipynb for more details.

  • Our model achieved 98% accuracy on train set and 98% on validation set after 7 epochs (batch size 32, 782 epoch steps)

Flask app

  • Our Flask app allows users to upload an image of cat or dog to be classified and output the class and % confidence (probability)
  • In case of misclassification, our app allows user to save test images to our Heroku PostGres database for future training.

Database

  • We have two PostGreSQL connection configurations for our saved images: psycopg2 (for local Flask app) and SQLAlchemy (for heroku) (See my tikiPostGreSQL-app repo for how to set up heroku SQLAlchemy db and connection)
  • Our data table contains one id column and two columns for images (BYTEA type) and label (int type)
  • We encode images using base64 format to save into img column in our table
  • In order to run locally, users can clone the repo. First create PostGreSQL data table as describe above. Then edit the psycopg2 connections in sql.py to fit with your database on your local system. Then run python app.py to start Flask app locally.

About

Dog vs Cat classifier Flask app using Convolutional Neural Network with pretrained model MobileNetV2 from Keras. Model has 98% accuracy on both train and validation sets. Heroku app at https://dogvscat-mobilenet.herokuapp.com/

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published