LAION-AI / CLIP_benchmark

CLIP-like model evaluation
MIT License
590 stars 75 forks source link

Leaking Validation Data in Few-Shot-Setting #125

Open MarcoMorik opened 4 months ago

MarcoMorik commented 4 months ago

I noticed, that the linear probing is trained with both the validation and training dataset when using weight-decay tuning. train_loader = feature_train_val_loader https://github.com/LAION-AI/CLIP_benchmark/blob/a23028288ed914efb31c5ff32a1e702123cbd0ff/clip_benchmark/metrics/linear_probe.py#L280

This could lead to training the linear probe with more data per class when considering the few-shot setting, because the code only filters the training data [Line 235] but not the validation dataset.

So at least for the few-shot setting, it would be necessary to use only the train_loader to train the classification head of the linear probe.