tf.keras.utils.bounding_boxes.decode_deltas_to_boxes
Stay organized with collections
Save and categorize content based on your preferences.
Converts bounding boxes from delta format to the specified box_format.
tf.keras.utils.bounding_boxes.decode_deltas_to_boxes(
anchors,
boxes_delta,
anchor_format,
box_format,
encoded_format='center_yxhw',
variance=None,
image_shape=None
)
This function decodes bounding box deltas relative to anchors to obtain the
final bounding box coordinates. The boxes are encoded in a specific
encoded_format (center_yxhw by default) during the decoding process.
This allows flexibility in how the deltas are applied to the anchors.
Args |
anchors
|
Can be Tensors or Dict[Tensors] where keys are level
indices and values are corresponding anchor boxes.
The shape of the array/tensor should be (N, 4) where N is the
number of anchors.
boxes_delta Can be Tensors or Dict[Tensors] Bounding box deltas
must have the same type and structure as anchors. The
shape of the array/tensor can be (N, 4) or (B, N, 4) where N is
the number of boxes.
|
anchor_format
|
str. The format of the input anchors.
(e.g., "xyxy", "xywh", etc.)
|
box_format
|
str. The desired format for the output boxes.
(e.g., "xyxy", "xywh", etc.)
|
encoded_format
|
str. Raw output format from regression head. Defaults
to "center_yxhw".
|
variance
|
List[floats]. A 4-element array/tensor representing
variance factors to scale the box deltas. If provided, the deltas
are multiplied by the variance before being applied to the anchors.
Defaults to None.
|
image_shape
|
Tuple[int]. The shape of the image (height, width, 3).
When using relative bounding box format for box_format the
image_shape is used for normalization.
|
Returns |
Decoded box coordinates. The return type matches the box_format.
|
Raises |
ValueError
|
If variance is not None and its length is not 4.
|
ValueError
|
If encoded_format is not "center_xywh" or
"center_yxhw".
|
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 2026-10-31 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 2026-10-31 UTC."],[],[]]