Transfer Learning solution in Jupiter notebook

Job ID: 33595325

Budget: $50 – $80 USD

Transfer Learning
When we have smaller datset, it is benefiical to use transfer learning--training on a larger dataset and then use that pretrained model to finetune on smaller dataset. Here, your task is to use transfer learning to predict house prices from images.
Libraries allowed: Basic python, numpy, and PyTorch.
Note: Submit the jupyter notebook and its pdf export. Before uploading to Canvas, make sure that all commands in your jypyter notebook are executed, and outputs, plots, and figures are visible.
a) Download SoCal dataset from Kaggle https://www.kaggle.com/datasets/ted8080/house-prices-and-images-socal.
Put first 12000 images under "train/images" in your local directory and the rest under "test/images". Create label filtes for training and test and put them in the respective folder.
b) Calculate the mean and standard deviation of the training images.
c) Implement the custom dataset class for training and test. Resize the images to 32 by 32 and normalize with the mean and std. dev. obtained in step b.
(i) In the init method, store the path to the images. You can use any data structore of your choice, e.g., list/nested list, dictionary.
(ii) in the getitem method, use the path stored at position idx to load the image. Return image and its price.
d) Partition the training dataset into training avnd validation. Create training, validation, and test data loader. See the previous assignments for how to do it.
e) Visualize two random training images.
ResNet-20 backbone
Use the tutorial on https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html as a guide but you should be actually using the NN architectures and pretrained models on Cifar10 in https://github.com/akamaster/pytorch_resnet_cifar10 for transfer learning.
Your tasks are: (i) instantiate a ResNet20 model defined in the resnet.py file. (ii) load the pre-trained weights located in the pretrained\_models repository. (ii) Replace the last linear layer of this pretrainied model with two linear layers. ReLU follows the first linear layer which has 10 neurons. (iv) fine-tune the netwrok by training only these new layers. Use Adam optimizer and learning rate of your choice.
Add as many cells as necessary to complete this part.
Related categories: Python Data Processing Pytorch Deep Learning