This project implements a Convolutional Neural Network (CNN) model to classify images of cats and dogs. The model is trained on an image dataset and utilizes deep learning techniques to accurately distinguish between the two categories.
- Programming Language: Python
- Libraries & Frameworks: TensorFlow, Keras, OpenCV, NumPy, Matplotlib
- Deployment: Flask/FastAPI (Optional)
- Preprocesses images using resizing, normalization, and data augmentation
- Builds and trains a CNN model for classification
- Evaluates performance using accuracy, precision, recall, and confusion matrix
- Supports real-time image classification via a web API
- Clone the repository:
git clone https://github.com/your-username/cat-vs-dog-classification.git cd cat-vs-dog-classification - Install dependencies:
pip install tensorflow numpy opencv-python matplotlib flask
- Download and prepare the dataset (Kaggle or other sources).
- Train the model by running the Jupyter Notebook:
jupyter notebook cats_v_dogs_classification.ipynb
- (Optional) Deploy the model using Flask/FastAPI.
The model is trained on the Dogs vs. Cats dataset, which consists of labeled images of cats and dogs. The dataset is preprocessed for efficient training.
- Conv2D layers with ReLU activation
- MaxPooling for feature reduction
- Fully connected layers for classification
- Softmax activation for final output
The model achieves high classification accuracy with optimized hyperparameters. Performance is evaluated using:
- Accuracy Score
- Confusion Matrix
- Precision, Recall, and F1-score
The trained model can be deployed as an API for real-time classification. Flask or FastAPI is used to serve the model, allowing users to upload images and receive predictions.
Run the Flask API and send an image for classification:
python app.pySend a POST request with an image:
curl -X POST -F "[email protected]" http://127.0.0.1:5000/predict- Implementing Transfer Learning using pre-trained models like VGG16 or ResNet
- Enhancing dataset size for better generalization
- Deploying the model using cloud services like AWS or Google Cloud
Amit Chaurasia - GitHub Profile
This project demonstrates deep learning concepts and computer vision techniques to build a robust classification model.