BoundingBoxIoU

Computer Intersection over Union for 2 bounding boxes. For more information, check this article.

Parameters

  • box_1: Reference to a BoundingBox within the transaction

  • [optional] box_2: Reference to a BoundingBox within the transaction

  • [optional] rectangle

Details

Either box_2 or rectangle can be specified.

Examples

Find a BoundingBox with “id” property equal to 2342 and a BoundingBox with “id” property equal to 4321, and compute the Intersection Over Union (IoU) of the two bounding boxes:

[ {
    "FindBoundingBox": {
        "_ref": 1,
        "constraints" : {
            "id" : ["==", 2342},
        }
    }
}, {
    "FindBoundingBox": {
        "_ref": 2,
        "constraints" : {
            "id" : ["==", 4321},
        }
    }
}, {
    "BoundingBoxIoU": {
        "box_1": 1,
        "box_2": 2,
    }
}]

# Response:

[ {
    "FindBoundingBox": {
        "status": 0,
    }
}, {
    "FindBoundingBox": {
        "status": 0,
    }
}, {
    "BoundingBoxIoU": {
        "status": 0,
        "IoU": 0.875873,
    }
}]

Find a BoundingBox with “id” property equal to 2342 and compute the Intersection Over Union (IoU) with a specified rectangle:

[ {
    "FindBoundingBox": {
        "_ref": 1,
        "constraints" : {
            "id" : ["==", 2342},
        }
    }
}, {
    "BoundingBoxIoU": {
        "box_1": 1,
        "rectangle": {
            "x":       23,
            "y":       56,
            "width":  200,
            "height": 200
        }
    }
}]

# Response:

[ {
    "FindBoundingBox": {
        "status": 0,
    }
}, {
    "BoundingBoxIoU": {
        "status": 0,
        "IoU": 0.985432,
    }
}]