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.
- 🔥 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.
- 🐍 Python 3.7 or higher
- 📦
pipfor managing Python packages
-
Clone the Repository
git clone https://github.com/MohammadAshmir786/Cat_vs_Dog_Image_Classification_App.git cd Cat_vs_Dog_Image_Classification_App.git -
Install the required libraries:
pip install -r requirements.txt
-
Install
kagglehubto download the dataset:pip install kagglehub
📥 Download the dataset using the following command:
python download_dataset.pyThis 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.
-
✅ Ensure the pre-trained model file is present in the
modelfolder. -
▶️ Start the Flask application:python app.py
-
🌐 Open your web browser and navigate to
http://localhost:5000/. -
📤 Upload an image of a cat 🐱 or dog 🐶 to the application.
-
🎉 View the predicted class along with the probability score.
Contributions to this project are welcome! Follow the steps below to contribute:
-
Fork the Repository:
git clone https://github.com/your-username/cat-dog-classification.git
-
Create a new branch for your feature or bug fix:
git checkout -b feature-name
-
Commit your changes:
git commit -m "Description of your changes" -
Push the branch to your fork:
git push origin feature-name
-
Submit a Pull Request on the original repository.
-
❌ Flask Application Not Starting
- Ensure all dependencies are installed using
requirements.txt. - Verify Python version compatibility (Python 3.7 or higher).
- Ensure all dependencies are installed using
-
📂 Dataset Not Found
- Run the
download_dataset.pyscript to download the dataset. - Place the dataset in the
datafolder.
- Run the
-
⚠️ Model File Missing- Ensure the pre-trained model file is available in the
modelfolder.
- Ensure the pre-trained model file is available in the
-
🔧 KaggleHub Installation Issue
- Reinstall KaggleHub using:
pip install kagglehub
- Reinstall KaggleHub using:
-
🔍 Enhanced Model Performance:
- Further train the model with augmented datasets.
- Explore advanced architectures like ResNet, VGG, or EfficientNet.
-
🎨 UI Improvements:
- Add drag-and-drop functionality for uploading images.
- Improve visualization and user interaction.
-
☁️ Deployment:
- Deploy the application on platforms like AWS, Google Cloud, or Heroku.
-
🐾 Multi-Class Classification:
- Expand the model to classify additional animal species beyond cats 🐱 and dogs 🐶.
-
📹 Real-Time Classification:
- Integrate live webcam support for real-time image predictions.
- 💻 Flask : For providing a lightweight and efficient web framework.
- 📊 kagglehub : For facilitating easy access to datasets.
This project is licensed under the MIT License
If you have any questions or feedback, please feel free to contact me