HobbitLong / CMC

[arXiv 2019] "Contrastive Multiview Coding", also contains implementations for MoCo and InstDis
BSD 2-Clause "Simplified" License
1.3k stars 179 forks source link

Augmenting images at the evaluation of downstream classification task #34

Closed dandelin closed 4 years ago

dandelin commented 4 years ago

https://github.com/HobbitLong/CMC/blob/58d06e9a82f7fea2e4af0a251726e9c6bf67c7c9/eval_moco_ins.py#L372-L397

If I understand the inner work of eval_moco_ins.py correctly, the code seems training the downstream task (single FC) using augmented images (train_transform == 'CJ').

This augmentation process not only slows down the training speed of the downstream task but also seems to violate the purpose of evaluation (Then we freeze the features and train a supervised linear classifier, said in MoCo paper).

Isn't it right to save the center-cropped average pooled features and perform FC training on those fixed features?

HobbitLong commented 4 years ago

Hi, @dandelin ,

I think MoCo paper means what the code is currently doing: freeze the network weights, but you can do different crop augmentation for each epoch, like the supervised case.

As for accelerating the linear evaluation process, you are right, and you can cache the features of several random crops of each image, and just train the logistic regression layer.

dandelin commented 4 years ago

@HobbitLong Thanks for the reply :)