<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/box_ops.py#L867-L927) |

Converts bounding boxes to bitmasks.

#### View aliases


**Main aliases**

[`tfm.vision.spatial_transform_ops.bbox2mask`](https://www.tensorflow.org/api_docs/python/tfm/vision/box_ops/bbox2mask)

<br />

    tfm.vision.box_ops.bbox2mask(
        bbox: tf.Tensor,
        *,
        image_height: int,
        image_width: int,
        dtype: tf.DType = tf.bool
    ) -> tf.Tensor

<br />

<br />

<br />

| ## Args ||
|---|---|
| `bbox` | A tensor in shape (..., 4) with arbitrary numbers of batch dimensions, representing the absolute coordinates (ymin, xmin, ymax, xmax) for each bounding box. |
| `image_height` | an integer representing the height of the image. |
| `image_width` | an integer representing the width of the image. |
| `dtype` | DType of the output bitmasks. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor in shape (..., height, width) which stores the bitmasks created from the bounding boxes. For example: <br /> bbox2mask(tf.constant([[1,2,4,4]]), image_height=5, image_width=5, dtype=tf.int32) <tf.Tensor: shape=(1, 5, 5), dtype=int32, numpy= array([[[0, 0, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 0]]], dtype=int32)> <br /> ||

<br />