tfm.vision.box_ops.bbox2mask Stay organized with collections Save and categorize content based on your preferences.
Converts bounding boxes to bitmasks.
tfm.vision.box_ops.bbox2mask( bbox: tf.Tensor, *, image_height: int, image_width: int, dtype: tf.DType = tf.bool ) -> tf.Tensor
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. |
Returns |
A tensor in shape (..., height, width) which stores the bitmasks created from the bounding boxes. For example: 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)> |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-02-02 UTC."],[],[]]