tfm.vision.spatial_transform_ops.crop_mask_in_target_box

Crop masks in target boxes.

masks A tensor with a shape of [batch_size, num_masks, height, width].
boxes a float tensor representing box cooridnates that tightly enclose masks with a shape of [batch_size, num_masks, 4] in un-normalized coordinates. A box is represented by [ymin, xmin, ymax, xmax].
target_boxes a float tensor representing target box cooridnates for masks with a shape of [batch_size, num_masks, 4] in un-normalized coordinates. A box is represented by [ymin, xmin, ymax, xmax].
output_size A scalar to indicate the output crop size. It currently only supports to output a square shape outputs.
sample_offset a float number in [0, 1] indicates the subpixel sample offset from grid point.
use_einsum Use einsum to replace gather in selective_crop_and_resize.

A 4-D tensor representing feature crop of shape [batch_size, num_boxes, output_size, output_size].