[Paper Review] Hashing-based Non-Maximum Suppression for Crowded Object Detection
This paper proposes Hashing-based Non-Maximum Suppression (HNMS), a novel O(N) algorithm that accelerates object detection by hashing bounding boxes into discrete cells using an IoU-aware hashing function (IoUHash), ensuring boxes in the same cell are within a guaranteed IoU threshold. HNMS achieves up to 7.4x speedup on CPU and 6.8x on GPU with comparable or improved mAP, especially effective in crowded scenes.
In this paper, we propose an algorithm, named hashing-based non-maximum suppression (HNMS) to efficiently suppress the non-maximum boxes for object detection. Non-maximum suppression (NMS) is an essential component to suppress the boxes at closely located locations with similar shapes. The time cost tends to be huge when the number of boxes becomes large, especially for crowded scenes. The basic idea of HNMS is to firstly map each box to a discrete code (hash cell) and then remove the boxes with lower confidences if they are in the same cell. Considering the intersection-over-union (IoU) as the metric, we propose a simple yet effective hashing algorithm, named IoUHash, which guarantees that the boxes within the same cell are close enough by a lower IoU bound. For two-stage detectors, we replace NMS in region proposal network with HNMS, and observe significant speed-up with comparable accuracy. For one-stage detectors, HNMS is used as a pre-filter to speed up the suppression with a large margin. Extensive experiments are conducted on CARPK, SKU-110K, CrowdHuman datasets to demonstrate the efficiency and effectiveness of HNMS. Code is released at \url{https://github.com/microsoft/hnms.git}.
Motivation & Objective
- Address the high computational cost of traditional NMS in crowded object detection, where O(N²) complexity becomes prohibitive with thousands of candidate boxes.
- Overcome limitations of existing NMS acceleration methods like MaxPoolNMS, which rely on unproven assumptions about anchor proximity and regression consistency.
- Design a hashing scheme that guarantees IoU-based proximity between boxes in the same hash cell, ensuring suppression quality without sacrificing accuracy.
- Enable efficient, scalable NMS for both two-stage and one-stage detectors by integrating HNMS as a replacement or pre-filtering step.
- Achieve significant speedups in inference while maintaining or slightly improving detection mAP, particularly in high-density scenarios.
Proposed method
- Propose a novel hashing function, IoUHash, which maps bounding boxes to discrete hash cells based on their size (log-scale) and offset (natural scale), ensuring IoU proximity within cells.
- Derive a theoretical lower bound on IoU between any two boxes within the same hash cell, guaranteeing that only sufficiently similar boxes are grouped together.
- Apply HNMS multiple times with different hashing parameters to mitigate boundary effects where nearby boxes fall into adjacent cells.
- For two-stage detectors, replace RPN's NMS with HNMS directly, achieving speedups without accuracy loss.
- For one-stage detectors, use HNMS as a pre-filter to drastically reduce the number of boxes passed to standard NMS, accelerating the overall pipeline.
- Use a higher IoU threshold (α = 0.73) in pre-filtering to preserve positive boxes, with a derived lower bound of 0.502, slightly above standard NMS threshold (0.5).
Experimental results
Research questions
- RQ1Can a hashing-based approach reduce the time complexity of NMS from O(N²) to O(N) while maintaining detection accuracy in crowded scenes?
- RQ2Can a custom hashing function be designed to ensure IoU-based proximity between boxes in the same hash cell, enabling safe suppression?
- RQ3How effective is HNMS as a replacement for NMS in two-stage detectors (e.g., RPN) in terms of speed and accuracy?
- RQ4To what extent can HNMS serve as a pre-filtering step in one-stage detectors to accelerate NMS without degrading mAP?
- RQ5How does HNMS perform under varying numbers of candidate boxes and across different hardware (CPU vs. GPU) in real-world detection benchmarks?
Key findings
- On the CARPK dataset, HNMS achieved 7.4x speedup in CPU mode with no accuracy loss, improving mAP from 95.4% (NMS) to 96.4% (HNMS) while reducing inference time below 10ms.
- In GPU mode, HNMS achieved up to 6.8x speedup on CARPK and 9.1x on SKU-110K when used as a pre-filter with K=4, with only a 0.1-point mAP drop at the cost of higher pre-filtering time.
- HNMS demonstrated low sensitivity to input size on GPU: time cost increased only from 2.4ms to 2.9ms when box count rose from 1,000 to 9,000, indicating strong parallelization efficiency.
- The method maintained comparable or slightly better mAP than standard NMS across all datasets (CARPK, SKU-110K, CrowdHuman), with consistent speedups in both CPU and GPU settings.
- The IoUHash function ensures a theoretical lower bound of 0.502 on IoU between boxes in the same cell when α=0.73, providing a provable guarantee for suppression quality.
- When used as a pre-filter in RetinaNet, HNMS reduced total NMS time by up to 9.1x on SKU-110K (GPU) with minimal mAP degradation, demonstrating strong scalability in one-stage detection pipelines.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.