def testResizeImageWithNoInstanceMask(self):
    """Tests image resizing, checking output sizes."""
    in_image_shape_list = [[60, 40, 3], [15, 30, 3]]
    in_masks_shape_list = [[0, 60, 40], [0, 15, 30]]
    height = 50
    width = 100
    expected_image_shape_list = [[50, 100, 3], [50, 100, 3]]
    expected_masks_shape_list = [[0, 50, 100], [0, 50, 100]]
    def graph_fn(in_image_shape, in_masks_shape):
      in_image = tf.random_uniform(in_image_shape)
      in_masks = tf.random_uniform(in_masks_shape)
      out_image, out_masks, _ = preprocessor.resize_image(
          in_image, in_masks, new_height=height, new_width=width)
      out_image_shape = tf.shape(out_image)
      out_masks_shape = tf.shape(out_masks)
      return out_image_shape, out_masks_shape
    for (in_image_shape, expected_image_shape, in_masks_shape,
         expected_mask_shape) in zip(in_image_shape_list,
                                     expected_image_shape_list,
                                     in_masks_shape_list,
                                     expected_masks_shape_list):
      (out_image_shape,
       out_masks_shape) = self.execute_cpu(graph_fn, [
           np.array(in_image_shape, np.int32),
           np.array(in_masks_shape, np.int32)
       ])
      self.assertAllEqual(out_image_shape, expected_image_shape)
      self.assertAllEqual(out_masks_shape, expected_mask_shape)
Tests image resizing, checking output sizes.
inference_api/src/main/object_detection/core/preprocessor_test.py