Transfer Learning by coding in basic python, numpy, and PyTorch -- 2

Job ID: 33459403

Budget: $10 – $30 USD

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 and validation. Create training, validation, and test data loader. See the previous assignments for how to do it.



e) Visualize two random training images.



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.
Related categories: Python Deep Learning