def test_resize_output(self): model = DummyModel() kwargs = {'model_image_shape': (128, 128, 1)} app = Application(model, **kwargs) x = np.random.rand(1, 128, 128, 1) # x.shape = original_shape --> no resize y = app._resize_output(x, x.shape) self.assertEqual(x.shape, y.shape) # x.shape != original_shape --> resize original_shape = (1, 500, 500, 1) y = app._resize_output(x, original_shape) self.assertEqual(original_shape, y.shape) # test multiple outputs are also resized x_list = [x, x] # x.shape = original_shape --> no resize y = app._resize_output(x_list, x.shape) self.assertIsInstance(y, list) for y_sub in y: self.assertEqual(x.shape, y_sub.shape) # x.shape != original_shape --> resize original_shape = (1, 500, 500, 1) y = app._resize_output(x_list, original_shape) self.assertIsInstance(y, list) for y_sub in y: self.assertEqual(original_shape, y_sub.shape)
def test_resize_output(self): model = DummyModel() kwargs = {'model_image_shape': (128, 128, 1)} app = Application(model, **kwargs) x = np.random.rand(1, 128, 128, 1) # x.shape = original_shape --> no resize y = app._resize_output(x, x.shape) self.assertEqual(x.shape, y.shape) # x.shape != original_shape --> resize original_shape = (1, 500, 500, 1) y = app._resize_output(x, original_shape) self.assertEqual(original_shape, y.shape)