The official implementation of Equalization Loss v1 & v2 (CVPR 2020, 2021) based on MMDetection.

Related tags

Deep Learning eqlv2
Overview

The Equalization Losses for Long-tailed Object Detection and Instance Segmentation

This repo is official implementation CVPR 2021 paper: Equalization Loss v2: A New Gradient Balance Approach for Long-tailed Object Detection and CVPR 2020 paper: Equalization loss for long-tailed object recognition

Besides the equalization losses, this repo also includes some other algorithms:

  • BAGS (Balance GroupSoftmax)
  • cRT (classifier re-training)
  • LWS (Learnable Weight Scaling)

Requirements

We test our codes on MMDetection V2.3, other versions should also be ok.

Prepare LVIS Dataset

for images

LVIS uses same images as COCO's, so you need to donwload COCO dataset at folder ($COCO), and link those train, val under folder lvis($LVIS).

mkdir -p data/lvis
ln -s $COCO/train $LVIS
ln -s $COCO/val $LVIS
ln -s $COCO/test $LVIS

for annotations

Download the annotations from lvis webset

cd $LVIS
mkdir annotations

then places the annotations at folder ($LVIS/annotations)

Finally you will have the file structure like below:

data
  ├── lvis
  |   ├── annotations
  │   │   │   ├── lvis_v1_val.json
  │   │   │   ├── lvis_v1_train.json
  │   ├── train2017
  │   │   ├── 000000004134.png
  │   │   ├── 000000031817.png
  │   │   ├── ......
  │   ├── val2017
  │   ├── test2017

for API

The official lvis-api and mmlvis can lead to some bugs of multiprocess. See issue

So you can install this LVIS API from my modified repo.

pip install git+https://github.com/tztztztztz/lvis-api.git

Testing with pretrain_models

# ./tools/dist_test.sh ${CONFIG} ${CHECKPOINT} ${GPU_NUM} [--out ${RESULT_FILE}] [--eval ${EVAL_METRICS}]
./tools/dist_test.sh configs/eqlv2/eql_r50_8x2_1x.py data/pretrain_models/eql_r50_8x2_1x.pth 8 --out results.pkl --eval bbox segm

Training

# ./tools/dist_train.sh ${CONFIG} ${GPU_NUM}
./tools/dist_train.sh ./configs/end2end/eql_r50_8x2_1x.py 8 

Once you finished the training, you will get the evaluation metric like this:

bbox AP

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.242
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.401
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.254
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.181
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.317
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.367
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.135
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.225
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.308
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.331
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.223
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.417
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.497
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.197
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.308
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.415

mask AP

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.237
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.372
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.251
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.169
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.316
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.370
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.149
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.228
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.286
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.326
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.210
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.415
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.495
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.213
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.313
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.389

We place ours configs file in ./configs/

  • ./configs/end2end: eqlv2 and other end2end methods
  • ./configs/decouple decoupled-based methods

How to train decouple training methods.

  1. Train the baseline model (or EQL v2).
  2. Prepare the pretrained checkpoint
  # suppose you've trained baseline model
  cd r50_1x
  python ../tools/ckpt_surgery.py --ckpt-path epoch_12.pth --method remove
  # if you want to train LWS, you should choose method 'reset'
  1. Start training with configs
  # ./tools/dist_train.sh ./configs/decouple/bags_r50_8x2_1x.py 8
  # ./tools/dist_train.sh ./configs/decouple/lws_r50_8x2_1x.py 8
  ./tools/dist_train.sh ./configs/decouple/crt_r50_8x2_1x.py 8

Pretrained Models on LVIS

Methods end2end AP APr APc APf pretrained_model
Baseline 16.1 0.0 12.0 27.4 model
EQL 18.6 2.1 17.4 27.2 model
RFS 22.2 11.5 21.2 28.0 model
LWS × 17.0 2.0 13.5 27.4 model
cRT × 22.1 11.9 20.2 29.0 model
BAGS × 23.1 13.1 22.5 28.2 model
EQLv2 23.7 14.9 22.8 28.6 model

How to train EQLv2 on OpenImages

1. Download the data

Download openimages v5 images from link, The folder will be

openimages
    ├── train
    ├── validation
    ├── test

Download the annotations for Challenge 2019 from link, The folder will be

annotations
    ├── challenge-2019-classes-description-500.csv
    ├── challenge-2019-train-detection-human-imagelabels.csv
    ├── challenge-2019-train-detection-bbox.csv
    ├── challenge-2019-validation-detection-bbox.csv
    ├── challenge-2019-validation-detection-human-imagelabels.csv
    ├── ...

2. Convert the .csv to coco-like .json file.

cd tools/openimages2coco/
python convert_annotations.py -p PATH_TO_OPENIMAGES --version challenge_2019 --task bbox 

You may need to donwload the data directory from https://github.com/bethgelab/openimages2coco/tree/master/data and place it at $project_dir/tools/openimages2coco/

3. Train models

  ./tools/dist_train.sh ./configs/openimages/eqlv2_r50_fpn_8x2_2x.py 8

Other configs can be found at ./configs/openimages/

4. Inference and output the json results file

./tools/dist_test.sh ./configs/openimages/eqlv2_r50_fpn_8x2_2x.py openimage_eqlv2_2x/epoch_1.pth 8 --format-only --options "jsonfile_prefix=openimage_eqlv2_2x/results"" 

Then you will get results.bbox.json under folder openimage_eqlv2

5. Convert coco-like json result file to openimage-like csv results file

cd $project_dir/tools/openimages2coco/
python convert_predictions.py -p ../../openimage_eqlv2/results.bbox.json --subset validation

Then you will get results.bbox.csv under folder openimage_eqlv2

6. Evaluate results file using official API

Please refer this link

After this, you will see something like this.

OpenImagesDetectionChallenge_Precision/[email protected],0.5263230244227198                                                                                                                     OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/061hd_',0.4198356678732905                                                                                             OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/06m11',0.40262261023434986                                                                                             OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/03120',0.5694096972722996                                                                                              OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/01kb5b',0.20532245532245533                                                                                            OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/0120dh',0.7934685035604202                                                                                             OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/0dv5r',0.7029194449221794                                                                                              OpenImagesDetectionChallenge_PerformanceByCategory/[email protected]/b'/m/0jbk',0.5959245714028935

7. Parse the AP file and output the grouped AP

cd $project_dir

PYTHONPATH=./:$PYTHONPATH python tools/parse_openimage_metric.py --file openimage_eqlv2_2x/metric

And you will get:

mAP 0.5263230244227198
mAP0: 0.4857693606436219
mAP1: 0.52047262478471
mAP2: 0.5304580597832517
mAP3: 0.5348747991854581
mAP4: 0.5588236678031849

Main Results on OpenImages

Methods AP AP1 AP2 AP3 AP4 AP5
Faster-R50 43.1 26.3 42.5 45.2 48.2 52.6
EQL 45.3 32.7 44.6 47.3 48.3 53.1
EQLv2 52.6 48.6 52.0 53.0 53.4 55.8
Faster-R101 46.0 29.2 45.5 49.3 50.9 54.7
EQL 48.0 36.1 47.2 50.5 51.0 55.0
EQLv2 55.1 51.0 55.2 56.6 55.6 57.5

Citation

If you use the equalization losses, please cite our papers.

@article{tan2020eqlv2,
  title={Equalization Loss v2: A New Gradient Balance Approach for Long-tailed Object Detection},
  author={Tan, Jingru and Lu, Xin and Zhang, Gang and Yin, Changqing and Li, Quanquan},
  journal={arXiv preprint arXiv:2012.08548},
  year={2020}
}
@inproceedings{tan2020equalization,
  title={Equalization loss for long-tailed object recognition},
  author={Tan, Jingru and Wang, Changbao and Li, Buyu and Li, Quanquan and Ouyang, Wanli and Yin, Changqing and Yan, Junjie},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={11662--11671},
  year={2020}
}

Credits

The code for converting openimage to LVIS is from this repo.

Comments
  • Why doesn't it work?

    Why doesn't it work?

    I want to use this method in yolov5, because there is a long tail distribution problem in my data set. The largest class has more than 10000 pictures, and the smallest class has only more than 300 pictures. After 100 epoch, the mAP value is only 9.2%. Without using this method to calculate the loss function, the mAP value is 57.8. Why?

    opened by JiangWeiHn 9
  • IndexError: The shape of the mask [1230] at index 0 does not match the shape of the indexed tensor [1231] at index 0

    IndexError: The shape of the mask [1230] at index 0 does not match the shape of the indexed tensor [1231] at index 0

    Hello, author! I used your code to reproduce EQL loss, but the following error occurred: File "/home/zhhu/eqlv2-master/mmdet/models/losses/eql.py", line 63, in forward eql_w = 1 - self.exclude_func() * self.threshold_func() * (1 - target) File "/home/zhhu/eqlv2-master/mmdet/models/losses/eql.py", line 82, in threshold_func weight[self.freq_info < self.lambda_] = 1 IndexError: The shape of the mask [1230] at index 0 does not match the shape of the indexed tensor [1231] at index 0.

    Do I need to change the code? Where to modify it? We look forward to your reply.

    opened by sanmulab 7
  •  how did you draw figure1: gradient ratio?

    how did you draw figure1: gradient ratio?

    Hello, author! I want to know how to draw a gradient ratio line graph for each category. Can you easily provide relevant visual code? I also want to prove the effectiveness of the method through gradient ratio, but I don't know how to visualize it. Thank you for telling me!

    opened by sanmulab 4
  • Function error

    Function error

    Hi, when i used the EQL loss function, it seems there is an error in the threshold function. Take Lvis v0.5 as example: The shape of pred_class_logits is 1231, including a background class. But the shape of the return of get_image_count_frequency is 1230, excluding the background class. Then the indexerror occured. Is it because of version or exactly an error? It can be fixed by expanding the freq_info, setting the backgound frequence.

    opened by jefferyZhan 4
  • How to train EQL v2 with my imbalance dataset( coco_type format)?

    How to train EQL v2 with my imbalance dataset( coco_type format)?

    Hi, I want to train EQL v2 with my dataset ,not LVIS . And my dataset is not balance. I modify the dataset path in config. And Where should I modify in the code.

    opened by kwuliang 3
  • about the background categories and Instances and Tasks

    about the background categories and Instances and Tasks

    Hello, thank you very much for your work. In EQL, the cross entropy loss is used in the calculation of background categories. In eqlv2, how to deal with the background category. and How to try to understand this sentence :“one task with positive label and C−1 tasks with negative labels are introduced by a single instance.” look forward to your reply !

    opened by Never-Walk-Away 2
  • About use_sigmoid and softmax cross_entropy

    About use_sigmoid and softmax cross_entropy

    Hi, there is have a question about the the loss_cls of bbox_head of roi_head. i think the final calssifier is a Multi classification. why choose sigmoid function instead of softmax function.

    opened by Never-Walk-Away 2
  • Some problems about gradient ratio calculation

    Some problems about gradient ratio calculation

    self._pos_grad += pos_grad self._neg_grad += neg_grad self.pos_neg = self._pos_grad / (self._neg_grad + 1e-10)

    Hello, author. I'm sorry to bother you again. I wonder what 1e-10 in the code does? It is not reflected in the formula of the paper. Is it used to supplement the negative sample gradient?

    opened by sanmulab 2
  • checkpoint performance problem

    checkpoint performance problem

    Hi! Thank you for doing this inspiring work and sharing the code.

    I have a problem with the released checkpoint of EQLv2. I download the provided checkpoint of EQLv2 and evaluate on LVIS1.0 val set using mmdetection. The AP is expected to be 23.7 but got 23.0. my detailed log is here,

    `Evaluating bbox...
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds=all] = 0.230
    Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=300 catIds=all] = 0.396
    Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=300 catIds=all] = 0.233
    Average Precision (AP) @[ IoU=0.50:0.95 | area= s | maxDets=300 catIds=all] = 0.178
    Average Precision (AP) @[ IoU=0.50:0.95 | area= m | maxDets=300 catIds=all] = 0.304
    Average Precision (AP) @[ IoU=0.50:0.95 | area= l | maxDets=300 catIds=all] = 0.341
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds= r] = 0.118
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds= c] = 0.211
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds= f] = 0.301
    Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds=all] = 0.323
    Average Recall (AR) @[ IoU=0.50:0.95 | area= s | maxDets=300 catIds=all] = 0.222
    Average Recall (AR) @[ IoU=0.50:0.95 | area= m | maxDets=300 catIds=all] = 0.407
    Average Recall (AR) @[ IoU=0.50:0.95 | area= l | maxDets=300 catIds=all] = 0.477

    Evaluating segm...
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds=all] = 0.230
    Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=300 catIds=all] = 0.366
    Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=300 catIds=all] = 0.243
    Average Precision (AP) @[ IoU=0.50:0.95 | area= s | maxDets=300 catIds=all] = 0.166
    Average Precision (AP) @[ IoU=0.50:0.95 | area= m | maxDets=300 catIds=all] = 0.308
    Average Precision (AP) @[ IoU=0.50:0.95 | area= l | maxDets=300 catIds=all] = 0.349
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds= r] = 0.140
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds= c] = 0.219
    Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds= f] = 0.281
    Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=300 catIds=all] = 0.321
    Average Recall (AR) @[ IoU=0.50:0.95 | area= s | maxDets=300 catIds=all] = 0.210
    Average Recall (AR) @[ IoU=0.50:0.95 | area= m | maxDets=300 catIds=all] = 0.408
    Average Recall (AR) @[ IoU=0.50:0.95 | area= l | maxDets=300 catIds=all] = 0.483
    OrderedDict([('bbox_AP', 0.23), ('bbox_AP50', 0.396), ('bbox_AP75', 0.233), ('bbox_APs', 0.178), ('bbox_APm', 0.304), ('bbox_APl', 0.341), ('bbox_APr', 0.118), ('bbox_APc', 0.211), ('bbox_APf', 0.301), ('bbox_ mAP_copypaste', 'AP:0.230 AP50:0.396 AP75:0.233 APs:0.178 APm:0.304 APl:0.341 APr:0.118 APc:0.211 APf:0.301'), ('segm_AP', 0.23), ('segm_AP50', 0.366), ('segm_AP75', 0.243), ('segm_APs', 0.166), ('segm_APm', 0 .308), ('segm_APl', 0.349), ('segm_APr', 0.14), ('segm_APc', 0.219), ('segm_APf', 0.281), ('segm_mAP_copypaste', 'AP:0.230 AP50:0.366 AP75:0.243 APs:0.166 APm:0.308 APl:0.349 APr:0.140 APc:0.219 APf:0.281')])`

    I don't know what's wrong, does anybody get the same problem. I use the standard LVIS1.0 val.

    Thanks in advance.

    opened by yypurpose 2
  • EQLv2 + RFS would it work?

    EQLv2 + RFS would it work?

    Hello authors, Thank you for the wonderful work :) Did you try Repeat factor sampling together with EQLv2 and did this improve the result? In your paper RFS is compared against EQLv2 but not combined and I am wondering whether that could be a good addition?

    opened by kostas1515 1
  • I train eqlv2 using 8 gpus, howerer, the AP is only 0.192

    I train eqlv2 using 8 gpus, howerer, the AP is only 0.192

    Describe the issue

    I used your training command, but it doesn't works. But i use your pretrained model to test, i can get a expected result. Tkanks.

    Reproduction

    1. What command or script did you run?
    ./tools/dist_test.sh configs/end2end/eqlv2_r50_8x2_1x.py data/pretrain_models/eqlv2_1x.pth 8 --out results.pkl --eval bbox segm
    
    1. What config dir you run?
    configs/end2end/eqlv2_r50_8x2_1x.py 
    
    1. Did you make any modifications on the code or config? Did you understand what you have modified? No.

    2. What dataset did you use? LVIS

    Environment

    1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here.
    Python: 3.7.0 (default, Oct  9 2018, 10:31:47) [GCC 7.3.0]
    CUDA available: True
    CUDA_HOME: None
    GPU 0,1,2,3,4,5,6,7: TITAN Xp
    GCC: gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
    PyTorch: 1.5.0
    PyTorch compiling details: PyTorch built with:
      - GCC 7.3
      - C++ Version: 201402
      - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
      - Intel(R) MKL-DNN v0.21.1 (Git Hash 7d2fd500bc78936d1d648ca713b901012f470dbc)
      - OpenMP 201511 (a.k.a. OpenMP 4.5)
      - NNPACK is enabled
      - CPU capability usage: AVX2
      - CUDA Runtime 10.2
      - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
      - CuDNN 7.6.5
      - Magma 2.5.2
      - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_INTERNAL_THREADPOOL_IMPL -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing
    -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF,
    
    TorchVision: 0.6.0a0+82fd1c8
    OpenCV: 4.5.1
    MMCV: 1.0.5
    MMDetection: ('2.3.0',)
    MMDetection Compiler: GCC 7.3
    MMDetection CUDA Compiler: 10.2
    

    Results

    i wish get your result in readme file, howerer, the really result is this.

    Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.192
     Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.310
     Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.206
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.153
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.259
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.318
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.021
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.169
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.293
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.268
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.196
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.354
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.449
    2021-04-13 23:22:31,913 - mmdet - INFO - Evaluating segm...
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.184
     Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.288
     Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.194
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.140
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.254
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.317
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.018
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.169
     Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.274
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.257
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.180
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.345
     Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.442
    2021-04-13 23:38:18,184 - mmdet - INFO - Epoch [12][6213/6213]  lr: 2.000e-04, bbox_AP: 0.1920, bbox_AP50: 0.3100, bbox_AP75: 0.2060, bbox_APs: 0.1530, bbox_APm: 0.2590,
     bbox_APl: 0.3180, bbox_APr: 0.0210, bbox_APc: 0.1690, bbox_APf: 0.2930, bbox_mAP_copypaste: AP:0.192 AP50:0.310 AP75:0.206 APs:0.153 APm:0.259 APl:0.318 APr:0.021 APc:0
    .169 APf:0.293, segm_AP: 0.1840, segm_AP50: 0.2880, segm_AP75: 0.1940, segm_APs: 0.1400, segm_APm: 0.2540, segm_APl: 0.3170, segm_APr: 0.0180, segm_APc: 0.1690, segm_APf
    : 0.2740, segm_mAP_copypaste: AP:0.184 AP50:0.288 AP75:0.194 APs:0.140 APm:0.254 APl:0.317 APr:0.018 APc:0.169 APf:0.274
    

    Issue fix

    If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

    opened by CRuJia 1
  • RuntimeError: The expanded size of the tensor (501) must match the existing size (1204) at non-singleton dimension 1.

    RuntimeError: The expanded size of the tensor (501) must match the existing size (1204) at non-singleton dimension 1.

    作者大大您好,我在使用4个gpu按照您项目的配置使用eqlv2去训练openimage时,报错显示如下信息 File "/public/software/apps/DeepLearning/Python3.7.12/torch1.10-dtk22.04.2-build/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs)return forward_call(*input, **kwargs)

    File "/public/home/taoy/eqlv2-master/mmdet/models/losses/eqlv2.py", line 72, in forward File "/public/home/taoy/eqlv2-master/mmdet/models/losses/eqlv2.py", line 72, in forward pos_w, neg_w = self.get_weight(cls_score) File "/public/home/taoy/eqlv2-master/mmdet/models/losses/eqlv2.py", line 115, in get_weight neg_w = neg_w.view(1, -1).expand(self.n_i, self.n_c) RuntimeError: The expanded size of the tensor (501) must match the existing size (1204) at non-singleton dimension 1. Target sizes: [1024, 501]. Tensor sizes: [1, 1204] pos_w, neg_w = self.get_weight(cls_score) File "/public/home/taoy/eqlv2-master/mmdet/models/losses/eqlv2.py", line 115, in get_weight neg_w = neg_w.view(1, -1).expand(self.n_i, self.n_c) RuntimeError: The expanded size of the tensor (501) must match the existing size (1204) at non-singleton dimension 1. Target sizes: [1024, 501]. Tensor sizes: [1, 1204],请问您是否可以帮助我

    opened by pohunshi 0
  • an error in forward function

    an error in forward function

    Thanks for your error report and we appreciate it a lot.

    Checklist

    1. I have searched related issues but cannot get the expected help.
    2. The bug has not been fixed in the latest version.

    Describe the bug A clear and concise description of what the bug is. File "/home/lsc/桌面/mmdBox/mmdetection/mmdet/models/losses/eqlv2.py", line 68, in expand_label target[torch.arange(self.n_i), gt_classes] = 1 IndexError: tensors used as indices must be long, byte or bool tensors

    Reproduction

    1. What command or script did you run?
    I tried to use the loss function in yolox
    bash tools/dist_train.sh  /home/lsc/桌面/mmdBox/mmdetection/configs/yolox /yolox_s_eqlv2_8x8_300e_coco.py  1
    
    A placeholder for the command.
    
    1. Did you make any modifications on the code or config? Did you understand what you have modified?
    2. What dataset did you use?

    Environment

    1. Please run python mmdet/utils/collect_env.py to collect necessary environment information and paste it here.
    2. You may add addition that may be helpful for locating the problem, such as
      • How you installed PyTorch [e.g., pip, conda, source] follow the official way of mmdetection of v2.25.2
      • Other environment variables that may be related (such as $PATH, $LD_LIBRARY_PATH, $PYTHONPATH, etc.)
      • sys.platform: linux Python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:18) [GCC 10.3.0] CUDA available: True GPU 0: NVIDIA GeForce RTX 3090 CUDA_HOME: None GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.10.0

    Error traceback If applicable, paste the error trackback here.

    A placeholder for trackback.
    

    Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!

    opened by SicongLiu998 0
  • installation problem

    installation problem

    Hi, thanks for the great work! For installation, could you give more details?

    I tried pip install -v -e . in this project directory following the installation instructions in mmdetection, but could not be installed, specifically the following error is raised:

    ERROR: Could not find a version that satisfies the requirement pycocotools (unavailable) (from mmdet) (from versions: 2.0.0, 2.0.1, 2.0.2a1, 2.0.2, 2.0.3, 2.0.4)
    ERROR: No matching distribution found for pycocotools (unavailable)
    

    I tried with mmdetection, it works, but just within this project cannot install.

    opened by twangnh 0
  • Implementation on Sigle GPU

    Implementation on Sigle GPU

    Hey @tztztztztz,

    Your work looks amazing..! i am interested to reproduce the results in the page using SINGLE GPU, can it be possible?. if so, what could be the changes i should consider before hand

    opened by sourabhsugandhi 0
  • Debug problem

    Debug problem

    Hi, Thanks to your explanatory repository, I can run the test and training code easily. To understand better, I wanted to debug the code; however, I couldn't debug. While training, I use './tools/dist_train.sh ./configs/end2end/eqlv2_r50_8x2_1x.py 1 ' command as mentioned in repo. However, I couldn't figure out debug with 'dist_train.sh' and reach the train.py file. Could you help me how to debug for training?

    opened by ahmetkoc11 1
Owner
Jingru Tan
Jingru Tan
Fang Zhonghao 13 Nov 19, 2022
Official implementation for CVPR 2021 paper: Adaptive Class Suppression Loss for Long-Tail Object Detection

Adaptive Class Suppression Loss for Long-Tail Object Detection This repo is the official implementation for CVPR 2021 paper: Adaptive Class Suppressio

CASIA-IVA-Lab 67 Dec 4, 2022
git《Investigating Loss Functions for Extreme Super-Resolution》(CVPR 2020) GitHub:

Investigating Loss Functions for Extreme Super-Resolution NTIRE 2020 Perceptual Extreme Super-Resolution Submission. Our method ranked first and secon

Sejong Yang 0 Oct 17, 2022
mmdetection version of TinyBenchmark.

introduction This project is an mmdetection version of TinyBenchmark. TODO list: add TinyPerson dataset and evaluation add crop and merge for image du

null 34 Aug 27, 2022
Convert openmmlab (not only mmdetection) series model to tensorrt

MMDet to TensorRT This project aims to convert the mmdetection model to TensorRT model end2end. Focus on object detection for now. Mask support is exp

JinTian 4 Dec 17, 2021
OBBDetection: an oriented object detection toolbox modified from MMdetection

OBBDetection note: If you have questions or good suggestions, feel free to propose issues and contact me. introduction OBBDetection is an oriented obj

MIXIAOXIN_HO 3 Nov 11, 2022
An implementation for the loss function proposed in Decoupled Contrastive Loss paper.

Decoupled-Contrastive-Learning This repository is an implementation for the loss function proposed in Decoupled Contrastive Loss paper. Requirements P

Ramin Nakhli 71 Dec 4, 2022
Official implementation of NeurIPS 2021 paper "One Loss for All: Deep Hashing with a Single Cosine Similarity based Learning Objective"

Official implementation of NeurIPS 2021 paper "One Loss for All: Deep Hashing with a Single Cosine Similarity based Learning Objective"

Ng Kam Woh 71 Dec 22, 2022
PyTorch implementation for Partially View-aligned Representation Learning with Noise-robust Contrastive Loss (CVPR 2021)

2021-CVPR-MvCLN This repo contains the code and data of the following paper accepted by CVPR 2021 Partially View-aligned Representation Learning with

XLearning Group 33 Nov 1, 2022
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

null 32 Sep 21, 2022
Implement of "Training deep neural networks via direct loss minimization" in PyTorch for 0-1 loss

This is the implementation of "Training deep neural networks via direct loss minimization" published at ICML 2016 in PyTorch. The implementation targe

Cuong Nguyen 1 Jan 18, 2022
[CVPR 2022] Official code for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved Neural Network Calibration"

MDCA Calibration This is the official PyTorch implementation for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved

MDCA Calibration 21 Dec 22, 2022
CVPR 2021: "The Spatially-Correlative Loss for Various Image Translation Tasks"

Spatially-Correlative Loss arXiv | website We provide the Pytorch implementation of "The Spatially-Correlative Loss for Various Image Translation Task

Chuanxia Zheng 89 Jan 4, 2023
An official implementation of "SFNet: Learning Object-aware Semantic Correspondence" (CVPR 2019, TPAMI 2020) in PyTorch.

PyTorch implementation of SFNet This is the implementation of the paper "SFNet: Learning Object-aware Semantic Correspondence". For more information,

CV Lab @ Yonsei University 87 Dec 30, 2022
Official pytorch implementation of "Feature Stylization and Domain-aware Contrastive Loss for Domain Generalization" ACMMM 2021 (Oral)

Feature Stylization and Domain-aware Contrastive Loss for Domain Generalization This is an official implementation of "Feature Stylization and Domain-

null 22 Sep 22, 2022
Code release for The Devil is in the Channels: Mutual-Channel Loss for Fine-Grained Image Classification (TIP 2020)

The Devil is in the Channels: Mutual-Channel Loss for Fine-Grained Image Classification Code release for The Devil is in the Channels: Mutual-Channel

PRIS-CV: Computer Vision Group 230 Dec 31, 2022
PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization using Augmented-Self Reference and Dense Semantic Correspondence) and pre-trained model on ImageNet dataset

Reference-Based-Sketch-Image-Colorization-ImageNet This is a PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization usin

Yuzhi ZHAO 11 Jul 28, 2022
git git《Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking》(CVPR 2021) GitHub:git2] 《Masksembles for Uncertainty Estimation》(CVPR 2021) GitHub:git3]

Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking Ning Wang, Wengang Zhou, Jie Wang, and Houqiang Li Accepted by CVPR

NingWang 236 Dec 22, 2022
Official code for "End-to-End Optimization of Scene Layout" -- including VAE, Diff Render, SPADE for colorization (CVPR 2020 Oral)

End-to-End Optimization of Scene Layout Code release for: End-to-End Optimization of Scene Layout CVPR 2020 (Oral) Project site, Bibtex For help conta

Andrew Luo 41 Dec 9, 2022