Built with the tools and technologies:
Python | TensorFlow 2.x | TensorFlow Hub | Keras | Pandas | NumPy | Matplotlib | scikit-learn | Jupyter Notebook
- Overview
- Getting Started
- Data Exploration & Preprocessing
- Modeling & Evaluation
- Model Deployment
- License
- Contact
This project presents an end-to-end deep learning pipeline for multi-class dog breed classification, leveraging transfer learning with TensorFlow and TensorFlow Hub. The notebook demonstrates:
- Data loading, inspection, and preprocessing for image and label data
- Exploratory data analysis and visualization of class distributions
- One-hot encoding of 120 dog breed labels
- Efficient image preprocessing and batching using TensorFlow's
tf.dataAPI - Model construction using a pre-trained MobileNetV2 as a feature extractor
- Training with callbacks (TensorBoard, EarlyStopping) and validation monitoring
- Model evaluation, prediction visualization, and interpretability
- Saving, loading, and deploying trained models
- Preparing Kaggle-compatible CSV submissions and making predictions on custom images
- Dataset: Kaggle Dog Breed Identification (10,222 training images, 120 breeds)
- Transfer Learning: MobileNetV2 from TensorFlow Hub for robust feature extraction
- Data Augmentation: Techniques to improve generalization and prevent overfitting
- Evaluation Metric: Log Loss, with probabilistic outputs for each class
- Visualization: Batch image grids, prediction confidence plots, and TensorBoard logs
- Reproducibility: Modular code for easy adaptation and deployment
To run this notebook, you will need the following libraries installed:
tensorflow(2.x)tensorflow_hubtf_keraspandasnumpymatplotlibscikit-learnosIPython
You can install all necessary libraries using pip:
pip install tensorflow tensorflow_hub tf_keras pandas numpy matplotlib scikit-learn- Clone the repository:
git clone https://github.com/brej-29/dog-breed-classification.git - Navigate to the project directory:
cd dog-breed-classification - Open the Jupyter Notebook:
jupyter notebook DogBreedClassification.ipynb - Follow the notebook cells:
- Unzip and inspect the Kaggle dataset.
- Import core libraries (TensorFlow, TensorFlow Hub, Keras, Pandas, NumPy, Matplotlib, scikit-learn).
- Check for GPU availability for faster training.
- Load and explore the dataset, visualize class distributions, and inspect images.
- Prepare labels (one-hot encoding for 120 breeds).
- Split data into training and validation sets.
- Preprocess images (resize, normalize) and create efficient data batches using TensorFlow's
tf.dataAPI. - Visualize batched data for sanity checks.
- Build the model using transfer learning (MobileNetV2 from TensorFlow Hub).
- Set up callbacks (TensorBoard, EarlyStopping) for monitoring and regularization.
- Train the model on a subset, then on the full dataset.
- Evaluate and visualize predictions, including confidence plots and batch visualizations.
- Save and reload trained models for reproducibility.
- Make predictions on test data and prepare a Kaggle-compatible CSV for submission.
- Run inference on your own custom images and visualize results.
- Load and inspect the Kaggle Dog Breed Identification dataset.
- Visualize class imbalance and breed frequencies.
- One-hot encode breed labels for multi-class classification.
- Preprocess images: resize to 224x224, normalize, and convert to tensors.
- Create efficient data pipelines with batching and shuffling for training, validation, and test sets.
- Build a transfer learning model using MobileNetV2 as a feature extractor and a dense softmax output layer.
- Compile with categorical cross-entropy loss and Adam optimizer.
- Use TensorBoard and EarlyStopping callbacks.
- Train and validate the model, visualize predictions and confidence scores.
- Prepare predictions for Kaggle submission and evaluate on custom images.
- Save trained models in HDF5 format for future inference or retraining.
- Functions provided for loading and evaluating saved models.
- Example code for making predictions on new, custom images.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or feedback, feel free to reach out via my LinkedIn Profile