Welcome to TensorFlow Pet Classifier! π― This project uses Convolutional Neural Networks (CNNs) to classify images of dogs and cats from a dataset.
The model analyzes images and predicts whether the image belongs to a dog πΆ or a cat π± with an estimated probability.
β
CNN model based on VGG16 / MobileNetV2 / ResNet
β
Training with tf.keras and ImageDataGenerator
β
Data augmentation to improve accuracy
β
Callbacks: EarlyStopping, ReduceLROnPlateau, and ModelCheckpoint
β
Model evaluation with performance metrics and result visualization
β
Prediction of images in a grid of 10 random samples
TensorFlow-Pet-Classifier/
βββ data/ # Training and test data
β βββ train/ # Training images
β β βββ cat/ # Cat images
β β βββ dog/ # Dog images
β βββ test/ # Test images
βββ src/ # Source code
β βββ explore.ipynb # Notebook to explore and train the model
βββ models/ # Trained models
βββ requirements.txt # Project dependencies
βββ README.md # This file
A pretrained CNN with transfer learning is trained on a dataset of 22,030 training images and 12,500 validation images.
Parameters:
- Optimizer:
Adam - Learning Rate:
0.001(dynamically adjusted withReduceLROnPlateau) - Loss:
Binary Crossentropy - Epochs:
10 - Batch Size:
32 - Data Augmentation (
ImageDataGenerator):- Rotation, translation, zoom, and horizontal flip
- Model accuracy:
~85%on validation - Loss and accuracy curves
There is a limitation with the test folder where the test images should be properly structured and should only contain images, as the model may fail to perform if additional files are present. It is essential to ensure that the test set contains only valid image files (e.g., .jpg, .png) to avoid errors during evaluation.
This project is distributed under the MIT License.
