If you would like a detailed explanation of this project, please refer to the Medium article below.
The project is also available for testing on Hugging Face.
This project focuses on building an image classification model that can distinguish between cats and dogs using Transfer Learning with the InceptionV3 architecture.
Instead of training a deep learning model from scratch, this project uses a pre-trained model and adapts it to solve a binary classification problem efficiently.
The goal of this project is to practice building a real-world computer vision pipeline including data preprocessing, training, evaluation, and visualization.
The project uses the Cats and Dogs dataset, which contains around:
- ~6,000 cat images
- ~6,000 dog images
The dataset is balanced, which helps the model learn both classes fairly and avoids bias toward one class.
Before training, images go through several preprocessing steps:
-
Resize images to 256 × 256
-
Normalize pixel values
-
Handle very bright or very dark images
-
Apply data augmentation to improve generalization:
- Random flipping
- Random brightness changes
- Random contrast changes
TensorFlow’s tf.data pipeline is used to efficiently load and prepare data.
This project uses Transfer Learning with InceptionV3.
- Pre-trained on ImageNet
- Used as a feature extractor
- Frozen during initial training
Added on top of the base model:
- Global Average Pooling
- Dense layer (512 neurons, ReLU)
- Dropout (0.5) to reduce overfitting
- Final Dense layer with Sigmoid activation for binary classification
- Adam optimizer
- Binary Cross-Entropy
The project uses callbacks to improve training:
-
EarlyStopping
- Stops training when validation stops improving
-
ModelCheckpoint
- Saves the best model automatically
-
ReduceLROnPlateau
- Reduces learning rate when progress slows down
Model performance was evaluated using several visualization techniques.
76/76 ━━━━━━━━━━━━━━━━━━━━ 3s 41ms/step - accuracy: 0.9941 - loss: 0.0194
Test Accuracy: 0.9933
76/76 ━━━━━━━━━━━━━━━━━━━━ 16s 115ms/step
Precision: 0.2498, Recall: 0.5000, F1-score: 0.3331
Classification Report:
precision recall f1-score support
cats 0.50 1.00 0.67 601
dogs 0.00 0.00 0.00 602
accuracy 0.50 1203
macro avg 0.25 0.50 0.33 1203
weighted avg 0.25 0.50 0.33 1203

Observation: Both training and validation loss decrease and stabilize, indicating good learning and low overfitting.
Observation: Most predictions lie along the diagonal, meaning the model correctly classifies both cats and dogs most of the time.
| Binary Classification ROC Curve | (OvR) ROC Curve – Multi-Class Classification |
|---|---|
![]() |
![]() |
Observation: The model achieves an AUC score close to 1.0, which indicates excellent classification ability.
- Transfer Learning significantly reduces training time.
- Data augmentation improves model robustness.
- Proper evaluation metrics give deeper insight into model performance.




