[object Object]

[object Object][object Object]undefined
[object Object]
  • Operator description: Calculates the intersection over union (IOU) or intersection over foreground (IOF) of two sets of input bounding boxes to evaluate the overlap between the predicted bounding box (bBox) and the ground truth bounding box (gtBox).
  • Formula:IOU=Area3Area1+Area2Area3IOF=Area3Area2IOU = \frac {Area_3} {Area_1 + Area_2 - Area_3} \\ IOF = \frac {Area_3} {Area_2} Area_1 indicates the area of the bBox, Area_2 indicates the area of the gtBox, and Area_3 indicates the area of the overlapping part. For the definitions of x and y, see the parameter description.Area1=(X1X0)(Y1Y0)Area2=(X3X2)(Y3Y2)Area3=max(min(X1,X3)max(X0,X2),0)max(min(Y1,Y3)max(Y0,Y2),0)Area_1 = (X_1 - X_0)(Y_1 - Y_0) \\ Area_2 = (X_3 - X_2)(Y_3 - Y_2) \\ Area_3 = max( min(X_1, X_3) - max(X_0, X_2), 0 ) * max( min(Y_1, Y_3) - max(Y_0, Y_2), 0 )
[object Object]

Each operator has calls. First, aclnnIouGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnIou is called to perform computation.

  • [object Object]

  • [object Object]

[object Object]
  • Parameters:

    • bBoxes (aclTensor*, compute input): predicted bounding boxes. shape is a 2D tensor of (m, 4). m indicates the number of bounding boxes. 4 indicates [x0, y0, x1, y1]. (x0, y0) and (x1, y1) indicate the upper left corner and lower right corner of the bounding box, respectively. x1 > x0 and y1 > y0. are supported. The can be ND.
      • [object Object]Atlas inference products[object Object]: FLOAT and FLOAT16
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: FLOAT, FLOAT16, and BFLOAT16
    • gtBoxes (aclTensor*, compute input): ground truth bounding boxes. shape is a 2D tensor of (n, 4). n indicates the number of bounding boxes. 4 indicates [x2, y2, x3, y3]. (x2, y2) and (x3, y3) indicate the upper left corner and lower right corner of the bounding box, respectively. x3 > x2 and y3 > y2. are supported. The supports ND. The data type must be the same as that of bBoxes.
      • [object Object]Atlas inference products[object Object]: FLOAT and FLOAT16
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: FLOAT, FLOAT16, and BFLOAT16
    • mode (char*, compute input): compute mode, either iou or iof. The value is a string on the host. The data type is string.
      • iou: calculates the intersection over union (IoU).
      • iof: calculates the intersection over foreground (IoF).
    • eps (float, compute input): epsilon that is added to the length and width of the area to prevent division by zero. The value is a floating-point number on the host. The data type is FLOAT.
    • aligned (bool, compute input): whether the shapes of the two inputs are the same. The value is a Boolean value on the host. The data type is BOOL.
      • True: The shapes of bBoxes and gtBoxes are the same, both (m, 4). The output shape is (m, 1).
      • False: The shapes of bBoxes and gtBoxes are different, (m, 4) and (n, 4), respectively. The output shape is (m, n).
    • overlap (aclTensor*, compute output): IoU/IoF calculated based on two inputs. The shape is a 2D tensor of (m, n) or (m, 1). are supported. The supports ND. The data type must be the same as that of bBoxes.
      • [object Object]Atlas inference products[object Object]: FLOAT and FLOAT16
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: FLOAT, FLOAT16, and BFLOAT16
    • workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
    • executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void*, input): address of the workspace to be allocated on the device.
    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnIouGetWorkspaceSize.
    • executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • Deterministic computing:
    • aclnnIou defaults to a deterministic implementation.
[object Object]

The following example is for reference only. For details, see .

[object Object]