tfm.vision.mask_ops.instance_masks_overlap
Stay organized with collections
Save and categorize content based on your preferences.
Calculates the IoUs and IoAs between the detection masks and the ground truth masks.
tfm.vision.mask_ops.instance_masks_overlap(
boxes: tf.Tensor,
masks: tf.Tensor,
gt_boxes: tf.Tensor,
gt_masks: tf.Tensor,
output_size: List[int],
mask_binarize_threshold: float = 0.5
) -> Tuple[tf.Tensor, tf.Tensor]
IoU: intersection over union.
IoA: intersection over the area of the detection masks.
Args |
boxes
|
a tensor with a shape of [batch_size, N, 4]. The last dimension is
the pixel coordinates in [ymin, xmin, ymax, xmax] form.
|
masks
|
a float tensor with a shape of [batch_size, N, mask_height,
mask_width] representing the instance masks w.r.t. the boxes .
|
gt_boxes
|
a tensor with a shape of [batch_size, M, 4]. The last dimension is
the pixel coordinates in [ymin, xmin, ymax, xmax] form.
|
gt_masks
|
a float tensor with a shape of [batch_size, M, gt_mask_height,
gt_mask_width] representing the instance masks w.r.t. the gt_boxes .
|
output_size
|
two integers that represent the height and width of the output
masks.
|
mask_binarize_threshold
|
a float representing the threshold for binarizing
mask values. Default value is 0.5.
|
Returns |
iou
|
a tensor with as a shape of [batch_size, N, M].
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-02-02 UTC.
[null,null,["Last updated 2024-02-02 UTC."],[],[],null,["# tfm.vision.mask_ops.instance_masks_overlap\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/mask_ops.py#L193-L269) |\n\nCalculates the IoUs and IoAs between the detection masks and the ground truth masks. \n\n tfm.vision.mask_ops.instance_masks_overlap(\n boxes: tf.Tensor,\n masks: tf.Tensor,\n gt_boxes: tf.Tensor,\n gt_masks: tf.Tensor,\n output_size: List[int],\n mask_binarize_threshold: float = 0.5\n ) -\u003e Tuple[tf.Tensor, tf.Tensor]\n\nIoU: intersection over union.\nIoA: intersection over the area of the detection masks.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `boxes` | a tensor with a shape of \\[batch_size, N, 4\\]. The last dimension is the pixel coordinates in \\[ymin, xmin, ymax, xmax\\] form. |\n| `masks` | a float tensor with a shape of \\[batch_size, N, mask_height, mask_width\\] representing the instance masks w.r.t. the `boxes`. |\n| `gt_boxes` | a tensor with a shape of \\[batch_size, M, 4\\]. The last dimension is the pixel coordinates in \\[ymin, xmin, ymax, xmax\\] form. |\n| `gt_masks` | a float tensor with a shape of \\[batch_size, M, gt_mask_height, gt_mask_width\\] representing the instance masks w.r.t. the `gt_boxes`. |\n| `output_size` | two integers that represent the height and width of the output masks. |\n| `mask_binarize_threshold` | a float representing the threshold for binarizing mask values. Default value is 0.5. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-------|---------------------------------------------------|\n| `iou` | a tensor with as a shape of \\[batch_size, N, M\\]. |\n\n\u003cbr /\u003e"]]