Implemention of a ResNet18 self-supervised model for transfer learning using the SimCLR framework. The CIFAR10 and CIFAR100 datasets are used.
Steps to configure the code and data
- To run the training execute M21AI619_train.py
- To run the testing execute M21AI619_test.ipynb
- The training TensorBoard can be found in simclr_framework.py
Implementation Details In order to implement the solution, the following python files have been created,
- get_dataset.py to download and transform the training and testing CIFAR10/100 datasets
- get_dataset_util.py containing helper function(s)
- gaussian_blur.py to apply the relevant blur settings
- resnet_impl.py to properly initialize the resnet18 model
- simclr_framework.py to implement the SimCLR framework
- simclr_utils.py containing helper function(s)
- M21AI619_train.py to train the model using all of the above code and the CIFAR10 dataset
- M21AI619_test.ipynb to test the model against the CIFAR10 and CIFAR100 datasets
- The code for M21AI619_test.ipynb has been intentionally decoupled from the rest of the implementation to avoid issues in reusing methods and parameters specifically created for training only.
Transformation and Hyperparameter Details The below recommended image transformations have been applied,
- random cropping, resizing back to the original size
- random color distortions
- random Gaussian blur sequentially
The hyperparameters for the training are as follows, Batch size = 500 epochs = 4 learning rate = 3e-4 out dim = 128 seed = 1 weight decay = 0.0008