Dassl.pytorch
Dassl.pytorch copied to clipboard
Run SimCLR using Dassl
Hi Kaiyang
Can you please point me to how can I implement a two-view dataloader for training using the SimCLR loss. Basically, I want the train dataloader to return two views (augmentations) of the same image each time it is called.
Thanks!
There is a config variable controlling how many times you apply transformation to an image: https://github.com/KaiyangZhou/Dassl.pytorch/blob/master/dassl/config/defaults.py#L96
You can simply set this variable to 2 and the data loader will return 2 views of the same image: https://github.com/KaiyangZhou/Dassl.pytorch/blob/master/dassl/data/data_manager.py#L251
The code has already implemented this function for you so you don't need to redo it
Unless you need the 2 views to have different augmentations, like one weak and the other strong augmentation (see this for an example https://github.com/KaiyangZhou/Dassl.pytorch/blob/master/dassl/engine/da/dael.py#L53)
Also suggest you take a look at the data-wrapper code https://github.com/KaiyangZhou/Dassl.pytorch/blob/master/dassl/data/data_manager.py#L188