Commit 46cea4f6 authored by syiming's avatar syiming
Browse files

add todo: consider more efficient approach to compute multilevel cropped features

parent 3efe2425
...@@ -419,12 +419,13 @@ def multilevel_native_crop_and_resize(images, boxes, box_levels, ...@@ -419,12 +419,13 @@ def multilevel_native_crop_and_resize(images, boxes, box_levels,
Same as `multilevel_matmul_crop_and_resize` but uses tf.image.crop_and_resize. Same as `multilevel_matmul_crop_and_resize` but uses tf.image.crop_and_resize.
""" """
if box_levels is None: if box_levels is None:
return native_crop_and_resize(images[0], boxes, crop_size, scope=None) return native_crop_and_resize(images[0], boxes, crop_size, scope)
cropped_feature_list = [] cropped_feature_list = []
for level, image in enumerate(images): for level, image in enumerate(images):
# For each level, crop the feature according to all boxes # For each level, crop the feature according to all boxes
# set the cropped feature not at this level to 0 tensor. # set the cropped feature not at this level to 0 tensor.
cropped = native_crop_and_resize(image, boxes, crop_size) # TODO: consider more efficient way of computing cropped features.
cropped = native_crop_and_resize(image, boxes, crop_size, scope)
cond = tf.tile(tf.equal(box_levels, level)[:, :, tf.newaxis], cond = tf.tile(tf.equal(box_levels, level)[:, :, tf.newaxis],
[1, 1] + [tf.math.reduce_prod(cropped.shape.as_list()[2:])]) [1, 1] + [tf.math.reduce_prod(cropped.shape.as_list()[2:])])
cond = tf.reshape(cond, cropped.shape) cond = tf.reshape(cond, cropped.shape)
......
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