mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 11:11:05 +06:00
changes w.r.t review
This commit is contained in:
parent
03615b2304
commit
fb5a27b1bf
@ -858,6 +858,7 @@ class EomtImageProcessor(BaseImageProcessor):
|
|||||||
):
|
):
|
||||||
"""Post-processes model outputs into final panoptic segmentation prediction."""
|
"""Post-processes model outputs into final panoptic segmentation prediction."""
|
||||||
|
|
||||||
|
# `mask_threshold` and `overlap_mask_area_threshold` args are unused and only present for Pipeline compatability.
|
||||||
size = size if size is not None else self.size
|
size = size if size is not None else self.size
|
||||||
|
|
||||||
masks_queries_logits = outputs.masks_queries_logits # [batch_size, num_queries, height, width]
|
masks_queries_logits = outputs.masks_queries_logits # [batch_size, num_queries, height, width]
|
||||||
|
@ -522,6 +522,7 @@ class EomtImageProcessorFast(BaseImageProcessorFast):
|
|||||||
):
|
):
|
||||||
"""Post-processes model outputs into Instance Segmentation Predictions."""
|
"""Post-processes model outputs into Instance Segmentation Predictions."""
|
||||||
|
|
||||||
|
# `mask_threshold` and `overlap_mask_area_threshold` args are unused and only present for Pipeline compatability.
|
||||||
size = size if size is not None else self.size
|
size = size if size is not None else self.size
|
||||||
|
|
||||||
masks_queries_logits = outputs.masks_queries_logits
|
masks_queries_logits = outputs.masks_queries_logits
|
||||||
|
@ -474,4 +474,9 @@ class EomtForUniversalSegmentationIntegrationTest(unittest.TestCase):
|
|||||||
image = Image.open(requests.get("http://images.cocodataset.org/val2017/000000039769.jpg", stream=True).raw)
|
image = Image.open(requests.get("http://images.cocodataset.org/val2017/000000039769.jpg", stream=True).raw)
|
||||||
|
|
||||||
pipe = pipeline(model=self.model_id, subtask="panoptic", device=torch_device)
|
pipe = pipeline(model=self.model_id, subtask="panoptic", device=torch_device)
|
||||||
_ = pipe(image)
|
output = pipe(image)
|
||||||
|
|
||||||
|
EXPECTED_OUTPUT_LABELS = ["LABEL_15", "LABEL_15", "LABEL_57", "LABEL_65", "LABEL_65"]
|
||||||
|
|
||||||
|
output_labels = [segment["label"] for segment in output["segments_info"]]
|
||||||
|
self.assertEqual(output_labels, EXPECTED_OUTPUT_LABELS)
|
||||||
|
Loading…
Reference in New Issue
Block a user