瀏覽代碼

Update onnx-metadata.json

Lutz Roeder 1 月之前
父節點
當前提交
1014dc24ad
共有 1 個文件被更改,包括 11 次插入3 次删除
  1. 11 3
      source/onnx-metadata.json

+ 11 - 3
source/onnx-metadata.json

@@ -39889,7 +39889,7 @@
     "name": "NonMaxSuppression",
     "module": "ai.onnx",
     "version": 10,
-    "description": "Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes.\nBounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box.\nNote that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to\northogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system\nresult in the same boxes being selected by the algorithm.\nThe selected_indices output is a set of integers indexing into the input collection of bounding boxes representing the selected boxes.\nThe bounding box coordinates corresponding to the selected indices can then be obtained using the Gather or GatherND operation.\n",
+    "description": "Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes.\nBounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box.\nBoxes are suppressed if their IOU with a previously selected box is strictly greater than iou_threshold (i.e., boxes with IOU exactly equal to the threshold are kept).\nNote that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to\northogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system\nresult in the same boxes being selected by the algorithm.\nThe selected_indices output is a set of integers indexing into the input collection of bounding boxes representing the selected boxes.\nThe bounding box coordinates corresponding to the selected indices can then be obtained using the Gather or GatherND operation.\n",
     "attributes": [
       {
         "name": "center_point_box",
@@ -39953,6 +39953,10 @@
         "summary": "nonmaxsuppression_identical_boxes",
         "code": "node = onnx.helper.make_node(\n    \"NonMaxSuppression\",\n    inputs=[\n        \"boxes\",\n        \"scores\",\n        \"max_output_boxes_per_class\",\n        \"iou_threshold\",\n        \"score_threshold\",\n    ],\n    outputs=[\"selected_indices\"],\n)\nboxes = np.array(\n    [\n        [\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n        ]\n    ]\n).astype(np.float32)\nscores = np.array(\n    [[[0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9]]]\n).astype(np.float32)\nmax_output_boxes_per_class = np.array([3]).astype(np.int64)\niou_threshold = np.array([0.5]).astype(np.float32)\nscore_threshold = np.array([0.0]).astype(np.float32)\nselected_indices = np.array([[0, 0, 0]]).astype(np.int64)\n\nexpect(\n    node,\n    inputs=[\n        boxes,\n        scores,\n        max_output_boxes_per_class,\n        iou_threshold,\n        score_threshold,\n    ],\n    outputs=[selected_indices],\n    name=\"test_nonmaxsuppression_identical_boxes\",\n)"
       },
+      {
+        "summary": "nonmaxsuppression_iou_threshold_boundary",
+        "code": "\"\"\"Test boundary condition where IoU exactly equals threshold.\n\nThis test verifies that the comparison is strict (>), not inclusive (>=).\nWhen IoU exactly equals the threshold, boxes should be KEPT, not suppressed.\nThis follows PyTorch's NMS implementation.\n\"\"\"\nnode = onnx.helper.make_node(\n    \"NonMaxSuppression\",\n    inputs=[\n        \"boxes\",\n        \"scores\",\n        \"max_output_boxes_per_class\",\n        \"iou_threshold\",\n        \"score_threshold\",\n    ],\n    outputs=[\"selected_indices\"],\n)\n# Two boxes with 50% overlap in each dimension\n# box1=[0,0,1,1], box2=[0.5,0.5,1.5,1.5]\n# Intersection area = 0.5 * 0.5 = 0.25\n# Union area = 1.0 + 1.0 - 0.25 = 1.75\n# IoU = 0.25 / 1.75 (exact value computed below as float32)\nboxes = np.array(\n    [\n        [\n            [0.0, 0.0, 1.0, 1.0],  # box 0\n            [0.5, 0.5, 1.5, 1.5],  # box 1 - overlaps box 0\n        ]\n    ]\n).astype(np.float32)\nscores = np.array([[[0.9, 0.8]]]).astype(np.float32)\nmax_output_boxes_per_class = np.array([3]).astype(np.int64)\n# Compute the exact IoU value and use it as threshold\n# This ensures the threshold exactly equals the IoU\nexact_iou = np.float32(0.25 / 1.75)\niou_threshold = np.array([exact_iou]).astype(np.float32)\nscore_threshold = np.array([0.0]).astype(np.float32)\n# Both boxes should be selected because IoU == threshold (not > threshold)\nselected_indices = np.array([[0, 0, 0], [0, 0, 1]]).astype(np.int64)\n\nexpect(\n    node,\n    inputs=[\n        boxes,\n        scores,\n        max_output_boxes_per_class,\n        iou_threshold,\n        score_threshold,\n    ],\n    outputs=[selected_indices],\n    name=\"test_nonmaxsuppression_iou_threshold_boundary\",\n)"
+      },
       {
         "summary": "nonmaxsuppression_limit_output_size",
         "code": "node = onnx.helper.make_node(\n    \"NonMaxSuppression\",\n    inputs=[\n        \"boxes\",\n        \"scores\",\n        \"max_output_boxes_per_class\",\n        \"iou_threshold\",\n        \"score_threshold\",\n    ],\n    outputs=[\"selected_indices\"],\n)\nboxes = np.array(\n    [\n        [\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.1, 1.0, 1.1],\n            [0.0, -0.1, 1.0, 0.9],\n            [0.0, 10.0, 1.0, 11.0],\n            [0.0, 10.1, 1.0, 11.1],\n            [0.0, 100.0, 1.0, 101.0],\n        ]\n    ]\n).astype(np.float32)\nscores = np.array([[[0.9, 0.75, 0.6, 0.95, 0.5, 0.3]]]).astype(np.float32)\nmax_output_boxes_per_class = np.array([2]).astype(np.int64)\niou_threshold = np.array([0.5]).astype(np.float32)\nscore_threshold = np.array([0.0]).astype(np.float32)\nselected_indices = np.array([[0, 0, 3], [0, 0, 0]]).astype(np.int64)\n\nexpect(\n    node,\n    inputs=[\n        boxes,\n        scores,\n        max_output_boxes_per_class,\n        iou_threshold,\n        score_threshold,\n    ],\n    outputs=[selected_indices],\n    name=\"test_nonmaxsuppression_limit_output_size\",\n)"
@@ -39983,7 +39987,7 @@
     "name": "NonMaxSuppression",
     "module": "ai.onnx",
     "version": 11,
-    "description": "Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes.\nBounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box.\nNote that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to\northogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system\nresult in the same boxes being selected by the algorithm.\nThe selected_indices output is a set of integers indexing into the input collection of bounding boxes representing the selected boxes.\nThe bounding box coordinates corresponding to the selected indices can then be obtained using the Gather or GatherND operation.\n",
+    "description": "Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes.\nBounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box.\nBoxes are suppressed if their IOU with a previously selected box is strictly greater than iou_threshold (i.e., boxes with IOU exactly equal to the threshold are kept).\nNote that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to\northogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system\nresult in the same boxes being selected by the algorithm.\nThe selected_indices output is a set of integers indexing into the input collection of bounding boxes representing the selected boxes.\nThe bounding box coordinates corresponding to the selected indices can then be obtained using the Gather or GatherND operation.\n",
     "attributes": [
       {
         "name": "center_point_box",
@@ -40013,7 +40017,7 @@
         "name": "iou_threshold",
         "type": "tensor(float)",
         "option": "optional",
-        "description": "Float representing the threshold for deciding whether boxes overlap too much with respect to IOU. It is scalar. Value range [0, 1]. Default to 0."
+        "description": "Float representing the threshold for deciding whether boxes overlap too much with respect to IOU. Boxes with IoU strictly greater than this threshold are suppressed. It is scalar. Value range [0, 1]. Default to 0."
       },
       {
         "name": "score_threshold",
@@ -40047,6 +40051,10 @@
         "summary": "nonmaxsuppression_identical_boxes",
         "code": "node = onnx.helper.make_node(\n    \"NonMaxSuppression\",\n    inputs=[\n        \"boxes\",\n        \"scores\",\n        \"max_output_boxes_per_class\",\n        \"iou_threshold\",\n        \"score_threshold\",\n    ],\n    outputs=[\"selected_indices\"],\n)\nboxes = np.array(\n    [\n        [\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.0, 1.0, 1.0],\n        ]\n    ]\n).astype(np.float32)\nscores = np.array(\n    [[[0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9]]]\n).astype(np.float32)\nmax_output_boxes_per_class = np.array([3]).astype(np.int64)\niou_threshold = np.array([0.5]).astype(np.float32)\nscore_threshold = np.array([0.0]).astype(np.float32)\nselected_indices = np.array([[0, 0, 0]]).astype(np.int64)\n\nexpect(\n    node,\n    inputs=[\n        boxes,\n        scores,\n        max_output_boxes_per_class,\n        iou_threshold,\n        score_threshold,\n    ],\n    outputs=[selected_indices],\n    name=\"test_nonmaxsuppression_identical_boxes\",\n)"
       },
+      {
+        "summary": "nonmaxsuppression_iou_threshold_boundary",
+        "code": "\"\"\"Test boundary condition where IoU exactly equals threshold.\n\nThis test verifies that the comparison is strict (>), not inclusive (>=).\nWhen IoU exactly equals the threshold, boxes should be KEPT, not suppressed.\nThis follows PyTorch's NMS implementation.\n\"\"\"\nnode = onnx.helper.make_node(\n    \"NonMaxSuppression\",\n    inputs=[\n        \"boxes\",\n        \"scores\",\n        \"max_output_boxes_per_class\",\n        \"iou_threshold\",\n        \"score_threshold\",\n    ],\n    outputs=[\"selected_indices\"],\n)\n# Two boxes with 50% overlap in each dimension\n# box1=[0,0,1,1], box2=[0.5,0.5,1.5,1.5]\n# Intersection area = 0.5 * 0.5 = 0.25\n# Union area = 1.0 + 1.0 - 0.25 = 1.75\n# IoU = 0.25 / 1.75 (exact value computed below as float32)\nboxes = np.array(\n    [\n        [\n            [0.0, 0.0, 1.0, 1.0],  # box 0\n            [0.5, 0.5, 1.5, 1.5],  # box 1 - overlaps box 0\n        ]\n    ]\n).astype(np.float32)\nscores = np.array([[[0.9, 0.8]]]).astype(np.float32)\nmax_output_boxes_per_class = np.array([3]).astype(np.int64)\n# Compute the exact IoU value and use it as threshold\n# This ensures the threshold exactly equals the IoU\nexact_iou = np.float32(0.25 / 1.75)\niou_threshold = np.array([exact_iou]).astype(np.float32)\nscore_threshold = np.array([0.0]).astype(np.float32)\n# Both boxes should be selected because IoU == threshold (not > threshold)\nselected_indices = np.array([[0, 0, 0], [0, 0, 1]]).astype(np.int64)\n\nexpect(\n    node,\n    inputs=[\n        boxes,\n        scores,\n        max_output_boxes_per_class,\n        iou_threshold,\n        score_threshold,\n    ],\n    outputs=[selected_indices],\n    name=\"test_nonmaxsuppression_iou_threshold_boundary\",\n)"
+      },
       {
         "summary": "nonmaxsuppression_limit_output_size",
         "code": "node = onnx.helper.make_node(\n    \"NonMaxSuppression\",\n    inputs=[\n        \"boxes\",\n        \"scores\",\n        \"max_output_boxes_per_class\",\n        \"iou_threshold\",\n        \"score_threshold\",\n    ],\n    outputs=[\"selected_indices\"],\n)\nboxes = np.array(\n    [\n        [\n            [0.0, 0.0, 1.0, 1.0],\n            [0.0, 0.1, 1.0, 1.1],\n            [0.0, -0.1, 1.0, 0.9],\n            [0.0, 10.0, 1.0, 11.0],\n            [0.0, 10.1, 1.0, 11.1],\n            [0.0, 100.0, 1.0, 101.0],\n        ]\n    ]\n).astype(np.float32)\nscores = np.array([[[0.9, 0.75, 0.6, 0.95, 0.5, 0.3]]]).astype(np.float32)\nmax_output_boxes_per_class = np.array([2]).astype(np.int64)\niou_threshold = np.array([0.5]).astype(np.float32)\nscore_threshold = np.array([0.0]).astype(np.float32)\nselected_indices = np.array([[0, 0, 3], [0, 0, 0]]).astype(np.int64)\n\nexpect(\n    node,\n    inputs=[\n        boxes,\n        scores,\n        max_output_boxes_per_class,\n        iou_threshold,\n        score_threshold,\n    ],\n    outputs=[selected_indices],\n    name=\"test_nonmaxsuppression_limit_output_size\",\n)"