This repository contains a deep learning-based image classifier for the CIFAR-10 dataset. The CIFAR-10 dataset consists of 60,000 32x32 color images in 10 different classes, with 6,000 images per class. The goal of this project is to build a deep neural network that can classify these images into their respective categories.
The CIFAR-10 dataset consists of the following classes:
- Airplane
- Automobile
- Bird
- Cat
- Deer
- Dog
- Frog
- Horse
- Ship
- Truck
We used a convolutional neural network (CNN) architecture to train the model. The architecture includes convolutional layers, max-pooling layers, fully connected layers, and dropout layers to prevent overfitting. The final layer uses softmax activation to predict the class labels.
To train the model on your own, follow these steps:
- Clone this repository:
git clone https://github.com/yourusername/Deep-Image-Classifier-CIFAR-10.git
- Install the required libraries:
pip install -r requirements.txt
- Run the Jupyter Notebook
train_classifier.ipynb
to train the model using the CIFAR-10 dataset.
If you want to use the pretrained model for image classification, you can download it from the "models" directory in this repository. Use the following code to load the model and classify an image:
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
# Load the pretrained model
model = load_model('models/cifar10_model.h5')
# Preprocess your image (replace 'image_path' with the path to your image file)
img = image.load_img('image_path', target_size=(32, 32))
img = image.img_to_array(img)
img = np.expand_dims(img, axis=0)
img = img / 255.0
# Make predictions
predictions = model.predict(img)
class_labels = [
"Airplane", "Automobile", "Bird", "Cat", "Deer",
"Dog", "Frog", "Horse", "Ship", "Truck"
]
predicted_label = class_labels[np.argmax(predictions)]
print(f"The image is classified as: {predicted_label}")
This project is licensed under the MIT License - see the LICENSE file for details.
- The CIFAR-10 dataset is available at https://www.cs.toronto.edu/~kriz/cifar.html.
- Inspiration and guidance from deep learning tutorials and courses.