This project focuses on image classification using the TensorFlow framework. It involves loading and exploring the CIFAR-10 dataset, building a convolutional neural network (CNN) model for image classification, training the model, and evaluating its performance. The CIFAR-10 dataset contains 60,000 32x32 color images across 10 classes, making it a common choice for benchmarking image classification models.
- Loading the CIFAR-10 Dataset
- Dataset Description
- Exploring and Analyzing the Dataset
- Normalizing Dataset
- Creating the Machine Learning Model
- Building the Machine Learning Model
- Compiling the Machine Learning Model
- The First Batch of Dataset Training
- The Second Batch of Dataset Training After Data Augmentation
- Evaluating the Machine Learning Model
I started by loading the CIFAR-10 dataset, which contains both a training set and a test set. The dataset consists of 32x32 color images, with 10 different classes.
The CIFAR-10 dataset is a widely used image classification dataset. It consists of 60,000 32x32 color images in 10 different classes, with each class containing 6,000 images. This dataset is a subset of the larger CIFAR-100 dataset, focusing on 10 mutually exclusive classes. The CIFAR-10 dataset is often used for training and evaluating machine learning and deep learning models for image classification tasks.
The CIFAR-10 dataset is divided into the following 10 classes:
- Airplane
- Automobile
- Bird
- Cat
- Deer
- Dog
- Frog
- Horse
- Ship
- Truck
The dataset is typically split into two sets:
-
Training Set: The training set consists of 50,000 images (5,000 images per class) used for training machine learning models.
-
Test Set: The test set comprises 10,000 images (1,000 images per class) used for evaluating the performance of trained models.
- Image Size: All images in the CIFAR-10 dataset are of size 32x32 pixels.
- Color Channels: Images are in color, containing three color channels: red, green, and blue (RGB).
- Labeling: Each image is labeled with one of the 10 class labels.
I conducted an initial exploration of the dataset, including visualizing sample images, plotting class distributions, and normalizing pixel values. This provided a better understanding of the data before model building.
I designed a convolutional neural network (CNN) model for image classification. The model architecture included convolutional layers, batch normalization, max-pooling layers, and fully connected layers.
I compiled the model with the Adam optimizer and the sparse categorical cross-entropy loss function for training. Additionally, I tracked the accuracy metric during training to evaluate model performance.
I trained the model using the CIFAR-10 training dataset. The model underwent two training phases: the first batch of training without data augmentation and the second batch of training after applying data augmentation techniques.
In this training phase, I trained the model using the original training dataset. The training progress was tracked over 10 epochs, and the model's accuracy and loss were recorded.
For the second training phase, I applied data augmentation to the training dataset to improve the model's generalization. Data augmentation techniques included random shifts and horizontal flips. The model was trained for an additional 10 epochs, and its performance was evaluated.
I evaluated the model's performance by visualizing accuracy trends throughout training and generating a classification report. The classification report provided details on precision, recall, and F1-score for each class.
This project is made possible through the use of TensorFlow, an open-source machine learning framework. Additionally, it leveraged the CIFAR-10 dataset for image classification, a valuable resource in the machine learning community.