From 30a28f5227d541ae6b0a287ae345dfae687f21da Mon Sep 17 00:00:00 2001 From: amyeroberts <22614925+amyeroberts@users.noreply.github.com> Date: Thu, 15 Sep 2022 12:32:31 +0100 Subject: [PATCH] Update image segmentation pipeline test (#18731) * Updated test values The image segmentation pipeline tests - tests/pipelines/test_pipelines_image_segmentation.py - were failing after the merging of #1849 (49e44b216b2559e34e945d5dcdbbe2238859e29b). This was due to the difference in rescaling. Previously the images were rescaled by `image = image / 255`. In the new commit, a `rescale` method was added, and images rescaled using `image = image * scale`. This was known to cause small differences in the processed images (see [PR comment](https://github.com/huggingface/transformers/pull/18499#discussion_r940347575)). Testing locally, changing the `rescale` method to divide by a scale factor (255) resulted in the tests passing. It was therefore decided the test values could be updated, as there was no logic difference between the commits. * Use double quotes, like previous example * Fix up --- tests/pipelines/test_pipelines_image_segmentation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/pipelines/test_pipelines_image_segmentation.py b/tests/pipelines/test_pipelines_image_segmentation.py index 1884682ec5..611e9d2ed1 100644 --- a/tests/pipelines/test_pipelines_image_segmentation.py +++ b/tests/pipelines/test_pipelines_image_segmentation.py @@ -255,7 +255,7 @@ class ImageSegmentationPipelineTests(unittest.TestCase, metaclass=PipelineTestCa self.assertEqual( nested_simplify(outputs, decimals=4), [ - {"score": 0.9094, "label": "blanket", "mask": "85144e4bf8d624c2c6175f7faf57eb30"}, + {"score": 0.9094, "label": "blanket", "mask": "6500201749480f87154fd967783b2b97"}, {"score": 0.9941, "label": "cat", "mask": "f3a7f80220788acc0245ebc084df6afc"}, {"score": 0.9987, "label": "remote", "mask": "7703408f54da1d0ebda47841da875e48"}, {"score": 0.9995, "label": "remote", "mask": "bd726918f10fed3efaef0091e11f923b"}, @@ -279,7 +279,7 @@ class ImageSegmentationPipelineTests(unittest.TestCase, metaclass=PipelineTestCa nested_simplify(outputs, decimals=4), [ [ - {"score": 0.9094, "label": "blanket", "mask": "85144e4bf8d624c2c6175f7faf57eb30"}, + {"score": 0.9094, "label": "blanket", "mask": "6500201749480f87154fd967783b2b97"}, {"score": 0.9941, "label": "cat", "mask": "f3a7f80220788acc0245ebc084df6afc"}, {"score": 0.9987, "label": "remote", "mask": "7703408f54da1d0ebda47841da875e48"}, {"score": 0.9995, "label": "remote", "mask": "bd726918f10fed3efaef0091e11f923b"}, @@ -287,7 +287,7 @@ class ImageSegmentationPipelineTests(unittest.TestCase, metaclass=PipelineTestCa {"score": 0.9994, "label": "cat", "mask": "fa5d8d5c329546ba5339f3095641ef56"}, ], [ - {"score": 0.9094, "label": "blanket", "mask": "85144e4bf8d624c2c6175f7faf57eb30"}, + {"score": 0.9094, "label": "blanket", "mask": "6500201749480f87154fd967783b2b97"}, {"score": 0.9941, "label": "cat", "mask": "f3a7f80220788acc0245ebc084df6afc"}, {"score": 0.9987, "label": "remote", "mask": "7703408f54da1d0ebda47841da875e48"}, {"score": 0.9995, "label": "remote", "mask": "bd726918f10fed3efaef0091e11f923b"},