tf.keras.layers.MaxNumBoundingBoxes

Ensure the maximum number of bounding boxes.

Inherits From: Layer, Operation

max_number Desired output number of bounding boxes.
padding_value The padding value of the boxes and labels in bounding_boxes. Defaults to -1.

Example:

max_boxes_layer = keras.layers.MaxNumBoundingBoxes(
    max_number=10,
    fill_value=-1
)

images = np.random.randint(0, 255, (1, 224, 224, 3), dtype="uint8")

bounding_boxes = {
    "boxes": np.array([
        [[10, 20, 100, 150], [50, 60, 200, 250], [0, 0, 50, 50]],
    ]),
    "labels": np.array([[1, 2, 3]])
}

result = max_boxes_layer({
    "images": images,
    "bounding_boxes": bounding_boxes
})

input Retrieves the input tensor(s) of a symbolic operation.

Only returns the tensor(s) corresponding to the first time the operation was called.

output Retrieves the output tensor(s) of a layer.

Only returns the tensor(s) corresponding to the first time the operation was called.

Methods

convert_weight

View source

Convert the weight if it is from the a different backend.

from_config

View source

Creates an operation from its config.

This method is the reverse of get_config, capable of instantiating the same operation from the config dictionary.

if "dtype" in config and isinstance(config["dtype"], dict):
    policy = dtype_policies.deserialize(config["dtype"])

Args
config A Python dictionary, typically the output of get_config.

Returns
An operation instance.

get_random_transformation

View source

transform_bounding_boxes

View source

transform_images

View source

transform_labels

View source

transform_segmentation_masks

View source

transform_single_bounding_box

View source

transform_single_image

View source

transform_single_label

View source

transform_single_segmentation_mask

View source