Question: dataset = datasets.ImageFolder ( root = 'path _ to _ your _ data', transform = transform ) I changed to train _ data = datasets.ImageFolder
dataset datasets.ImageFolderroot'pathtoyourdata', transformtransform
I changed to traindata datasets.ImageFolderroottrain transformtransform
testdata datasets.ImageFolderroottest transformtransform Given that I have folder 'test' : images and 'train': images. Each folder will have subfolder 'Action', 'Comedy', 'Horror', 'Romance', which includes many poster films images for that type. Using ImageFolder load the data into your notebook and create a dataLoader from the data. Using the same CNN architecture defined in the here class CNNnnModule:
def initself:
superCNN selfinit
self.conv nnSequential
nnConvd
inchannels # channel, typical for grayscale images
outchannels
kernelsize #size of the convolutional filter is x
stride # the filter moves one pixel at a time
padding # adding of pixels to the input on all sides, ensuring that the output has the same width and height as the input.
nnReLU
nnMaxPooldkernelsize
self.conv nnSequential
nnConvd
nnReLU
nnMaxPoold
# fully connected layer, output classes
self.out nnLinear
def forwardself x:
x self.convx
x self.convx
# flatten the output of conv to batchsize,
x xviewxsize
output self.outx
return output train the model on this
new dataset. Determine the test accuracy of the model.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
