Skip to content

LuArMen/Dogs-vs.-Cats-Binary-Image-Classification-Random-Forest-vs-CNN-vs-Transfer-Learning-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐢 Dogs vs. 🐱 Cats - Image Classification Project

This project explores binary image classification for cats and dogs using three different modeling approaches:

  1. βœ… Random Forest (with and without PCA)
  2. βœ… Custom Convolutional Neural Network (CNN)
  3. βœ… Pre-trained VGG16 using Transfer Learning + Fine-Tuning

πŸ“Š Dataset

We use a subset of the Kaggle Dogs vs. Cats dataset, containing:

  • 1,000 training images
  • 100 testing images
  • Balanced classes (50% dogs, 50% cats)

πŸ›  Tools & Libraries

  • Python 3.x
  • TensorFlow / Keras
  • scikit-learn
  • matplotlib / seaborn
  • NumPy / pandas

πŸ“ˆ Results Overview

Model Validation Accuracy Validation Loss
Random Forest (raw) 63.00% -
Random Forest + PCA 59.20% -
Custom CNN 72.00% 0.5461
Frozen VGG16 89.00% 0.2394
Fine-tuned VGG16 94.50% 0.1698

🧠 Key Insights

  • Classical models like Random Forest perform poorly on raw pixel data.
  • A Custom CNN improves performance but requires careful regularization.
  • Transfer Learning with VGG16 achieves the highest accuracy and generalization, even with limited training data.

πŸ“‚ Project Structure

  • notebooks/ – Jupyter notebook with full model pipeline
  • models/ – Saved Keras model files
  • results/ – Accuracy and loss plots
  • data/sample_images/ – A few example dog/cat images

πŸš€ Future Work

  • Train on the full 25k Kaggle dataset
  • Explore model ensembling (CNN + VGG16)
  • Try ResNet50 or EfficientNet
  • Improve training with early stopping, learning rate scheduling

About

Image classification of cats and dogs using Random Forest, custom CNN, and fine-tuned VGG16. Evaluates traditional ML vs. deep learning.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published