0% found this document useful (0 votes)
64 views3 pages

Assignment 5 - CNN

The assignment involves implementing a Convolutional Neural Network (CNN) for image classification using the CIFAR-10 dataset, which contains 60,000 32x32 color images across 10 classes. Key tasks include loading and preprocessing the dataset, building the CNN architecture, training the model, and evaluating its performance through accuracy metrics and confusion matrices. The learning objectives focus on understanding CNNs, data preprocessing, model training, and performance evaluation.

Uploaded by

Aayush Saini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views3 pages

Assignment 5 - CNN

The assignment involves implementing a Convolutional Neural Network (CNN) for image classification using the CIFAR-10 dataset, which contains 60,000 32x32 color images across 10 classes. Key tasks include loading and preprocessing the dataset, building the CNN architecture, training the model, and evaluating its performance through accuracy metrics and confusion matrices. The learning objectives focus on understanding CNNs, data preprocessing, model training, and performance evaluation.

Uploaded by

Aayush Saini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment VI: CNN

Objective: CNN for Image Classification on CIFAR-10 Dataset

Overview:
In this assignment, you will implement a Convolutional Neural
Network (CNN) to classify images in the CIFAR-10 dataset. The
dataset consists of 60,000 32x32 color images categorized into 10
classes. You will load and preprocess the dataset, build and train the
CNN, and evaluate its performance. The key tasks will involve
building an efficient CNN architecture, training the model, and
analyzing the results.
Learning Objectives:
 Understand the architecture and functioning of Convolutional
Neural Networks (CNNs).
 Implement a CNN for image classification on the CIFAR-10
dataset.
 Learn how to preprocess image data for deep learning tasks.
 Evaluate the performance of a CNN model on a test dataset.

Tasks:
Task 1: Load and Preprocess the CIFAR-10 Dataset
Dataset Overview: The CIFAR-10 dataset consists of 60,000 32x32
color images distributed across 10 classes:
1. Airplane
2. Automobile
3. Bird
4. Cat
5. Deer
6. Dog
7. Frog
8. Horse
9. Ship
10. Truck
Task Steps:
 Load the Dataset: Use Keras to load the CIFAR-10 dataset.
 Preprocessing:
1. Normalize the image pixel values to a range of [0, 1] by
dividing by 255.
2. Perform one-hot encoding on the labels (since this is a multi-
class classification problem).
3. Split the data into training, validation, and test sets (e.g.,
60,000 training samples, 10,000 test samples, 5,000
validation samples).
 Expected Output: A normalized and preprocessed dataset ready
for model training.

Task 2: Build the CNN Architecture


CNN Architecture Design: Your CNN model should consist of
several layers, including:
1. Conv2D Layers: To detect spatial features in the images.
2. MaxPooling Layers: To downsample the feature maps and reduce
computation.
3. Flatten Layer: To reshape the 2D feature maps into a 1D vector
for the fully connected layers.
4. Dense Layers: To make final predictions based on the extracted
features.
5. Activation Functions: Use ReLU for the hidden layers and Softmax
for the output layer to classify the 10 classes.
Possible Architecture Example:
1. Conv2D with 32 filters and 3x3 kernel size, followed by a ReLU
activation.
2. MaxPooling2D with a 2x2 pool size.
3. Conv2D with 64 filters and 3x3 kernel size, followed by a ReLU
activation.
4. MaxPooling2D with a 2x2 pool size.
5. Flatten the output to feed into a Dense layer.
6. Dense layer with 128 units and ReLU activation.
7. Output layer with 10 units (one for each class) and Softmax
activation.
Task Steps:
 Build the CNN model: Use Keras to build the model with the
described layers.
 Compile the Model: Choose an optimizer (e.g., Adam), loss
function (e.g., categorical cross entropy), and evaluation metric
(accuracy).
 Expected Output: A compiled CNN model ready for training.

Task 3: Train the CNN Model


Training the Model:
 Model Training: Train the CNN model using the training data for a
set number of epochs (e.g., 10-20 epochs).
 Validation: Use a validation set to monitor performance during
training and prevent overfitting.
 Batch Size: Set an appropriate batch size (e.g., 32 or 64).
 Early Stopping (optional): Implement early stopping to halt
training if the validation accuracy doesn’t improve for a certain
number of epochs.
 Expected Output: Trained CNN model.

Task Steps:
 Train the model using the preprocessed CIFAR-10 dataset.
 Plot training and validation accuracy/loss over epochs to monitor the
model’s learning progress.

Task 4: Evaluate the Model


Model Evaluation:
 After training, evaluate the performance of the CNN model on the
test dataset.
 Accuracy: Calculate the classification accuracy on the test set.
 Confusion Matrix: Plot a confusion matrix to visualize the model's
classification performance for each class.
 Classification Report: Generate a classification report that includes
precision, recall, and F1-score for each class.
Task Steps:
 Evaluate the model using the test set.
 Visualize the confusion matrix and generate the classification
report.
 Expected Output: Test accuracy, confusion matrix, and classification
report.

You might also like