Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run SimCLR using Dassl #48

Open
AadSah opened this issue Aug 1, 2022 · 1 comment
Open

Run SimCLR using Dassl #48

AadSah opened this issue Aug 1, 2022 · 1 comment

Comments

@AadSah
Copy link

AadSah commented Aug 1, 2022

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!

@KaiyangZhou
Copy link
Owner

KaiyangZhou commented Aug 2, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants