Skip to content

Implementation of binary classification with Dog and Cat images using VGG16 architecture and Transfer Learning techniques

License

Notifications You must be signed in to change notification settings

LinggarM/Dog-vs-Cat-Classification-with-Transfer-Learning-using-VGG16

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dog-vs-Cat-Classification-with-Transfer-Learning-using-VGG16

Implementation of binary classification with Dog and Cat images using VGG16 architecture and Transfer Learning techniques.

About The Project

  • This project focuses on binary image classification, distinguishing between images of dogs and cats. It leverages the power of the VGG16 architecture and Transfer Learning techniques to achieve highly accurate classification results.
  • The pre-trained weights from the ImageNet dataset, which includes a wide range of object categories, are used to enhance the model's ability to recognize and classify dog and cat images.
  • This repository provides a comprehensive implementation of the classification process and serves as a valuable resource for exploring the world of Transfer Learning with VGG16.

Technology Used

  • Python
  • Numpy
  • Pandas
  • Matplotlib
  • Scikit-learn
  • Keras
  • Tensorflow

Dataset Used

  • This project uses collections of dog and cat images obtained from the Asirra (Animal Species Image Recognition for Restricting Access) dataset, which is available on Dogs vs. Cats | Kaggle.
  • The amount of data used in this project:
    • Training data:
      • Dog: 500 images
      • Cat: 500 images
    • Testing data
      • Dog: 100 images
      • Cat: 100 images
  • Sample Images
    • Cat
      1 2 3 4 5
      Cat 1 Cat 2 Cat 3 Cat 4 Cat 5
    • Dog
      1 2 3 4 5
      Dog 1 Dog 2 Dog 3 Dog 4 Dog 5

Workflow

  • Data Preparation
  • Label Encoding
  • Data Preprocessing (Data Augmentation)
  • Data Splitting
  • Model Building
  • Model Training
  • Model Testing & Evaluation

Algorithms/ Methods

  • This project applies Transfer Learning methods by utilizing the VGG16 architecture with pre-trained weights sourced from ImageNet, encompassing around 1000 object categories.
  • The training process uses a fine-tuned method, which allows all of the layers to update their weights during the training process.
  • Parameters:
    • Epoch: 200
    • Batch = 10 (100 steps per epoch, because the number of training data is 1000)
    • Loss/ Cost Function = Binary Cross Entropy
    • Optimizer = Mini Batch Gradient Descent
    • Learning rate = 0.00001
    • Momentum = 0.0
    • Metrics = Accuracy

Model Evaluation

Graph of Epoch & Accuracy

images/epoch%20&%20accuracy.png

Confusion Matrix

Actual Positive Actual Negative
Predicted Positive 93 7
Predicted Negative 5 95

Classification Report

Precision Recall F1-Score Support
Cat 0.95 0.93 0.94 100
Dog 0.93 0.95 0.94 100
---- ----------- -------- ---------- ---------
Accuracy 0.94 200
Macro Avg 0.94 0.94 0.94 200
Weighted Avg 0.94 0.94 0.94 200

Contributors

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments