Commit Graph

16 Commits

Author SHA1 Message Date
Nicolas Patry
63d13d768b
Improving image-segmentation pipeline tests. (#19710)
This PR (https://github.com/huggingface/transformers/pull/19367) introduced a few breaking changes:

- Removed an argument `mask_threshold`.
- Broke the default behavior (instance vs panoptic in the function call)
  https://github.com/huggingface/transformers/pull/19367/files#diff-60f846b86fb6a21d4caf60f5b3d593a04accb8f248de3029cccae2ff898c5bc3R119-R120
- Broke the actual masks: https://github.com/huggingface/transformers/pull/1961

This PR is the start of a handful that will aim at bringing back the old
behavior(s).

- tests should not have to specify `task` by default, unless we want to
  modify the behavior and have a lower form of segmentation running)
- `test_small_model_pt` should be working.

This specific PR starts with adding more information to the masks hash
because missing the actual mask was actual easy to miss (the hashes do
change, but it was easy to miss that one code path wasn't properly
updated).

So we go from a simple `hash` to
```
{"hash": #smaller hash, "shape": (h, w), "white_pixels": n}
```

The `shape` should help make sure the interpolation of the mask works
correctly, the `white_pixels` hopefully helps detect big regressions in
their amount when the hash gets modified.
2022-10-18 16:33:53 +02:00
amyeroberts
83a2e694f1
Cast masks to np.unit8 before converting to PIL.Image.Image (#19616)
* Cast masks to np.unit8 before converting to PIL.Image.Image

* Update tests

* Fixup
2022-10-14 09:30:45 -04:00
Sylvain Gugger
9ac586b3c8
Rework pipeline tests (#19366)
* Rework pipeline tests

* Try to fix Flax tests

* Try to put it before

* Use a new decorator instead

* Remove ignore marker since it doesn't work

* Filter pipeline tests

* Woopsie

* Use the fitlered list

* Clean up and fake modif

* Remove init

* Revert fake modif
2022-10-07 18:01:58 -04:00
Alara Dirik
983451a13e
Improve and fix ImageSegmentationPipeline (#19367)
- Fixes the image segmentation pipeline test failures caused by changes to the postprocessing methods of supported models
- Updates the ImageSegmentationPipeline tests
- Improves docs, adds 'task' argument to optionally perform semantic, instance or panoptic segmentation
2022-10-07 23:34:41 +03:00
Sylvain Gugger
c875a96eb1
Test failing test while we resolve the issue. (#19355) 2022-10-05 12:23:48 -04:00
Sylvain Gugger
f16bbf1475
Skip pipeline tests (#19248) 2022-09-29 12:25:15 -04:00
amyeroberts
30a28f5227
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
2022-09-15 07:32:31 -04:00
Sylvain Gugger
6c8017a5c8
Fix image segmentation and object detection pipeline tests (#18100) 2022-07-11 12:41:56 -04:00
Sylvain Gugger
b0520f594c Skip failing tests 2022-07-11 10:16:54 -04:00
Mishig Davaadorj
77b76672e2
Fix img seg tests (load checkpoints from hf-internal-testing) (#17939)
* Revert "Skip failing test until they are fixed."

This reverts commit 8f400775fc.

* Use `tiny-detr` checkpts from `hf-internal-testing`
2022-06-29 10:19:37 -04:00
Sylvain Gugger
8f400775fc Skip failing test until they are fixed. 2022-06-29 09:11:29 -04:00
Nicolas Patry
f4e4ad34cc
Add ForInstanceSegmentation models to image-segmentation pipelines (#15937)
* Adding ForInstanceSegmentation to pipelines.

* Last fix `category_id` renamed to `label_id`.

* Can't be none no more.

* No `is_thing_map` anymore.
2022-03-09 10:19:05 +01:00
Nicolas Patry
7ade7c1794
Updating the slow tests: (#15893)
Linked to https://github.com/huggingface/transformers/pull/15826
2022-03-04 12:32:19 +01:00
Nicolas Patry
3822e4a563
Enabling MaskFormer in pipelines (#15917)
* Enabling MaskFormer in ppipelines

No AutoModel though :(

* Ooops local file.
2022-03-03 16:31:41 +01:00
Sylvain Gugger
074645e32a
Fix semantic segmentation pipeline test (#15826) 2022-02-25 09:21:29 +01:00
Lysandre Debut
29c10a41d0
[Test refactor 1/5] Per-folder tests reorganization (#15725)
* Per-folder tests reorganization

Co-authored-by: sgugger <sylvain.gugger@gmail.com>
Co-authored-by: Stas Bekman <stas@stason.org>
2022-02-23 15:46:28 -05:00