Commit c2902cfb authored by Pengchong Jin's avatar Pengchong Jin Committed by A. Unique TensorFlower
Browse files

Add the sample offset option in mask interpolation.

PiperOrigin-RevId: 280031944
parent a76237da
......@@ -351,7 +351,11 @@ def single_level_feature_crop(features, level_boxes, detection_prior_levels,
return crop_features
def crop_mask_in_target_box(masks, boxes, target_boxes, output_size):
def crop_mask_in_target_box(masks,
boxes,
target_boxes,
output_size,
sample_offset=0):
"""Crop masks in target boxes.
Args:
......@@ -364,6 +368,8 @@ def crop_mask_in_target_box(masks, boxes, target_boxes, output_size):
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.
Returns:
A 4-D tensor representing feature crop of shape
......@@ -411,7 +417,7 @@ def crop_mask_in_target_box(masks, boxes, target_boxes, output_size):
levels,
boundaries,
output_size,
sample_offset=0)
sample_offset=sample_offset)
cropped_masks = tf.squeeze(cropped_masks, axis=-1)
return cropped_masks
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment