Skip to content

This project implements a Convolutional Neural Network (CNN) for binary image classification to differentiate cats and dogs. Built with TensorFlow/Keras, it utilizes a labeled dataset for training, validation, and testing. The model ensures generalization and mitigates overfitting through data augmentation, dropout, and regularization.

License

Notifications You must be signed in to change notification settings

MohammadAshmir786/Cat_vs_Dog_Image_Classification_App

Repository files navigation

🐱🐶 Cat and Dog Image Classification Using CNN

This repository provides a simple Flask-based web application to classify images of cats 🐱 and dogs 🐶 using a Convolutional Neural Network (CNN). The application utilizes a pre-trained model ( trained by train_model.py ) stored in the model folder delivers an accuracy of 99.99% 🎯, ensuring reliable predictions for uploaded images.


✨ Features

  • 🔥 High Accuracy: Achieves an impressive accuracy of 99.99% on the dataset.
  • 🌟 User-Friendly Interface: Easily upload an image and get instant results.
  • 🧠 Pre-Trained Model: Leverages a powerful CNN for efficient binary classification ( trained by train_model.py ).
  • ⚡ Lightweight Flask Application: A simple yet powerful backend for seamless operation.
  • 📂 Dataset Management: Includes a script for automated dataset download and organization.
  • 🚀 Future-Ready: Designed for scalability with plans for enhancements like multi-class classification and real-time predictions.

🚀 Getting Started

✅ Prerequisites

  • 🐍 Python 3.7 or higher
  • 📦 pip for managing Python packages

⚙️ Installation

  1. Clone the Repository

     git clone https://github.com/MohammadAshmir786/Cat_vs_Dog_Image_Classification_App.git
     cd Cat_vs_Dog_Image_Classification_App.git
  2. Install the required libraries:

     pip install -r requirements.txt
    
  3. Install kagglehub to download the dataset:

     pip install kagglehub

🖼️ Usage

Step 1: Download the Dataset

📥 Download the dataset using the following command:

 python download_dataset.py

This script will download the dataset and print the path to the downloaded folder. Create a folder named data in the repository and move the dataset into it.

Step 2: Run the Application

  1. ✅ Ensure the pre-trained model file is present in the model folder.

  2. ▶️ Start the Flask application:

    python app.py
  3. 🌐 Open your web browser and navigate to http://localhost:5000/.

  4. 📤 Upload an image of a cat 🐱 or dog 🐶 to the application.

  5. 🎉 View the predicted class along with the probability score.


🤝 Contribution

Contributions to this project are welcome! Follow the steps below to contribute:

  1. Fork the Repository:

    git clone https://github.com/your-username/cat-dog-classification.git
  2. Create a new branch for your feature or bug fix:

    git checkout -b feature-name
  3. Commit your changes:

    git commit -m "Description of your changes"
  4. Push the branch to your fork:

    git push origin feature-name
  5. Submit a Pull Request on the original repository.


🛠️ Troubleshooting

Common Issues and Solutions

  1. ❌ Flask Application Not Starting

    • Ensure all dependencies are installed using requirements.txt.
    • Verify Python version compatibility (Python 3.7 or higher).
  2. 📂 Dataset Not Found

    • Run the download_dataset.py script to download the dataset.
    • Place the dataset in the data folder.
  3. ⚠️ Model File Missing

    • Ensure the pre-trained model file is available in the model folder.
  4. 🔧 KaggleHub Installation Issue

    • Reinstall KaggleHub using:
      pip install kagglehub

🚀 Future Enhancements

  1. 🔍 Enhanced Model Performance:

    • Further train the model with augmented datasets.
    • Explore advanced architectures like ResNet, VGG, or EfficientNet.
  2. 🎨 UI Improvements:

    • Add drag-and-drop functionality for uploading images.
    • Improve visualization and user interaction.
  3. ☁️ Deployment:

    • Deploy the application on platforms like AWS, Google Cloud, or Heroku.
  4. 🐾 Multi-Class Classification:

    • Expand the model to classify additional animal species beyond cats 🐱 and dogs 🐶.
  5. 📹 Real-Time Classification:

    • Integrate live webcam support for real-time image predictions.

🙌 Acknowledgments

  • 💻 Flask : For providing a lightweight and efficient web framework.
  • 📊 kagglehub : For facilitating easy access to datasets.

📜 License

This project is licensed under the MIT License ↗️


📒 Contact

If you have any questions or feedback, please feel free to contact me ↗️.


🎉 Experience the **99.99%** accuracy and bring the power of deep learning 🧠 to your fingertips! 🫵

About

This project implements a Convolutional Neural Network (CNN) for binary image classification to differentiate cats and dogs. Built with TensorFlow/Keras, it utilizes a labeled dataset for training, validation, and testing. The model ensures generalization and mitigates overfitting through data augmentation, dropout, and regularization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published