Home

Awesome

<img src="CIoU.png" width="800px"/>

Complete-IoU Loss and Cluster-NMS for improving Object Detection and Instance Segmentation.

This is the code for our papers:

@Inproceedings{zheng2020diou,
  author    = {Zheng, Zhaohui and Wang, Ping and Liu, Wei and Li, Jinze and Ye, Rongguang and Ren, Dongwei},
  title     = {Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression},
  booktitle = {The AAAI Conference on Artificial Intelligence (AAAI)},
  year      = {2020},
}

@Article{zheng2021ciou,
  author    = {Zheng, Zhaohui and Wang, Ping and Ren, Dongwei and Liu, Wei and Ye, Rongguang and Hu, Qinghua and Zuo, Wangmeng},
  title     = {Enhancing Geometric Factors in Model Learning and Inference for Object Detection and Instance Segmentation},
  booktitle = {IEEE Transactions on Cybernetics},
  year      = {2021},
}

SSD_FPN_DIoU,CIoU in PyTorch

The code references SSD: Single Shot MultiBox Object Detector, in PyTorch, mmdet and JavierHuang. Currently, some experiments are carried out on the VOC dataset, if you want to train your own dataset, more details can be refer to the links above.

Losses

Losses can be chosen with the losstype option in the config/config.py file The valid options are currently: [Iou|Giou|Diou|Ciou|SmoothL1].

VOC:
  'losstype': 'Ciou'

Fold-Structure

The fold structure as follow:

Environment

Datasets

Training

Training VOC

python tools/train.py

Evaluation

python tools/ap.py --trained_model {your_weight_address}

For example: (the output is AP50, AP75 and AP of our CIoU loss)

Results:
0.033
0.015
0.009
0.011
0.008
0.083
0.044
0.042
0.004
0.014
0.026
0.034
0.010
0.006
0.009
0.006
0.009
0.013
0.106
0.011
0.025
~~~~~~~~

--------------------------------------------------------------
Results computed with the **unofficial** Python eval code.
Results should be very close to the official MATLAB eval code.
--------------------------------------------------------------
0.7884902583981603 0.5615516772893671 0.5143832356646468

Test

python test.py -- trained_model {your_weight_address}

if you want to visual the box, you can add the command --visbox True(default False)

Performance

VOC2007 Test mAP

TestAPAP75
IoU51.054.7
GIoU51.155.4
DIoU51.355.7
CIoU51.556.4
CIoU 1653.358.2
"16" means bbox regression weight is set to 16.

Cluster-NMS

See Detect function of utils/detection/detection.py for our Cluster-NMS implementation.

Currently, NMS only surports cluster_nms, cluster_diounms, cluster_weighted_nms, cluster_weighted_diounms. (See 'nms_kind' in config/config.py)

Hardware

BackboneLossRegression weightNMSFPStimebox APbox AP75
Resnet50-FPNCIoU5Fast NMS28.834.750.756.2
Resnet50-FPNCIoU5Original NMS17.856.151.556.4
Resnet50-FPNCIoU5DIoU-NMS11.487.651.956.6
Resnet50-FPNCIoU5Cluster-NMS28.035.751.556.4
Resnet50-FPNCIoU5Cluster-DIoU-NMS27.736.151.956.6
Resnet50-FPNCIoU5Weighted Cluster-NMS26.837.351.956.3
Resnet50-FPNCIoU5Weighted + Cluster-DIoU-NMS26.537.852.457.0

Hardware

BackboneLossRegression weightNMSFPStimebox APbox AP75
Resnet50-FPNCIoU16Original NMS19.750.953.358.2
Resnet50-FPNCIoU16Cluster-NMS28.035.753.458.2
Resnet50-FPNCIoU16Cluster-DIoU-NMS26.537.753.758.6
Resnet50-FPNCIoU16Weighted Cluster-NMS26.937.253.858.7
Resnet50-FPNCIoU16Weighted + Cluster-DIoU-NMS26.338.054.159.0

Note:

Pretrained weights

Here are the trained models using the configurations in this repository.