• Stars
    star
    395
  • Rank 109,040 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

teaser

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

  • Jan 14, 2021: Initial upload
  • Mar 1, 2021: Accepted to CVPR 2021 as a poster

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

  • We used four NVIDIA V100 GPUs.
  • Train ResNet-50 with ReLabel to obtain 78.9% top-1 accuracy.
python main.py --config-file-path configs/relabel_train_resnet50.yaml \
               --data.relabel.path 'path/to/relabel'
  • Train ResNet-50 with ReLabel+CutMix to obtain 80.2% top-1 accuracy.
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

  • --config-file-path: Path to config file (.yaml) which overrides configs/base.yaml.
  • --model.arch: Network architecture provided by torchvision (Default: resnet50)
  • --data.data_path: Path to the original ImageNet dataset (Default: '/home/data/ILSVRC2015/')
  • --data.relabel.use: Use ReLabel ground truth (Default: True)
  • --data.relabel.path: Path to ReLabel annotations
  • --data.cutmix.prob: Probability to apply CutMix regularizer (Default: 0.0)
  • --data.cutmix.beta: Hyper-parameter for CutMix regularizer (Default: 0.0)
  • --data.cutmix.off_epoch: How many last epochs to train without CutMix regularizer (Default: 5)
  • --optim.optimizer: Name of optimizer. sgd and AdamP optimizers are available (Default: sgd)
  • --optim.epochs: Total epochs to train (Default: 100)
  • --optim.start_epoch: Starting epoch for restarts
  • --optim.batch_size: Mini-batch size of all GPUs (Default: 512)
  • --optim.lr.init: Initial learning rate
  • --optim.lr.decay_type: Type of learning rate decay (Default: cos)
  • --optim.wd.base: Weight decay
  • --optim.warmup.lr: Initial warmup learning rate (Default: 0.0)
  • --optim.warmup.epochs: Warmup epochs (Default: 5)
  • --optim.nesterov: Enable Nesterov momentum (Default: True)
  • --optim.momentum: Momentum parameter (Default: 0.9)
  • --optim.label_smoothing: Label smoothing parameter (Default: 0.0)
  • --util.test_only: Only evaluate model without training (Default: False)
  • --util.test_weight_file: Path to the model file to be evaluated

Performances and Pretrained Models

  • ResNet-50 results on single-label and multi-label evalutation for ImageNet classficiation
Method ImageNet ImageNetV2 ReaL Shankar et al.
ResNet-50 77.5 79.0 83.6 85.3
ResNet-50 + Label smoothing (e=0.1) 78.0 79.5 84.0 84.7
ResNet-50 + Label cleaning 78.1 79.1 83.6 85.2
ResNet-50 + ReLabel 78.9 80.5 85.0 86.1
  • ReLabel on various architectures
Method ImageNet GT ReLabel GT
ResNet-18 71.7 72.5 (+0.8) [model_file]
ResNet-50 77.5 78.9 (+1.4) [model_file]
ResNet-101 78.1 80.7 (+2.6) [model_file]
ReXNet (x1.0) 77.9 78.4 (+0.5)
EfficientNet-B0 77.4 78.0 (+0.6)
EfficientNet-B1 79.2 80.3 (+1.1)
EfficientNet-B2 80.3 81.0 (+0.7)
EfficientNet-B3 81.7 82.5 (+0.8)
  • ReLabel with additional tricks
Method ImageNet
ResNet-18 71.7
ResNet-18 + ReLabel 72.5 (+0.8) [model_file]
ResNet-18 + ReLabel + CutMix 73.2 (+1.5) [model_file]
ResNet-50 77.5
ResNet-50 + ReLabel 78.9 (+1.4) [model_file]
ResNet-50 + ReLabel + CutMix 80.2 (+2.7) [model_file]
ResNet-50 + ReLabel + CutMix + ImageNet-21K 81.2 (+3.7) [model_file]
ResNet-101 78.1
ResNet-101 + ReLabel 80.7 (+2.6) [model_file]
ResNet-101 + ReLabel + CutMix 81.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}
}

More Repositories

1

DenseDiffusion

Official Pytorch Implementation of DenseDiffusion (ICCV 2023)
Jupyter Notebook
466
star
2

StyleMapGAN

Official pytorch implementation of StyleMapGAN (CVPR 2021)
Python
458
star
3

Visual-Style-Prompting

Official Pytorch implementation of "Visual Style Prompting with Swapping Self-Attention"
Python
415
star
4

vidt

Python
305
star
5

pit

Python
240
star
6

korean-safety-benchmarks

Official datasets and pytorch implementation repository of SQuARe and KoSBi (ACL 2023)
Python
233
star
7

BlendNeRF

Official pytorch implementation of BlendNeRF (ICCV 2023)
Python
149
star
8

c3-gan

Official Pytorch implementation of C3-GAN (Spotlight at ICLR 2022)
Python
125
star
9

rope-vit

[ECCV 2024] Official PyTorch implementation of RoPE-ViT "Rotary Position Embedding for Vision Transformer"
Python
124
star
10

pcme

Official Pytorch implementation of "Probabilistic Cross-Modal Embedding" (CVPR 2021)
Python
121
star
11

GGDR

Official Pytorch implementation of GGDR (ECCV 2022)
Python
102
star
12

cl-vs-mim

(ICLR 2023) Official PyTorch implementation of "What Do Self-Supervised Vision Transformers Learn?"
Jupyter Notebook
97
star
13

calm

Python
91
star
14

PfLayer

Learning Features with Parameter-Free Layers, ICLR 2022
Python
85
star
15

rdnet

[ECCV2024] Official implementation of paper, "DenseNets Reloaded: Paradigm Shift Beyond ResNets and ViTs".
Python
84
star
16

w-ood

Python
80
star
17

model-stock

Model Stock: All we need is just a few fine-tuned models
72
star
18

egtr

[CVPR 2024 Best paper award candidate] EGTR: Extracting Graph from Transformer for Scene Graph Generation
Python
65
star
19

hypermix

Code for text augmentation method leveraging large-scale language models
Python
60
star
20

carecall-corpus

CareCall for Seniors: Role Specified Open-Domain Dialogue dataset generated by leveraging LLMs (NAACL 2022).
59
star
21

eccv-caption

Extended COCO Validation (ECCV) Caption dataset (ECCV 2022)
Python
52
star
22

i-Blurry

Official Pytorch implementation of Online Continual Learning on Class Incremental Blurry Task Configuration with Anytime Inference (ICLR 2022)
Python
52
star
23

seit

[ECCV2024][ICCV2023] Official PyTorch implementation of SeiT++ and SeiT
Python
51
star
24

FSMR

Official Tensorflow implementation of "Feature Statistics Mixing Regularization for Generative Adversarial Networks" (CVPR 2022)
Python
49
star
25

pcmepp

Official Pytorch implementation of "Improved Probabilistic Image-Text Representations" (ICLR 2024)
Python
48
star
26

cmo

Python
45
star
27

facetts

Python
44
star
28

cream

Visually-Situated Natural Language Understanding with Contrastive Reading Model and Frozen Large Language Models, EMNLP 2023
Python
42
star
29

dap-cl

Official code of "Generating Instance-level Prompts for Rehearsal-free Continual Learning (ICCV 2023)"
Python
39
star
30

NeglectedFreeLunch

Jupyter Notebook
36
star
31

neuralwoz

NeuralWOZ: Learning to Collect Task-Oriented Dialogue via Model-based Simulation (ACL-IJCNLP 2021)
Python
36
star
32

dual-teacher

Official code for the NeurIPS 2023 paper "Switching Temporary Teachers for Semi-Supervised Semantic Segmentation"
Python
35
star
33

augsub

Official PyTorch implementation of MaskSub "Masking Augmentation for Supervised Learning"
Python
32
star
34

chacha-chatbot

Python
31
star
35

tablevqabench

Jupyter Notebook
30
star
36

carecall-memory

Keep Me Updated! Memory Management in Long-term Conversations (Findings of EMNLP 2022)
28
star
37

mid.metric

Python
27
star
38

MetricMT

The official code repository for MetricMT - a reward optimization method for NMT with learned metrics
25
star
39

scob

Official Implementation of SCOB [ICCV 2023]
Python
22
star
40

ALMoST

Python
22
star
41

coco-annotation-tool

TypeScript
21
star
42

hmix-gmix

Jupyter Notebook
21
star
43

imagenet-annotation-tool

TypeScript
17
star
44

informer

17
star
45

cs-shortcut

Saving Dense Retriever from Shortcut Dependency in Conversational Search (EMNLP 2022)
Python
16
star
46

talebrush

The official source code for TaleBrush (CHI 2022)
Python
14
star
47

cgl_fairness

Python
14
star
48

KoBBQ

Official code and dataset repository of KoBBQ (TACL 2024)
Python
14
star
49

trace

TRACE: Table Reconstruction Aligned to Corner and Edges (ICDAR 2023)
Python
12
star
50

simseek

Generating Information-Seeking Conversations from Unlabeled Documents (EMNLP 2022).
Python
11
star
51

tc-clip

[ECCV 2024] Official PyTorch implementation of TC-CLIP "Leveraging Temporal Contextualization for Video Action Recognition"
Python
10
star
52

burn

Official Pytorch Implementation of Unsupervised Representation Learning for Binary Networks by Joint Classifier Training (CVPR 2022)
Python
10
star
53

tokenadapt

Python
8
star
54

llm-chatbot

The LLM chatbot demo website
HTML
7
star
55

lut

[ECCV 2024] Official PyTorch implementation of LUT "Learning with Unmasked Tokens Drives Stronger Vision Learners"
5
star
56

elva

On Efficient Language and Vision Assistants for Visually-Situated Natural Language Understanding: What Matters in Reading and Reasoning
5
star
57

rewas

5
star
58

densediffusion

5
star
59

rite

Python
5
star
60

demystifying-ntk

Demystifying the Neural Tangent Kernel from a Practical Perspective: Can it be trusted for Neural Architecture Search without training? (CVPR 2022)
Python
2
star
61

carte

CARTE: Cell Adjacency Relation for Table Evaluation
Python
2
star
62

chacha

TypeScript
1
star