Skip to content

cesarseneca/TensorFlow-Pet-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐢🐱 TensorFlow Pet Classifier

Welcome to TensorFlow Pet Classifier! 🎯 This project uses Convolutional Neural Networks (CNNs) to classify images of dogs and cats from a dataset.

πŸ“Έ Example Prediction

The model analyzes images and predicts whether the image belongs to a dog 🐢 or a cat 🐱 with an estimated probability.

alt text


πŸš€ Features

βœ… 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

πŸ—οΈ Project Structure

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

🧠 Technical Details

πŸ‹οΈ Training

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 with ReduceLROnPlateau)
  • Loss: Binary Crossentropy
  • Epochs: 10
  • Batch Size: 32
  • Data Augmentation (ImageDataGenerator):
    • Rotation, translation, zoom, and horizontal flip

πŸ“Š Metrics

  • Model accuracy: ~85% on validation
  • Loss and accuracy curves

⚠️ Limitations

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.

πŸ“œ License

This project is distributed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published