tfm.vision.augment.SSDRandomCrop
Stay organized with collections
Save and categorize content based on your preferences.
Random crop preprocessing as in the SSD paper.
Inherits From: ImageAugment
tfm.vision.augment.SSDRandomCrop(
params: (Sequence[configs.SSDRandomCropParam] | None) = None,
aspect_ratio_range: tuple[float, float] = (0.5, 2.0),
area_range: tuple[float, float] = (0.1, 1.0)
)
Liu et al., SSD: Single shot multibox detector
https://arxiv.org/abs/1512.02325
The implementation originated from TF Object Detection API:
https://github.com/tensorflow/models/blob/f36581036d3346a9496de06c8fd678d23cfe2103/research/object_detection/core/preprocessor.py#L3529
Args |
params
|
a sequence of SSDRandomCropParam that contains:
min_object_covered - a float representing minimum the cropped image
must cover at least this fraction with at least one of the input
bounding boxes.
min_box_overlap - a float representing minimum overlap of the bounding
box with the cropped image to keep the box.
prob_to_apply - a float representing the probability to crop.
|
aspect_ratio_range
|
allowed range for aspect ratio of the cropped image.
|
area_range
|
allowed range for area ratio between cropped image and the
original image.
|
Methods
distort
View source
distort(
image: tf.Tensor
) -> tf.Tensor
Given an image tensor, returns a distorted image with the same shape.
Expect the image tensor values are in the range [0, 255].
| Args |
image
|
Tensor of shape [height, width, 3] or
[num_frames, height, width, 3] representing an image or image sequence.
|
| Returns |
The augmented version of image.
|
distort_with_boxes
View source
distort_with_boxes(
image: tf.Tensor, bboxes: tf.Tensor
) -> tuple[tf.Tensor, tf.Tensor]
See base class.
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-11-06 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-11-06 UTC."],[],[]]