Home

Awesome

MoPro: Webly Supervised Learning with Momentum Prototypes (Salesforce Research)

<img src="./img/blog.png" width="600">

This is a PyTorch implementation of the <a href="https://openreview.net/forum?id=0-EYBhgw80y">MoPro paper</a> (<a href="https://blog.einstein.ai/mopro-webly-supervised-learning-with-momentum-prototypes/">Blog post</a>):

<pre> @article{MoPro, title={MoPro: Webly Supervised Learning with Momentum Prototypes}, author={Junnan Li and Caiming Xiong and Steven C.H. Hoi}, journal={ICLR}, year={2021} }</pre>

Requirements:

Training

This implementation currently only supports multi-gpu, DistributedDataParallel training, which is faster and simpler.

To perform webly-supervised training of a ResNet-50 model on WebVision V1.0 using a 4-gpu or 8-gpu machine, run:

<pre>python train.py \ --data [WebVision folder] \ --exp-dir experiment/MoPro\ --dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 </pre>

Download MoPro Pre-trained ResNet-50 Models

<a href="https://storage.googleapis.com/sfr-pcl-data-research/MoPro_checkpoint/MoPro_V1_epoch90.tar">WebVision V1</a><a href="https://storage.googleapis.com/sfr-pcl-data-research/MoPro_checkpoint/MoPro_V2_epoch90.tar">WebVision v2</a>

Noise Cleaning

<pre>python noise_cleaning.py --data [WebVision folder] --resume [pre-trained model path] --annotation pseudo_label.json </pre>

Classifier Retraining on WebVision

<pre>python classifier_retrain.py --data [WebVision folder] --imagenet [ImageNet folder]\ --resume [pre-trained model path] --annotation pseudo_label.json --exp-dir experiment/cRT\ --dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 </pre>

Fine-tuning on ImageNet (1% of labeled data)

<pre>python finetune_imagenet.py \ --data [ImageNet path] \ --model-path [pre-trained model path] \ --exp-dir experiment/Finetune \ --low-resource 0.01 \ --dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 </pre>

Result for WebVision-V1 pre-trained model:

Percentage1%10%
Accuracy71.274.8

Linear SVM Evaluation on VOC or Places

<pre>python lowshot_svm.py --model_path [your pretrained model] --dataset VOC --voc-path [VOC data path] </pre>

Result for WebVision-V1 pre-trained model:

VOCk=1k=2k=4k=8k=16
mAP59.571.376.581.483.7
Placesk=1k=2k=4k=8k=16
Acc16.923.229.234.538.7