Home

Awesome

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

Ultralytics-YOLOv3-Cluster-NMS

Cluster-NMS into YOLOv3 Pytorch

Our paper is accepted by IEEE Transactions on Cybernetics (TCYB).

This is the code for our paper:

@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},
}

Introduction

In this paper, we propose Complete-IoU (CIoU) loss and Cluster-NMS for enhancing geometric factors in both bounding box regression and Non-Maximum Suppression (NMS), leading to notable gains of average precision (AP) and average recall (AR), without the sacrifice of inference efficiency. In particular, we consider three geometric factors, i.e., overlap area, normalized central point distance and aspect ratio, which are crucial for measuring bounding box regression in object detection and instance segmentation. The three geometric factors are then incorporated into CIoU loss for better distinguishing difficult regression cases. The training of deep models using CIoU loss results in consistent AP and AR improvements in comparison to widely adopted Ln-norm loss and IoU-based loss. Furthermore, we propose Cluster-NMS, where NMS during inference is done by implicitly clustering detected boxes and usually requires less iterations. Cluster-NMS is very efficient due to its pure GPU implementation, and geometric factors can be incorporated to improve both AP and AR. In the experiments, CIoU loss and Cluster-NMS have been applied to state-of-the-art instance segmentation (e.g., YOLACT), and object detection (e.g., YOLO v3, SSD and Faster R-CNN) models.

This repo only focuses on NMS improvement based on https://github.com/ultralytics/yolov3.

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

This directory contains PyTorch YOLOv3 software developed by Ultralytics LLC, and is freely available for redistribution under the GPL-3.0 license. For more information please visit https://www.ultralytics.com.

Description

The https://github.com/ultralytics/yolov3 repo contains inference and training code for YOLOv3 in PyTorch. The code works on Linux, MacOS and Windows. Training is done on the COCO dataset by default: https://cocodataset.org/#home. Credit to Joseph Redmon for YOLO: https://pjreddie.com/darknet/yolo/.

Requirements

Python 3.7 or later with all pip install -U -r requirements.txt packages including torch >= 1.5. Docker images come with all dependencies preinstalled. Docker requirements are:

mAP

<i></i>SizeCOCO mAP<br>@0.5...0.95COCO mAP<br>@0.5
YOLOv3-tiny<br>YOLOv3<br>YOLOv3-SPP<br>YOLOv3-SPP-ultralytics32014.0<br>28.7<br>30.5<br>37.729.1<br>51.8<br>52.3<br>56.8
YOLOv3-tiny<br>YOLOv3<br>YOLOv3-SPP<br>YOLOv3-SPP-ultralytics41616.0<br>31.2<br>33.9<br>41.233.0<br>55.4<br>56.9<br>60.6
YOLOv3-tiny<br>YOLOv3<br>YOLOv3-SPP<br>YOLOv3-SPP-ultralytics51216.6<br>32.7<br>35.6<br>42.634.9<br>57.7<br>59.5<br>62.4
YOLOv3-tiny<br>YOLOv3<br>YOLOv3-SPP<br>YOLOv3-SPP-ultralytics60816.6<br>33.1<br>37.0<br>43.135.4<br>58.2<br>60.7<br>62.8

Cluster-NMS

Hardware

Evaluation command: python3 test.py --cfg yolov3-spp.cfg --weights yolov3-spp-ultralytics.pt

AP reports on coco 2014 minival.

Image SizeModelNMSFPSbox APbox AP75box AR100
608YOLOv3-SPP-ultralyticsFast NMS85.542.245.160.1
608YOLOv3-SPP-ultralyticsOriginal NMS14.642.645.862.5
608YOLOv3-SPP-ultralyticsDIoU-NMS7.942.746.263.4
608YOLOv3-SPP-ultralyticsOriginal NMS Torchvision95.242.645.862.5
608YOLOv3-SPP-ultralyticsCluster-NMS82.642.645.862.5
608YOLOv3-SPP-ultralyticsCluster-DIoU-NMS76.942.746.263.4
608YOLOv3-SPP-ultralyticsWeighted-NMS11.242.946.462.7
608YOLOv3-SPP-ultralyticsWeighted Cluster-NMS68.042.946.462.7
608YOLOv3-SPP-ultralyticsWeighted + Cluster-DIoU-NMS64.943.146.863.7
608YOLOv3-SPP-ultralyticsMerge + Torchvision NMS88.542.846.363.0
608YOLOv3-SPP-ultralyticsMerge + DIoU + Torchvision NMS82.543.046.663.2

Conclusion

Citation

DOI