Coding Exercise on Pretext Tasks

Coding exercise on self-supervised pretext task learning.

We'll cover the following

Problem statement

In this coding exercise, you have to perform an 88-way rotation prediction pretext classification task. In the code snippet below, you need to implement:

  • The make_example() function, which takes a PIL image image and rotates it by {0°,45°,90°,135°,180°,225°,270°,315°}\{0\degree, 45\degree, 90\degree, 135\degree, 180\degree, 225\degree, 270\degree, 315\degree \}.

  • The get_model() function, which returns a resnet18 model instance that supports 88-way classification to predict the rotation of the input image.

Note: The seed value should be 0, otherwise the answers will not match even if the functions are implemented correctly.

Get hands-on with 1200+ tech skills courses.