Pull Request已成功合入, 合并人@CANN-robot
(感谢 黄晓彬 的贡献)变更摘要
此 PR 为 SortedNMS 算子新增完整的算子实现,包括算子注册、tiling 逻辑、SIMT 内核、形状推导、测试用例及平台配置。旧版 SortedNMS 注册从 op_cv_proto_extend.h 中移除,迁移至独立的算子目录 objdetect/sorted_nms/,并扩展了多核 pairwise mask 策略以支持更大规模的包围框数量(1025–8192)。新增的 AscendC 内核实现针对 ascend950 平台,支持 float16/float32 的独立 dtype 组合。
主要改动
- 移除旧版算子注册:从
common/inc/op_graph/op_cv_proto_extend.h中删除原有的SortedNMS算子定义(含输入输出签名与注释),为新的独立实现腾出空间。 - 新增独立算子注册:在
objdetect/sorted_nms/op_graph/sorted_nms_proto.h中重新注册SortedNMS,定义 6 个输入(boxes、sorted_scores、input_indices、max_output_size、iou_threshold、score_threshold)、1 个输出(selected_indices)及offset属性,并放宽boxes与sorted_scores的 dtype 允许独立设定。 - 新增 Tiling 与多核策略:在
objdetect/sorted_nms/op_host/arch35/sorted_nms_tiling_arch35.cpp中实现 tiling 函数SortedNMSTilingFunc,根据boxesNum选择单核(<1025 或 >8192)或 pairwise mask 多核(1025–8192)策略,并计算 workspace 大小及SortedNMSTilingData参数。 - 新增 SIMT 内核实现:在
objdetect/sorted_nms/op_kernel/arch35/sorted_nms_simt.h中实现Process入口及核心函数SortedNMSSingleCore、BuildPairwiseMasks/BuildPairwiseMasksLocal、SelectFromPairwiseMasks,支持多核并行构建 pairwise 抑制掩码以及基于 UB 局部缓存优化 float16 场景的 IOU 计算。 - 新增算子定义与形状推导:在
sorted_nms_def.cpp中定义OpDef与AICoreConfig(含 4 种 dtype 组合的动态编译/动态形状支持);在sorted_nms_infershape.cpp中实现输出形状为[UNKNOWN_DIM]及形状范围推导。 - 新增二进制配置与平台注册:在
sorted_nms_binary.json中为ascend950注册 4 种 dtype 组合的内核二进制;在ascendc_config.json中将SortedNMS加入 AscendC 算子清单。 - 新增测试与黄金参考:在
tests/assets/golden.py中提供顺序 NMS 的 Python 参考实现与compare比较逻辑;在examples/test_geir_sorted_nms.cpp中提供 GEIR 端到端示例测试。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| */*/README.md | ✅ 汤平川, 陈娇, 刘伟 (3/2) | ✅ 陈娇 (1/1) |
| */*/op_graph/*_proto.h | ✅ 王永光, 刘伟, 汤平川 (3/2) | ✅ 王永光 (1/1) |
| */*/op_graph/*_proto_extend.h | ✅ 王永光, 刘伟, 汤平川 (3/2) | ✅ 王永光 (1/1) |
| */*/op_host/*_def.cpp | ✅ 刘伟, 汤平川, 王永光 (3/2) | ✅ 王永光 (1/1) |
| repo-cann/ops-cv | ✅ 刘伟, 汤平川 (2/2) | ✅ 刘伟, 汤平川 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


流水线任务触发成功
任务链接 [00c095e96aee4e76a9c521676937c80c][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ⚠️ WARNING | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-cv | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-cv | ✅ SUCCESS | ||
| UT_Test_report_lcov | ✅ SUCCESS |
[2026-08-05 22:34:05] CI执行结束


流水线任务触发成功
任务链接 [061021ccb16742e2b8d89b4a14d8180f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ❌ FAILED | >>>>> | >>>>> |


流水线任务触发成功
任务链接 [50a5a50b33ca4f41892f98d9f064fc74][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ⚠️ WARNING | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-cv | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-cv | ✅ SUCCESS | ||
| UT_Test_report_lcov | ✅ SUCCESS |
[2026-08-05 22:49:39] CI执行结束


流水线任务触发成功
任务链接 [be1872373b15443b97222bf7edd51bc4][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> |
[2026-08-05 22:42:31] CI执行结束


/approve


/lgtm
/approve


/lgtm
/approve


描述
在ops-cv仓库新增SortedNMS算子,支持在已按分数降序排列的候选框序列上,按照IoU阈值贪心选择非抑制框,输出被选中框在原始boxes中的索引。
关联的Issue
https://gitcode.com/cann/ops-cv/issues/711
测试
1 完成200+泛化用例验证
2 完成 100+三方精度对比和性能对比
3 二级冒烟通过
文档更新
新增了 objdetect/sorted_nms/README.md 文件
类型标签