Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment is the machine learning project for classifying images. You will have to train a machine learning model to predict the 2 0 possible
This assignment is the machine learning project for classifying images. You will have to train a machine learning model to predict the possible classes of images. The
training set contains these labels along with the number of images in each class: Class ID Class Name Count
book
bottle
car
cat
chair
computermouse
cup
dog
flower
fork
glass
glasses
headphones
knife
laptop
pen
plate
shoes
spoon
tree A subset of the images collected in Assignment Exercise images is provided for training
download the remaining images serve as hidden test set.
Note that the images have been validated and thus have numbered file names, where the labels are
stored separately in the accompanying labels.csv file. Furthermore, the images have been resized
to pixels either width or height, depending on the aspect ratio Your submission for the challenge server has to be a ZIP only zip no tar, z etc. archive that
contains two files:
architecture.py: this script contains your model class and the instantiated object. Note
that the name has to be exactly architecture.py because this is expected by the evaluation
script on the server. Also, the class name has to be MyCNN the variable name containing the
instance has to be model. Example:
import torch
import torch.nn as nn
class MyCNNnnModule:
def init:
superinit
def forwardself inputimages: torch.Tensor torch.Tensor:
model MyCNN
model.pth: this file contains your trained model. Again, use this exact same file name. To create this file, use torch.savemodelstatedict "model.pth So in your training loop
you need to store the trained model using this code preferably the one with the lowest loss
You can load the file again with model.loadstatedicttorchloadtrainedmodel On
the website you can see the code of the evaluation script, so you can make sure that your submission is compatible.
The training set images have been reduced to a size of either times or times pixels, depending
on the format of the image. For the evaluation on the hidden test set on the challenge server, note
that the images need to have a dimensionality of times pixels. To create the data set, class
ImageDataset, along with the functions tograyscale and prepareimage were used. Import them
using the file dataset.py note that ImageDataset is slightly different from the version in assignment normalization and tensor conversion was added so use this one to ensure compatibility
with how the test set is generated.
Your task is to predict the labels for the images of the test set. The evaluation criterion is overall
accuracy on the test set.
The following restrictions apply:
You only have valid attempts to upload a model.
Invalid attempts eg error parsing your submission files are not counted.
Your best attempt will be used as final attempt.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started