Skip to content

Code to train the SimSiam model on cifar10 using PyTorch

License

Notifications You must be signed in to change notification settings

IgorSusmelj/simsiam-cifar10

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • num_workers = 8
  • max_epochs = 800
  • knn_k = 200
  • knn_t = 0.1
  • classes = 10
  • batch_size = 512
  • seed=1

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/

Releases

No releases published

Packages

No packages published

Languages