A deep learning model built with TensorFlow and Keras to classify images as either cats or dogs. This project includes scripts for training the model from scratch and for predicting new images.
- A simple Convolutional Neural Network (CNN) architecture.
- Uses OpenCV for image preprocessing.
- Achieves over 85% accuracy on validation data.
- Includes a script to predict single images and display the result.
-
Clone the repository:
git clone [https://github.com/your-username/cat-dog-image-classifier.git](https://github.com/your-username/cat-dog-image-classifier.git) cd cat-dog-image-classifier -
Create and activate a virtual environment:
python -m venv venv .\venv\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
-
Download the dataset from Kaggle and place the
trainfolder in the root directory. Kaggle Dogs vs. Cats Dataset
-
Train the model:
python train_model.py
This will generate the
cat_dog_model.h5orcat_dog_model.kerasfile. -
Run a prediction on a new image:
python predict_image.py --image test_images/my_cat_photo.jpg # Or my_dog_photo.jpg