Assignment 4: ANN for Image Classification with CIFAR-10

Building an ANN for CIFAR-10 classification during Innoquest Cohort-1 AI/ML Training was a hands-on opportunity to master neural network design. While ANNs are suboptimal for image data, this assignment strengthened my skills in PyTorch, architecture design, and data preparation.

Table of Contents

  1. Introduction
  2. Assignment Overview
  3. Key Insights from Implementation
  4. Challenges and Lessons Learned
  5. Practical Takeaways
  6. Let’s Collaborate
  7. Conclusion

1. Introduction

The journey through Innoquest Cohort-1’s AI/ML Training continues to be a rewarding learning experience. Assignment 4 focused on building an Artificial Neural Network (ANN) to classify images from the CIFAR-10 dataset, a task that emphasized foundational concepts in deep learning. While ANNs aren’t the ideal choice for image data compared to CNNs, this exercise provided a hands-on opportunity to strengthen my understanding of neural network design, data preparation, and optimization techniques.


2. Assignment Overview

The primary objective of this assignment was to construct, train, and evaluate an ANN for image classification. Here’s what the task entailed:

  • Dataset Preparation:
    The CIFAR-10 dataset was loaded, normalized (mean = 0, std = 1), and split into training and testing sets for efficient training.
  • Model Design:
    I built a custom ANN architecture with 7 hidden layers, incorporating ReLU activation functions for non-linearity. The output layer comprised 10 neurons corresponding to CIFAR-10’s 10 classes. The CrossEntropyLoss function and Adam optimizer were employed for training.
  • Model Training:
    The model was trained for 50 epochs with a mini-batch size of 64. The training process was optimized iteratively to achieve better results.
  • Evaluation and Visualization:
    I evaluated the model using standard metrics, plotted training/validation loss curves, generated a confusion matrix, and visualized misclassified images with their true and predicted labels.

3. Key Insights from Implementation

Here are some of the critical aspects and insights gained during the assignment:

  • Custom Dataloader:
    I implemented a custom dataloader to optimize memory usage and streamline the training process.
  • ANN Performance on Images:
    While ANNs can handle basic image data, they lack the feature extraction capabilities of CNNs, leading to limitations in performance.
  • Layer Configuration and Experimentation:
    Experimenting with 7 hidden layers and variations in architecture highlighted the importance of network depth and its diminishing returns for certain tasks.
  • Visualization:
    The misclassified images provided valuable insights into class-specific performance and error patterns.

4. Challenges and Lessons Learned

  • Memory Optimization:
    Like most of the neural network datasets, handling the CIFAR-10 dataset required careful preprocessing to ensure efficient memory usage. Creating a custom dataloader was a great learning opportunity regarding this.
  • Overfitting:
    Increasing the depth of the network led to overfitting on the training data. Techniques like dropout or moving to a CNN-based architecture would mitigate this issue in future projects.
  • Understanding PyTorch:
    This assignment further strengthened my skills in PyTorch, allowing me to design more complex architectures and experiment with advanced features.

5. Practical Takeaways

  1. ANNs are a stepping stone for understanding image classification, but CNNs are necessary for higher accuracy and performance.
  2. Custom dataloaders are crucial for efficiently handling large datasets.
  3. Experimentation with layer configurations and activation functions enhances the performance of deep learning models.

6. Let’s Collaborate

This assignment reinforced the importance of hands-on learning in mastering AI/ML concepts. I look forward to collaborating with professionals, teams, and organizations seeking innovative solutions in deep learning and neural network applications. Together, we can tackle exciting challenges and push the boundaries of what’s possible.


7. Conclusion

Assignment 4 provided valuable insights into neural network design and its application in image classification. While ANNs have limitations for image data, the experience gained here forms a strong foundation for future projects involving CNNs and other advanced architectures.

Leave a Reply

Your email address will not be published. Required fields are marked *