This is the official implementation of "Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets" (CVPR 2021). For more details, please refer to:
Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets
Yuan-Hong Liao, Amlan Kar, Sanja Fidler
University of Toronto
CVPR2021 Oral
Data is the engine of modern computer vision, which necessitates collecting large-scale datasets. This is expensive, and guaranteeing the quality of the labels is a major challenge. In this paper, we investigate efficient annotation strategies for collecting multi-class classification labels fora large collection of images. While methods that exploit learnt models for labeling exist, a surprisingly prevalent approach is to query humans for a fixed number of labels per datum and aggregate them, which is expensive. Building on prior work on online joint probabilistic modeling of human annotations and machine generated beliefs, we propose modifications and best practices aimed at minimizing human labeling effort. Specifically, we make use ofadvances in self-supervised learning, view annotation as a semi-supervised learning problem, identify and mitigate pitfalls and ablate several key design choices to propose effective guidelines for labeling. Our analysis is done in a more realistic simulation that involves querying human labelers, which uncovers issues with evaluation using existing worker simulation methods. Simulated experiments on a 125k image subset of the ImageNet dataset with 100 classes showthat it can be annotated to 80% top-1 accuracy with 0.35 annotations per image on average, a 2.7x and 6.7x improvement over prior work and manual annotation, respectively.
- Downdload the extracted BYOL features and change root directory accordingly
wget -P data/features/ http://www.cs.toronto.edu/~andrew/research/cvpr2021-good_practices/data/byol_r50-e3b0c442.pth_feat1.npy
Replace REPO_DIR
(here) with the absolute path to the repository.
- Run online labeling with simulated workers
<EXPERIMENT>
can beimagenet_split_0~5
,imagenet_animal
,imagenet_100_classes
<METHOD>
can beds_model
,lean
,improved_lean
,efficient_annotation
<SIMULATION>
can beamt_structured_noise
,amt_uniform_noise
python main.py experiment=<EXPERIMENT> learner_method=<METHOD> simulation <SIMULATION>
To change other configurations, go check the config.yaml here.
There are several components in our system: Sampler
, AnnotationHolder
, Learner
, Optimizer
and Aggregator
.
Sampler
: We implementRandomSampler
andGreedyTaskAssignmentSampler
. ForGreedyTaskAssignmentSampler
, you need to specify an additional flagmax_annotation_per_worker
For example,
python main.py experiment=imagenet_animal learner_method=efficient_annotation simulation=amt_structured_noise sampler.algo=greedy_task_assignment sampler.max_annotation_per_worker=2000
-
AnnotationHolder
: It holds all information of each example including worker annotation, ground truth and current risk estimation. For simulated worker, you can callannotation_holder.collect_annotation
to query annotations. You can also sample the annotation outside and add them by callingannotation_holder.add_annotation
-
Learner
: We implementDummyLearner
andLinearNNLearner
. You can use your favorite architecture by overwritingNNLearner.init_learner
-
Optimizer
: We implementEMOptimizer
. By callingoptimizer.step
, the optimizer perform EM for a fixed number of times unless it's converged. IfDummyLearner
is not used, the optimizer is expected to calloptimizer.fit_machine_learner
to train the machine learner and perform prediction over all data examples. -
Aggregator
: We implementMjAggregator
andBayesAggregator
.MjAggregator
performs majority vote to infer the final label.BayesAggregator
treat the ground truth and worker skill as hidden variables and infer it based on the observation (worker annotation).
If you use this code, please cite:
@misc{liao2021good,
title={Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets},
author={Yuan-Hong Liao and Amlan Kar and Sanja Fidler},
year={2021},
eprint={2104.12690},
archivePrefix={arXiv},
primaryClass={cs.CV}
}