Course Content
Computer Vision Course Outline
Computer Vision Course Outline
Challenge: Building a CNN
Convolutional Neural Networks (CNNs) are widely used in image classification due to their ability to extract hierarchical features. In this task, you will implement and train a VGG-like CNN using TensorFlow and Keras on the CIFAR-10
dataset. The dataset consists of 60,000 images (32×32×3
) belonging to 10 different classes, including airplanes, cars, birds, cats, and more.
This project will guide you through loading the dataset, preprocessing the images, defining the CNN model, training it, and evaluating its performance.
Swipe to start coding
1. Load and Preprocess the Dataset
- Import the CIFAR-10 dataset from Keras.
- Normalize the pixel values to the range
[0,1]
for better convergence. - Convert the class labels into
one-hot encoded
format for categorical classification.
2. Define the CNN Model
Implement a VGG-like CNN architecture with the following key layers:
Convolutional Layers:
- Kernel size:
3×3
; - Activation function:
ReLU
; - Padding:
'same'
Pooling Layers:
- Pooling type:
Max Pooling
- Pooling size:
2×2
Dropout Layers (Prevent overfitting by randomly disabling neurons):
- Dropout rate:
25%
Flatten Layer - convert 2D feature maps into a 1D vector for classification.
Fully Connected Layers - dense layers for final classification, with a relu or softmax output layer.
Compile the model using:
Adam optimizer
(for efficient learning).Categorical cross-entropy
loss function (for multi-class classification).Accuracy metric
to measure performance (classes are ballanced).
3. Train the Model
- Use
20 epochs
andbatch size of 64
for training. - Include validation data to track model performance on unseen images.
- Save the training history to visualize accuracy and loss trends.
4. Evaluate and Visualize Results
- Test the model on CIFAR-10 test data and print the accuracy.
- Plot training loss vs. validation loss to check for overfitting.
- Plot training accuracy vs. validation accuracy to ensure learning progression.
Thanks for your feedback!
Challenge: Building a CNN
Convolutional Neural Networks (CNNs) are widely used in image classification due to their ability to extract hierarchical features. In this task, you will implement and train a VGG-like CNN using TensorFlow and Keras on the CIFAR-10
dataset. The dataset consists of 60,000 images (32×32×3
) belonging to 10 different classes, including airplanes, cars, birds, cats, and more.
This project will guide you through loading the dataset, preprocessing the images, defining the CNN model, training it, and evaluating its performance.
Swipe to start coding
1. Load and Preprocess the Dataset
- Import the CIFAR-10 dataset from Keras.
- Normalize the pixel values to the range
[0,1]
for better convergence. - Convert the class labels into
one-hot encoded
format for categorical classification.
2. Define the CNN Model
Implement a VGG-like CNN architecture with the following key layers:
Convolutional Layers:
- Kernel size:
3×3
; - Activation function:
ReLU
; - Padding:
'same'
Pooling Layers:
- Pooling type:
Max Pooling
- Pooling size:
2×2
Dropout Layers (Prevent overfitting by randomly disabling neurons):
- Dropout rate:
25%
Flatten Layer - convert 2D feature maps into a 1D vector for classification.
Fully Connected Layers - dense layers for final classification, with a relu or softmax output layer.
Compile the model using:
Adam optimizer
(for efficient learning).Categorical cross-entropy
loss function (for multi-class classification).Accuracy metric
to measure performance (classes are ballanced).
3. Train the Model
- Use
20 epochs
andbatch size of 64
for training. - Include validation data to track model performance on unseen images.
- Save the training history to visualize accuracy and loss trends.
4. Evaluate and Visualize Results
- Test the model on CIFAR-10 test data and print the accuracy.
- Plot training loss vs. validation loss to check for overfitting.
- Plot training accuracy vs. validation accuracy to ensure learning progression.
Thanks for your feedback!