Home

Awesome

Relieving Long-tailed Instance Segmentation via Pairwise Class Balance

Official code for CVPR 2022 paper "Relieving Long-tailed Instance Segmentation via Pairwise Class Balance". The implementation is based on MMDetection (version 2.16.0).

Relieving Long-tailed Instance Segmentation via Pairwise Class Balance
Yin-Yin He*, Peizhen Zhang*, Xiu-Shen Wei, Xiangyu Zhang, Jian Sun</br> CVPR 2022

Introduction

Long-tailed instance segmentation is a challenging task due to the extreme imbalance of training samples among classes. It causes severe biases of the head classes (with majority samples) against the tailed ones. This renders “how to appropriately define and alleviate the bias” one of the most important issues. Prior works mainly use label distribution or mean score information to indicate a coarse-grained bias. In this paper, we explore to excavate the confusion matrix, which carries the fine-grained misclassification details, to relieve the pairwise biases, generalizing the coarse one. To this end, we propose a novel Pairwise Class Balance (PCB) method, built upon a confusion matrix which is updated during training to accumulate the ongoing prediction preferences. PCB generates fightback soft labels for regularization during training. Besides, an iterative learning paradigm is developed to support a progressive and smooth regularization in such debiasing. PCB can be plugged and played to any existing method as a complement. Experimental results on LVIS demonstrate that our method achieves state-of-the-art performance without bells and whistles. Superior results across various architectures show the generalization ability.

Framework of PCB

method overview

Prerequisites

Usage

Installation

git clone https://github.com/megvii-research/PCB
cd PCB
pip install -r requirements/build.txt
pip install -v -e .  # or "python setup.py develop"
# Install extra dependency for LVIS dataset
pip install git+https://github.com/lvis-dataset/lvis-api.git

Data preparing

mkdir data
# LVIS uses the same images as COCO's, so you need to first download COCO dataset and replace the original annotations with LVIS annotations, then link the folder ($COCO) to the new path (i.e., data/lvis_v0.5 and data/lvis_v1).
ln -sf $COCO/ data/lvis_v0.5
ln -sf $COCO/ data/lvis_v1

Training

# ./tools/dist_train.sh ${CONFIG} ${GPU_NUM}
# the configs of PCB method are all stored in ./configs/pcb/
# In all our experiments, we enable FP16 to speedup a little
./tools/dist_train.sh ./configs/pcb/mask_rcnn_r50_fpn_sample1e-3_mstrain_pcb_2x_lvis_v0.5_fp16.py 8 --no-validate

Evaluation

# ./tools/dist_test.sh ${CONFIG} ${CHECKPOINT} ${GPU_NUM} [--eval ${EVAL_METRICS}]
# The configs of PCB method are all stored in ./configs/pcb/
./tools/dist_test.sh configs/pcb/mask_rcnn_r50_fpn_sample1e-3_mstrain_pcb_2x_lvis_v0.5_fp16.py path/to/your/pretrained/checkpoint.pth 8 --eval bbox segm

Main Experiments and Models

All experiments are based on Mask RCNN, and with multi-scale training. Seesaw is implemented with RFS.

Experiments on LVIS v0.5

BackboneMethodAPAPrAPcAPfAPbconfigpretrained model
R50-FPNSoftmax + PCB25.112.625.529.525.2configLINK
R50-FPNRFS + PCB27.721.828.029.728.2configLINK
R50-FPNEQL v2 + PCB27.820.928.429.928.1configLINK
R50-FPNSeesaw + PCB28.823.429.630.028.6configLINK

Experiments on LVIS v1

BackboneMethodAPAPrAPcAPfAPbconfigpretrained model
R50-FPNSoftmax + PCB22.67.721.829.924.1configLINK
R50-FPNRFS + PCB26.518.526.530.228.3configLINK
R50-FPNEQL v2 + PCB26.218.225.930.127.3configLINK
R50-FPNSeesaw + PCB27.219.027.130.928.1configLINK
R101-FPNSeesaw + PCB28.722.828.032.130.0configLINK

Acknowledgement

The implementation of PCB is based on MMDetection version 2.16.0. We removed some codes which not used in our experiments.

Citation

If you find this project useful for your research, please consider citing the paper.

@article{he2022relieving,
  title={Relieving Long-tailed Instance Segmentation via Pairwise Class Balance},
  author={He, Yin-Yin and Zhang, Peizhen and Wei, Xiu-Shen and Zhang, Xiangyu and Sun, Jian},
  journal={arXiv preprint arXiv:2201.02784},
  year={2022}
}