|View source on GitHub|
Crops a random slice from the input image.
tfm.vision.preprocess_ops.random_crop_image_with_boxes_and_labels( img, boxes, labels, min_scale, aspect_ratio_range, min_overlap_params, max_retry )
The function will correspondingly recompute the bounding boxes and filter out outside boxes and their labels.
 End-to-End Object Detection with Transformers https://arxiv.org/abs/2005.12872
The preprocessing steps:
- Sample a minimum IoU overlap.
- For each trial, sample the new image width, height, and top-left corner.
- Compute the IoUs of bounding boxes with the cropped image and retry if the maximum IoU is below the sampled threshold.
- Find boxes whose centers are in the cropped image.
- Compute new bounding boxes in the cropped region and only select those boxes' labels.
||a Tensor representing the random cropped image. Can be the original image if max_retry is exhausted.|
||a Tensor representing the bounding boxes in the cropped image.|
||a Tensor representing the new bounding boxes' labels.|