Home

Awesome

Accepted at CVPR 2021 !!

Re-labeling ImageNet: from Single to Multi-Labels, from Global to Localized Labels

Official PyTorch implementation of Re-labeling ImageNet | Paper | Pretrained Models

Sangdoo Yun, Seong Joon Oh, Byeongho Heo, Dongyoon Han, Junsuk Choe, Sanghyuk Chun

NAVER AI LAB

<img src="teaser.png" width="60%" title="" alt="teaser"></img>

Abstract

ImageNet has been arguably the most popular image classification benchmark, but it is also the one with a significant level of label noise. Recent studies have shown that many samples contain multiple classes, despite being assumed to be a single-label benchmark. They have thus proposed to turn ImageNet evaluation into a multi-label task, with exhaustive multi-label annotations per image. However, they have not fixed the training set, presumably because of a formidable annotation cost. We argue that the mismatch between single-label annotations and effectively multi-label images is equally, if not more, problematic in the training setup, where random crops are applied. With the single-label annotations, a random crop of an image may contain an entirely different object from the ground truth, introducing noisy or even incorrect supervision during training. We thus re-label the ImageNet training set with multi-labels. We address the annotation cost barrier by letting a strong image classifier, trained on an extra source of data, generate the multi-labels. We utilize the pixel-wise multi-label predictions before the final pooling layer, in order to exploit the additional location-specific supervision signals. Training on the re-labeled samples results in improved model performances across the board. ResNet-50 attains the top-1 classification accuracy of 78.9% on ImageNet with our localized multi-labels, which can be further boosted to 80.2% with the CutMix regularization. We show that the models trained with localized multi-labels also outperforms the baselines on transfer learning to object detection and instance segmentation tasks, and various robustness benchmarks.

News

Installation

Dependancies

Our implementations are tested on the following libraries with Python 3.6.9 and CUDA 10.1.

torch: 1.6.0
torchvision: 0.7.0
apex: 0.1
munch: 2.5.0
adamp: 0.2.0
fire: 0.3.1
pyyaml: 5.3.1

Install PyTorch and Torchvision as following official PyTorch instruction

conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch

Install other dependencies using the following command.

pip install -r requirements.txt

Dataset

  1. Download the original ImageNet dataset and place it in --data.data_path directory.
  2. Download relabel_imagenet.tar (Dropbox) (12GB) and extract it in --data.relabel.path directory. (if Dropbox is not working, try google drive link.)

The ReLabel's structure is the same as ImageNet (ILSVRC) dataset's.

root
 └─── n04355338
          └───── n04355338_22023.pt
          └───── n04355338_2663.p
          └───── ...
 └─── n03786901
          └───── n03786901_5410.pt
          └───── ...
 └─── ...

How to Run

Train a model with ReLabel

python main.py --config-file-path configs/relabel_train_resnet50.yaml \
               --data.relabel.path 'path/to/relabel'
python main.py --config-file-path configs/relabel_train_resnet50_cutmix.yaml \
               --data.relabel.path 'path/to/relabel'

Test a pretrained model

python main.py --config-file-path configs/relabel_train_resnet50.yaml \
               --util.test_only True \
               --util.test_weight_file 'path/to/checkpoint'

Arguments

<h2 id="experiments">Performances and Pretrained Models</h2>
MethodImageNetImageNetV2ReaLShankar et al.
ResNet-5077.579.083.685.3
ResNet-50 + Label smoothing (e=0.1)78.079.584.084.7
ResNet-50 + Label cleaning78.179.183.685.2
ResNet-50 + ReLabel78.980.585.086.1
MethodImageNet GTReLabel GT
ResNet-1871.772.5 (+0.8) [model_file]
ResNet-5077.578.9 (+1.4) [model_file]
ResNet-10178.180.7 (+2.6) [model_file]
ReXNet (x1.0)77.978.4 (+0.5)
EfficientNet-B077.478.0 (+0.6)
EfficientNet-B179.280.3 (+1.1)
EfficientNet-B280.381.0 (+0.7)
EfficientNet-B381.782.5 (+0.8)
MethodImageNet
ResNet-1871.7
ResNet-18 + ReLabel72.5 (+0.8) [model_file]
ResNet-18 + ReLabel + CutMix73.2 (+1.5) [model_file]
ResNet-5077.5
ResNet-50 + ReLabel78.9 (+1.4) [model_file]
ResNet-50 + ReLabel + CutMix80.2 (+2.7) [model_file]
ResNet-50 + ReLabel + CutMix + ImageNet-21K81.2 (+3.7) [model_file]
ResNet-10178.1
ResNet-101 + ReLabel80.7 (+2.6) [model_file]
ResNet-101 + ReLabel + CutMix81.6 (+3.5) [model_file]

License

Copyright 2021-present NAVER Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Citation

@inproceedings{yun2021relabel,
  title={Re-labeling ImageNet: from Single to Multi-Labels, from Global to Localized Labels},
  author={Yun, Sangdoo and Oh, Seong Joon and Heo, Byeongho and Han, Dongyoon and Choe, Junsuk and Chun, Sanghyuk},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  year={2021}
}