https://github.com/dianac01/cat-vs-dog-classifier
Image classifier for cats vs dogs using MobileNetV2 and TensorFlow/Keras
https://github.com/dianac01/cat-vs-dog-classifier
cat-vs-dog computer-vision deep-learning image-classification keras tensorflow
Last synced: 2 months ago
JSON representation
Image classifier for cats vs dogs using MobileNetV2 and TensorFlow/Keras
- Host: GitHub
- URL: https://github.com/dianac01/cat-vs-dog-classifier
- Owner: DianaC01
- Created: 2025-08-23T14:32:12.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-23T14:48:10.000Z (11 months ago)
- Last Synced: 2025-09-07T03:13:10.936Z (10 months ago)
- Topics: cat-vs-dog, computer-vision, deep-learning, image-classification, keras, tensorflow
- Language: Python
- Homepage:
- Size: 4.38 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cat vs Dog Image Classifier 🐱🐶
Deep learning project for **image classification (cat vs dog)** using **MobileNetV2** with transfer learning in TensorFlow/Keras.
The model achieves high accuracy on the Kaggle Dogs vs Cats dataset and includes scripts for both training and testing on new images.
## ✨ Features
- Transfer learning with **MobileNetV2** (pre-trained on ImageNet)
- Automatic dataset extraction from `train.zip`
- Data augmentation (rotation, zoom, shift, shear, flip) for better generalization
- Evaluation with accuracy, precision, recall, F1-score
- Confusion matrix and training curves visualization
- Separate script for testing unseen images with probability outputs
## 📂 Project Structure
cat-vs-dog-classifier/
├─ src/
│ ├─ train_model.py # training script (80/10/10 split)
│ └─ test_model.py # test script for new images
├─ results/ # generated plots and reports
├─ docs/ # project presentation
├─ models/ # saved models (ignored by Git)
├─ data/ # put train.zip here (ignored by Git)
├─ dataset/ # extracted dataset (ignored by Git)
├─ requirements.txt
└─ .gitignore
## 📊 Dataset
- Place the **`train.zip`** (from Kaggle Dogs vs Cats) inside the `data/` folder.
- The archive will be automatically extracted into `dataset/train/` when running the training script.
- Images are *not uploaded* to GitHub (they are ignored via `.gitignore`).
## ⚙️ Installation & Usage
```bash
# 1) (optional) create a virtual environment
python -m venv .venv
# Windows: .venv\Scripts\activate
# Linux/Mac: source .venv/bin/activate
# 2) install dependencies
pip install -r requirements.txt
# 3) training (train.zip must be in data/)
python src/train_model.py --zip_train data/train.zip --epochs 20
# 4) testing on new images
python src/test_model.py --images_folder "C:/path/to/test_images" --model_path models/model.h5
If models/model.h5 exceeds 100MB, use Git LFS or share the model externally (e.g., Google Drive):
git lfs install
git lfs track "*.h5"
git add .gitattributes
git add models/model.h5
git commit -m "Track model via LFS"
git push
During training, results are saved automatically into results/:
-training_curves.png
-classification_report.txt
-metrics_test.csv
-confusion_matrix.png