sthalles / SimCLR

PyTorch implementation of SimCLR: A Simple Framework for Contrastive Learning of Visual Representations
https://sthalles.github.io/simple-self-supervised-learning/
MIT License
2.19k stars 458 forks source link

run.py parameter doubts #66

Open Dysdjkl opened 1 year ago

Dysdjkl commented 1 year ago

If I use my own data, do I need to change the category of out-dim in the run.py to the number of categories of my own data?

CielAl commented 10 months ago

I believe the out-dim is just the dimension of the feature representation produced by the projection head.

The reason the authors use out_dim in the models.resnet18(pretrained=False, num_classes=out_dim) is only because in the implementation of resnet18 or resnet50 in torchvision, the num_classes will setup the out put size of the final linear layer (nn.Linear), not because it has anything to do with the number of your categories. I mean, after all, it is "self-supervised" learning :p.