gol
Official implementation of 'Gumbel Optimised Loss for Long Tailed Instance Segmentation' ECCV2022. Paper at: https://arxiv.org/abs/2207.10936
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Keywords
Repository
Official implementation of 'Gumbel Optimised Loss for Long Tailed Instance Segmentation' ECCV2022. Paper at: https://arxiv.org/abs/2207.10936
Basic Info
Statistics
- Stars: 18
- Watchers: 1
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
Gumbel Optimised Loss for Long-tailed Instance Segmentation
This is the official implementation of Gumbel Optimised Loss for Long-tailed Instance Segmentation for ECCV2022 accepted paper.
Introduction
Major advancements have been made in the field of object detection and segmentation recently. However, when it comes to rare categories, the state-of-the-art methods fail to detect them, resulting in a significant performance gap between rare and frequent categories. In this paper, we identify that Sigmoid or Softmax functions used in deep detectors are a major reason for low performance and are suboptimal for long-tailed detection and segmentation. To address this, we develop a Gumbel Optimized Loss (GOL), for long-tailed detection and segmentation. It aligns with the Gumbel distribution of rare classes in imbalanced datasets, considering the fact that most classes in long-tailed detection have low expected probability. The proposed GOL significantly outperforms the best state-of-the-art method by 1.1% on AP, and boosts the overall segmentation by 9.0% and detection by 8.0%, particularly improving detection of rare classes by 20.3%, compared to Mask-RCNN, on LVIS dataset.
Gumbel Activation using (M)ask-RCNN, (R)esnet,Resne(X)t, (C)ascade Mask-RCNN and (H)ybrid Task Cascade.
Gumbel Cross Entropy (simplified)
``` def gumbelcrossentropy(pred, label,reduction): """Calculate the Gumbel CrossEntropy loss. Args: pred (torch.Tensor): The prediction. label (torch.Tensor): one-hot encoded Returns: torch.Tensor: The calculated loss. """ pred=torch.clamp(pred,min=-4,max=10) pestim= 1/(torch.exp(torch.exp(-(pred)))) loss = F.binarycrossentropy( pestim, label.float(), reduction=reduction) loss=torch.clamp(loss,min=0,max=20)
return loss
```
Tested with
- python==3.8.12
- torch==1.7.1
- torchvision==0.8.2
- mmdet==2.21.0
- lvis
- Tested on CUDA 10.2 and RHEL 8 system
Getting Started
Create a virtual environment
conda create --name mmdet pytorch=1.7.1 -y
conda activate mmdet
Install dependency packages
conda install torchvision -y conda install pandas scipy -y conda install opencv -yInstall MMDetection
pip install openmim mim install mmdet==2.21.0Clone this repo
git clone https://github.com/kostas1515/GOL.git cd GOLCreate data directory, download COCO 2017 datasets at https://cocodataset.org/#download (2017 Train images [118K/18GB], 2017 Val images [5K/1GB], 2017 Train/Val annotations [241MB]) and extract the zip files: ``` mkdir data cd data wget http://images.cocodataset.org/zips/train2017.zip wget http://images.cocodataset.org/zips/val2017.zip
download and unzip LVIS annotations
wget https://s3-us-west-2.amazonaws.com/dl.fbaipublicfiles.com/LVIS/lvisv1train.json.zip wget https://s3-us-west-2.amazonaws.com/dl.fbaipublicfiles.com/LVIS/lvisv1val.json.zip
```
- modify mmdetection/configs/base/datasets/lvisv1instance.py and make sure dataroot variable points to the above data directory, e.g.,
dataroot = '
'
Training
To Train on multiple GPUs use tools/dist_train.sh to launch training on multiple GPUs:
./tools/dist_train.sh ./configs/<experiment>/<variant.py> <#GPUs>
E.g: To train GOL on 4 GPUs use:
./tools/dist_train.sh ./configs/gol/droploss_normed_mask_r50_rfs_4x4_2x_gumbel.py 4
Testing
To test GOL:
./tools/dist_test.sh ./experiments/droploss_normed_mask_rcnn_r50_rfs_4x4_2x_gumbel/droploss_normed_mask_r50_rfs_4x4_2x_gumbel.py ./experiments/droploss_normed_mask_r50_rfs_4x4_2x_gumbel/latest.pth 4 --eval bbox segm
Reproduce
To reproduce the results on the the paper with Sigmoid, Softmax and Gumbel activation run:
./tools/dist_train.sh ./configs/activations/r50_4x4_1x.py <#GPUs>
./tools/dist_train.sh ./configs/activations/r50_4x4_1x_softmax.py <#GPUs>
./tools/dist_train.sh ./configs/activations/gumbel/gumbel_r50_4x4_1x.py <#GPUs>
It will give a Table similar to this:
| Method | AP | APr | APc | APf | APb |
|---|---|---|---|---|---|
| Sigmoid | 16.4 | 0.8 | 12.7 | 27.3 | 17.2 |
| Softmax | 15.2 | 0.0 | 10.6 | 26.9 | 16.1 |
| Gumbel | 19.0 | 4.9 | 16.8 | 27.6 | 19.1 |
Pretrained Models
| Method | AP | APr | APc | APf | APb | Model | Output |
|---|---|---|---|---|---|---|---|
| GOL_r50_v0.5 | 29.5 | 22.5 | 31.3 | 30.1 | 28.2 | weights | log|config |
| GOL_r50_v1 | 27.7 | 21.4 | 27.7 | 30.4 | 27.5 | weights | log|config |
| GOL_r101_v1 | 29.0 | 22.8 | 29.0 | 31.7 | 29.2 | weights | log|config |
Citation
@inproceedings{alexandridis2022long,
title={Long-tailed Instance Segmentation using Gumbel Optimized Loss},
author={Alexandridis, Konstantinos Panagiotis and Deng, Jiankang and Nguyen, Anh and Luo, Shan},
booktitle={European Conference on Computer Vision},
pages={353--369},
year={2022},
organization={Springer}
}
Acknowledgements
This code uses the <a href='https://github.com/open-mmlab/mmdetection'>mmdet</a> framework. It also uses <a href='https://github.com/tztztztztz/eqlv2'>EQLv2</a> and <a href='https://github.com/timy90022/DropLoss'>DropLoss</a>. Thank you for your wonderfull work!
Owner
- Name: Alexandridis, Konstantinos Panagiotis
- Login: kostas1515
- Kind: user
- Location: London, UK
- Company: King's College London
- Website: https://kostas1515.github.io/
- Repositories: 32
- Profile: https://github.com/kostas1515
PhD Student • Electrical and Computer Engineer • Programming Enthusiast
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - name: "MMDetection Contributors" title: "OpenMMLab Detection Toolbox and Benchmark" date-released: 2018-08-22 url: "https://github.com/open-mmlab/mmdetection" license: Apache-2.0
GitHub Events
Total
Last Year
Dependencies
- cython *
- numpy *
- docutils ==0.16.0
- recommonmark *
- sphinx ==4.0.2
- sphinx-copybutton *
- sphinx_markdown_tables *
- sphinx_rtd_theme ==0.5.2
- mmcv-full >=1.3.17
- cityscapesscripts *
- imagecorruptions *
- scipy *
- sklearn *
- mmcv *
- torch *
- torchvision *
- matplotlib *
- numpy *
- pycocotools *
- six *
- terminaltables *
- asynctest * test
- codecov * test
- flake8 * test
- interrogate * test
- isort ==4.3.21 test
- kwarray * test
- onnx ==1.7.0 test
- onnxruntime >=1.8.0 test
- pytest * test
- ubelt * test
- xdoctest >=0.10.0 test
- yapf * test
- actions/checkout v2 composite
- actions/setup-python v2 composite
- codecov/codecov-action v1.0.10 composite
- codecov/codecov-action v2 composite
- actions/checkout v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- pytorch/pytorch ${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel build
- pytorch/pytorch ${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel build