Skip to content

The objective of this project is to carry out supervised image classification on a collection of colored images. It employs a convolutional neural network design and applies data augmentation and transformations to recognize the category of images from a predefined set of 10 classes.

License

Notifications You must be signed in to change notification settings

sinanw/cnn-image-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convolutional Neural Networks - Image Classification

The objective of this project is to carry out supervised image classification on a collection of colored images. It employs a convolutional neural network design and applies data augmentation and transformations to recognize the category of images from a predefined set of 10 classes.

Data Set (CIFAR-10)

The dataset used is CIFAR-10, which is a widely used benchmark dataset in the field of computer vision and machine learning. It serves as a standard dataset for training and evaluating machine learning algorithms, particularly for image classification tasks.

The dataset has the following features:

  • Consists of 60,000 32x32 color images in 10 classes, with 6,000 images per class.
  • Comprises 50,000 training images and 10,000 test images.
  • Classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck.

Image Classification Details

The project is implemented in several steps simulating the essential data processing and analysis phases.

  • We implemented the classification in both Tensorflow and PyTorch inside the notebooks folder.
  • Each step is represented in a specific section inside the corresponding notebook.

CIFAR-10 Classification: Tensorflow

Corresponding notebook: image-classification-tensorflow.ipynb

STEP 1 - Initialization: importing necessary libraries and modules.

STEP 2 - Loading Dataset: loading the dataset from keras library and checking its details.

STEP 3 - Image Preprocessing: data transformation and augmentation using ImageDataGenerator, as follows:

  1. Scaling the pixel values of the images to be in the range [0, 1].
  2. Randomly applying shear transformations to the images.
  3. Randomly applying zoom transformations to the images.
  4. Randomly flipping images horizontally.

STEP 4 - Building CNN Model: CNN model consists of the following Sequential layers:

  1. Input layer.
  2. Two convolutional layers with ReLU activation function and an increasing number of filters.
  3. Two max pooling layers following the convolutional layers.
  4. Flattening layer.
  5. Two dense/fully connected layers with ReLU activation function.
  6. Output layer with Softmax activation function.

STEP 5 - Model Training: model is compiled and trained using the following configurations:

STEP 6 - Performance Analysis: model accuracy is plotted and analyzed across the epochs.

  • Training and validation accuracy across epochs (Tensorflow):

CIFAR10 CNN Classification Results - Tensorflow

CIFAR-10 Classification: Pytorch

Corresponding notebook: image-classification-pytorch.ipynb

STEP 1 - Initialization: importing necessary libraries and modules.

STEP 2 - Loading and Transforming Dataset:

  • Loading the dataset from torchvision library using DataLoader:
    • Batch size: 32
    • Shuffle: True
  • Implementing data transformation and augmentation using Compose, as follows:
    • Randomly rotating images.
    • Randomly flipping images horizontally.
    • Randomly changing the brightness, contrast, saturation, and hue of the image (color jitter).
    • Scaling the pixel values of the images to be in the range [0, 1].

STEP 3 - Building CNN Model: using nn.Module:

  1. Input layer.
  2. Two convolutional layers with ReLU activation function and an increasing number of filters.
  3. Two max pooling layers following the convolutional layers.
  4. Flattening layer.
  5. Two dense/fully connected layers with ReLU activation function.
  6. Output layer with Softmax activation function.
  7. Optimizer: Adam.
  8. Loss function: CrossEntropyLoss.

STEP 4 - Model Training: model is trained using the following configurations:

  • Epochs: 25

STEP 5 - Performance Analysis: model accuracy is plotted and analyzed across the epochs.

  • Training and validation accuracy across epochs (PyTorch):

CIFAR10 CNN Classification Results - PyTorch

About

The objective of this project is to carry out supervised image classification on a collection of colored images. It employs a convolutional neural network design and applies data augmentation and transformations to recognize the category of images from a predefined set of 10 classes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published