This repository contains code for training a convolutional neural network (CNN) using TensorFlow and Keras to classify images from the CIFAR-10 dataset. Additionally, it includes code for visualizing the training process and displaying sample images from the dataset.
To get started with this project, follow these steps:
-
Clone the Repository: First, clone this repository to your local machine using the following command:
git clone https://github.com/yourusername/cifar10-image-classification.git
-
Install Dependencies: Before running the code, make sure you have the necessary dependencies installed. You can install them using pip:
pip install tensorflow matplotlib
-
Run the Code: Navigate to the project directory and run the Python script:
cd cifar10-image-classification python cifar10_classification.py
The cifar10_classification.py
script loads the CIFAR-10 dataset, defines a CNN architecture using TensorFlow's Keras API, trains the model, and visualizes the training process along with sample images from the dataset.
The model architecture is as follows:
- Input Layer: 32x32x3 RGB images
- Convolutional Layer: 32 filters, kernel size (3,3), ReLU activation
- Max Pooling Layer: Pool size (2,2)
- Convolutional Layer: 64 filters, kernel size (3,3), ReLU activation
- Max Pooling Layer: Pool size (2,2)
- Convolutional Layer: 64 filters, kernel size (3,3), ReLU activation
- Flatten Layer
- Fully Connected Layer: 64 units, ReLU activation
- Output Layer: 10 units (corresponding to class labels)
After training the model, the script visualizes the training and validation accuracy over epochs using matplotlib. It also displays a grid of 25 sample images from the CIFAR-10 dataset along with their corresponding class labels.
The CIFAR-10 dataset contains 60,000 images categorized into 10 classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck.
This project is based on TensorFlow and Keras documentation and tutorials. The CIFAR-10 dataset is provided by the Canadian Institute for Advanced Research (CIFAR).
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to contribute to this project by opening issues or pull requests. If you have any questions or suggestions, don't hesitate to contact us. Thank you for your interest in our work!