Home

Awesome

A minimal PyTorch example of training SimSiam on CIFAR10 with a kNN predictor to report the accuracy after each epoch. The code uses lightlys version of SimSiam.

Final test set accuracy is 91% which is similar to the original paper.

Installation

pip install requirements.txt

Dependencies

This code uses SimSiam provided by lightly. We use PyTorch Lightning for the training loop. There is another example of using SimSiam with lighlty and plain PyTorch here.

Train SimSiam on CIFAR10

Training on a V100 GPU takes around 8 hours for 800 epochs and reaches around 91% accuracy on the test set.

You can run training using the following command:

python main.py

The main.py script is kept very simple. You can modify common parameters such as number of epochs, batch size, number of workers etc.

The default values are:

Here are the tensorboard plots: Plot showing accuracy and loss of SimSiam on cifar10

You can access the tensorboard logs using

tensorboard --logdir lightning_logs/