Code to reproduce the main results in the paper Multi-Label Learning from Single Positive Labels (CVPR 2021).
See the README.md
file in the data
directory for instructions on downloading and setting up the datasets.
To train and evaluate a model, run:
python train.py
To generate different entries of the main table, modify the following parameters:
dataset
: Which dataset to use.loss
: Which loss to use.train_mode
: Whether to (a) train a linear classifier on top of pre-extracted features, (b) train end-to-end, or (c) do (a) followed by (b).val_set_variant
: Whether to use a clean val set or a validation set where a single positive is observed for each image.
As written, train.py
will run a hyperparameter search over a few different learning rates and batch sizes, save the results for all runs, and report the best run. If desired, modify the code at the bottom of train.py
to search over different parameter settings.
- The
requirements.txt
files was generated using the wonderful tool pipreqs. - Please feel free to get in touch / open an issue if anything is unclear.
- Only PASCAL and COCO are set up right now. NUSWIDE and CUB will be added soon.