Fix Fuyu image scaling bug (#26918)
* Fix Fuyu image scaling bug It could produce negative padding and hence inference errors for certain image sizes. * Fix aspect ratio scaling test
This commit is contained in:
@@ -50,9 +50,10 @@ class TestFuyuImageProcessor(unittest.TestCase):
|
||||
), f"Expected {expected_num_patches} patches, got {patches_final.shape[1]}."
|
||||
|
||||
def test_scale_to_target_aspect_ratio(self):
|
||||
# (h:450, w:210) fitting (160, 320) -> (160, 210*160/450)
|
||||
scaled_image = self.processor._scale_to_target_aspect_ratio(self.sample_image)
|
||||
self.assertEqual(scaled_image.shape[0], 74)
|
||||
self.assertEqual(scaled_image.shape[1], 160)
|
||||
self.assertEqual(scaled_image.shape[0], 160)
|
||||
self.assertEqual(scaled_image.shape[1], 74)
|
||||
|
||||
def test_apply_transformation_numpy(self):
|
||||
transformed_image = self.processor.apply_transformation(self.sample_image)
|
||||
|
||||
Reference in New Issue
Block a user