vturrisi / solo-learn

solo-learn: a library of self-supervised methods for visual representation learning powered by Pytorch Lightning
MIT License
1.43k stars 188 forks source link

About num_crops_per_aug argument #215

Closed juanigp closed 2 years ago

juanigp commented 2 years ago

Hi, it is not clear to me how the number of crops and transform pipelines work.

Under the directory _bashfiles/pretrain/imagenet-100/ some scripts have the argument --num_crops_per_aug 1 1 (for example byol.sh), while other have --num_crops_per_aug 2 (like simclr.sh).

Can someone clarify to me why some methods have 2 pipelines but only 1 crop per pipeline, while others have a single pipeline with 2 crops? What would be the difference here?

Thank you in advance!

vturrisi commented 2 years ago

Hey @juanigp, SimCLR uses a symmetric augmentation pipeline, i.e. both crops are generated from exactly the same augmentations whereas BYOL (and other works that followed later which borrow from it) use an asymmetric augmentation pipeline (crop 1 has a different random probability for gaussian blur and solarization then crop 2). Our --num_crops_per_aug parameter controls how many crops each augmentation pipeline will produce. This adds better flexibility to supporting asymmetric pipelines (like BYOL) and multi-crop (like SWaV). I suggest you check both papers where they detail the augmentations.

juanigp commented 2 years ago

Hi @vturrisi thank you for the info, very much appreciated!