lightly-ai / lightly

A python library for self-supervised learning on images.
https://docs.lightly.ai/self-supervised-learning/
MIT License
2.93k stars 252 forks source link

Incorrect inputsize for BarlowTwins Lightning Example Code #645

Closed p16i closed 2 years ago

p16i commented 2 years ago

Should the input_size in [1] be 32 instead of 224? In [2], we use input_size=32.

[1] https://github.com/lightly-ai/lightly/blob/master/examples/pytorch_lightning/barlowtwins.py#L44 [2] https://github.com/lightly-ai/lightly/blob/master/examples/pytorch/barlowtwins.py#L35

philippmwirth commented 2 years ago

Hi @heytitle thanks for the question! I'll pass it on to the author, @guarin 🙂

IgorSusmelj commented 2 years ago

I think this is indeed a mistake. BarlowTwins works also for small images.

Note that papers like SwaV use additional smaller crops. Since we already have 32x32 images in cifar10 it makes sense to not use smaller crops there. Most of the papers compare benchmarks on the ImageNet dataset with 224x224 input resolution. So if you have larger input images I'd suggest using a larger resolution as well if possible :)