0% found this document useful (0 votes)
7 views2 pages

Programming Assignment 4 DL Applications in Computer Vision

This document outlines the programming assignment for IIT Kharagpur's AI4ICPS I Hub Foundation, focusing on implementing an Image Classification model using PyTorch. Students are required to follow strict instructions regarding the skeleton code and input-output structure while developing a pipeline to classify a partial MNIST dataset using a modified AlexNet. The assignment aims to train and test the model based on user-defined class labels and epochs, with only the final model accuracy to be outputted.

Uploaded by

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

Programming Assignment 4 DL Applications in Computer Vision

This document outlines the programming assignment for IIT Kharagpur's AI4ICPS I Hub Foundation, focusing on implementing an Image Classification model using PyTorch. Students are required to follow strict instructions regarding the skeleton code and input-output structure while developing a pipeline to classify a partial MNIST dataset using a modified AlexNet. The assignment aims to train and test the model based on user-defined class labels and epochs, with only the final model accuracy to be outputted.

Uploaded by

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

IIT KHARAGPUR AI4ICPS I HUB FOUNDATION

Hands-on Approach to AI, Cohort-3, 2025

Programming Assignment 4: DL Applications in Computer Vision

Important Instructions about Programming Assignments

1. Programming assignments will be evaluated automatically. Do not change the skeleton code
provided to you.
2. Write your code only in the designated places in the skeleton code and process the input data
provided to you in the designated variables. Do not alter the input-output structure in the
skeleton code.
3. Do not import any additional libraries. Do not use any additional files for the processing
(other than those mentioned in the skeleton code).
4. Failure to comply with these instructions may lead to you getting zero marks for the
assignment, even if the solution is largely correct.

Objective: This assignment has two objectives:

1. Understanding how to implement Image Classification model using PyTorch.


2. Develop a pipeline to solve the MNIST classification problem and output model accuracy.

Problem: Write a Python program using the provided template to train and test a partial MNIST
dataset using a modified AlexNet as shown below. The program should accept three integers as
command line input. First two integers define the labels of the two-class classification and third integer
represents the number of epochs for training. Output only the final model accuracy and nothing else.

Feature Extractor:

Layer Filters Filter Size Stride Padding Feature Size Activation


Input 1 × 28 × 28
Conv2D 32 5 1 1 32 × 26 × 26 ReLU
Conv2D 64 3 - 1 64 × 26 × 64 ReLU
MaxPool2D - 2 2 - 64 × 13 × 13 -
Conv2D 96 3 - 1 96 × 13 × 13 ReLU
Conv2D 64 3 - 1 64 × 13 × 13 ReLU
Conv2D 32 3 - 1 32 × 13 × 13 ReLU
MaxPool2D - 2 1 - 32 × 12 × 12 -

Classifier:

Layer Feature Size Activation


Dropout 4608
Linear 2048 ReLU
Dropout 2048
Linear 1024 ReLU
Linear 10
Note: Even if there are two classes, we output 10 features in the last Linear layer for correct mapping.

Instructions: Download the dataset along with template program and write your code in the
designated location mentioned in the comments only. You are required only to write the sequential
model for feature extractor, classifier and forward (feature extractor THEN classifier). The dataset
must be in the current working directory with the structure data/MNIST/raw/*. You should read the
skeleton code to understand the exact mechanism of input from the command line and provide the
required output. To train and test modified AlexNet with 1 and 2 MNIST classes with 4 training epochs,
the command line input should be: python assignment.py 1 2 4

Execution Syntax: python assignment.py <number> <number> <number>

Sample Test Cases:

Input 4 5 3 1 2 3 1 2 2 4 9 3 8 7 5
Output 97.97 97.52 78.10 79.41 95.21

You might also like