Skip to content

mr-mahmood/Cats-and-Dogs-Classification-using-CNN

Repository files navigation

Cat vs Dog Classification using CNN

This project implements a Convolutional Neural Network (CNN) to classify images of cats and dogs. The model is trained on labeled images and predicts whether a given image contains a cat or a dog.

Features

  • Uses a deep learning model (CNN) for image classification.
  • Processes images of cats and dogs and predicts their category.
  • Provides performance evaluation using Confusion Matrix, ROC, and precision-recall curves.

Dataset

The dataset consists of images of cats and dogs. You can use publicly available datasets such as:

Database Directory

As the dataset contains 25,000 images, they are not included in the repository. Below is the directory structure to organize the images after downloading from Kaggle:

| Cats-and-Dogs-Classification-using-CNN
|
| database
|        | 
|        | train
|        |     |
|        |     | dogs
|        |     |    |
|        |     |    |dog.1.jpg
|        |     | 
|        |     | cats
|        |     |    |
|        |     |    |cat.1.jpg
|        |
|        | test
|        |     |
|        |     | dogs
|        |     |    |
|        |     |    |dog.1.jpg
|        |     | 
|        |     | cats
|        |     |    |
|        |     |    |cat.1.jpg

Model Architecture

The CNN model consists of the following layers:

  1. Convolutional Layers - Extracts features from images.
  2. Pooling Layers - Reduces dimensionality.
  3. Fully Connected Layers - Classifies images into cats or dogs.
  4. Output Layer - Uses softmax/sigmoid for final classification.

Installation & Setup

  1. Clone the repository:
    git clone https://github.com/mr-mahmood/Cats-and-Dogs-Classification-using-CNN.git
    cd Cats-and-Dogs-Classification-using-CNN
  2. Install dependencies:
    pip install -r requirements.txt

Test with GUI

run the following file and test model:

python gui.py

Results

  • The model achieves high accuracy in classifying cats and dogs around 95%.
  • Performance metrics such as confusion matrix, precision, recall are used for evaluation.

Contact

For any questions or suggestions, feel free to reach out!