2. Dataloaders#

The objective of this assignment is to familiarise yourself with datasets and data loaders while exploring a real deep learning project. We will use the PyTorch framework to implement this.

Prerequisite#

In the class, we worked on the Quick Start notebook. The assignment is the continuation of that notebook.

Assignment#

Please do the following questions and submit it by Thursday May 4 at 23h59 O’clock. The submission is one or more notebook (.ipynb) files that can include code, comments, written texts, and plots.

1. Dataloader from a directory#

As discussed in the Quick Start notebook we cannot load all images in the memory.

Change the code to load the dataset on the fly from this zip file (this is the same set of images we had loaded all in the memory).

  • Download and extract the zip file into one directory.

  • The directory contains two subfolders of train and test and two CSV files for their corresponding ground truths.

  • The dataloader should receive the path to this directory as an argument and read images in the __getitem__ function and return them.

2. Different colours for the train and test set#

Change the Quick Start notebook notebook so the training set always has achromatic backgrounds (greyscale) and the test set colourful background.

  • The dataloader function should receive an argument which specifies what types of background to use.

  • Does the network generalise from the training set to the test set?

  • Change the sets (train colourful backgrounds, test grey backgrounds) and perform similar experiments.

  • Do similar experiments with the foreground geometrical shapes.

Bonus: if the network doesn’t learn the task with the above-mentioned manipulations, play with the number of epochs or the design of architecture until it obtains high accuracy in the test set.

3. Extend the geometrical shapes#

Currently, our dataset contains only 3 geometrical shapes. Add one or more geometrical shapes to it, e.g., square and triangle.

  • Change the data generation routines to add at least one new geometrical shape.

  • Visualise the new dataset.

  • Change the network/training code to train a network with a new dataset.