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 (49e44b216b). 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
This commit is contained in:
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user