def testRandomResizeImageBboxes(self):
"""Tests the integrity of the return values of random_resize
This tests the case when bboxes is not None.
"""
im_shape = (600, 800, 3)
config = self._random_resize_config
total_boxes = 5
label = 3
image, bboxes = self._get_image_with_boxes(im_shape, total_boxes)
# Add a label to each bbox.
bboxes_w_label = tf.concat(
[
bboxes,
tf.fill((bboxes.shape[0], 1), label)
],
axis=1
)
ret_image, ret_bboxes = self._random_resize(
image, config, bboxes_w_label
)
# Assertions
self.assertEqual(ret_bboxes.shape[0], total_boxes)
self.assertTrue(np.all(
np.asarray(ret_image.shape[:2]) >= config.min_size
))
self.assertTrue(np.all(
np.asarray(ret_image.shape[:2]) <= config.max_size
))
评论列表
文章目录