A deep learning project for binary image classification using a convolutional neural network (CNN) to distinguish between images of cats and dogs. Developed as part of the coursework for CSCI 3344: Artificial Intelligence at Trinity University.
This project is a collaboration between Jose Salazar, Lilian Padilla, Stella Miliatis, and William Wallace
This project uses a convolutional neural network built in Keras to automatically extract and learn visual features from images. It classifies images into two categories: cat or dog, using the Kaggle Dogs vs. Cats dataset.
Key tasks included:
- Dataset preprocessing and augmentation
- Building and evaluating multiple CNN architectures
- Hyperparameter tuning (filters, batch size, epochs)
- Analysis of overfitting, underfitting, and model depth
The final model achieved 91.20% test accuracy.
- Python 3
- Keras (TensorFlow backend)
- NumPy, Matplotlib
- Kaggle Dataset: Dogs vs. Cats
- Input shape:
150x150x3(RGB) - 3 Convolutional + MaxPooling layers
- Filters: 24 → 48 → 96
- Filter size:
3x3, Pooling:2x2, Stride:2
- Image Augmentation:
- Horizontal flip
- Shifting (up to 10%)
- Rotation (up to 30°)
- Shearing/skewing (up to 20%)
- Fully Connected Layers:
- Dense(64), ReLU
- Dense(1), Sigmoid (for binary classification)
| Trial | Change | Accuracy (%) |
|---|---|---|
| 10 | Baseline (2-layer) CNN | ~79% |
| 15 | Added 3rd Conv layer (128 filters) | +3.5% |
| 17 | Reduced filters (24/48/96) | +2.1% |
| 24 | Added data augmentation | ~85% |
| 34 | +25 epochs, final model | 91.20% |
- Dataset contained mislabeled, irrelevant, or low-quality images
- Some images did not feature a single, centered pet subject
- Hardware constraints (personal laptops) limited training time and model depth
- Batch normalization did not improve performance as expected
-
Clone the repository:
git clone https://github.com/lilianpadilla/CatsVsDogs.git cd CatsVsDogs -
Environment Setup:
This project requires the following libraries:
-
matplotlib3.0.2 -
Keras2.2.4 -
NumPy1.15.2 -
piexif1.1.2All required dependencies and versions are listed in the
environment.ymlfile included in this repository.To create the environment using Conda:
conda env create -f environment.yml
Once the environment is created, you can enter it by runnning the following command:
conda activate project3
-
Running Model:
To run a model:
python main_basic_cnn.py #or other model