This Python project features a Convolutional Neural Network (CNN) designed to classify breeds of dogs into predefined categories based on the Oxford-IIIT Pet Dataset. The CNN is implemented using NumPy for numerical operations and the Python Imaging Library (PIL) for image handling. The project includes comprehensive methods for the forward pass, backward propagation, and training procedures using mini-batch gradient descent.
- Implementation of convolutional layers, ReLU activations, and max pooling.
- Fully connected layers for classification.
- Softmax loss calculation for output.
- Gradient descent optimization for learning the weights.
- Utility functions for loading and preprocessing images and labels.
The model trains on the Oxford-IIIT Pet Dataset, which contains a diverse set of pet images labeled with their respective species. The dataset needs to be downloaded and prepared separately.
Before running this project, ensure you have the following installed:
- Python 3.8 or later
- NumPy (for matrix operations)
- Pillow (PIL, for image processing)
To get started with the CNN Image Classifier, clone this repository to your local machine using the following command:
git clone https://github.com/Kshithijm1/CNN_DogBreedIndentifier.git
cd cnn-image-classifier
Install the necessary Python libraries using pip:
pip install numpy pillow
Download the Oxford-IIIT Pet Dataset from here. Ensure you extract and organize the images and annotations in a directory accessible to the main script.
Modify the main
function in cnn_classifier.py
to point to the correct paths for your dataset:
images_path
: Directory containing the pet images.annotations_path
: Path to the file listing image names and their corresponding labels.
To run the classifier:
- Navigate to the project directory.
- Execute the script with Python:
python cnn_classifier.py
This command will initiate the training process and print out the loss during training. After training, it will predict the class for a specified test image.
This project is licensed under the MIT License - see the LICENSE file for details.
- Oxford-IIIT Pet Dataset for providing the images used in training and testing the classifier.
- Academic Torrents for hosting and distributing the dataset.