Fix incorrect variable names in code example
Browse files
README.md
CHANGED
@@ -45,19 +45,19 @@ model = OneFormerForUniversalSegmentation.from_pretrained("shi-labs/oneformer_ci
|
|
45 |
semantic_inputs = processor(images=image, task_inputs=["semantic"], return_tensors="pt")
|
46 |
semantic_outputs = model(**semantic_inputs)
|
47 |
# pass through image_processor for postprocessing
|
48 |
-
predicted_semantic_map = processor.post_process_semantic_segmentation(
|
49 |
|
50 |
# Instance Segmentation
|
51 |
instance_inputs = processor(images=image, task_inputs=["instance"], return_tensors="pt")
|
52 |
instance_outputs = model(**instance_inputs)
|
53 |
# pass through image_processor for postprocessing
|
54 |
-
predicted_instance_map = processor.post_process_instance_segmentation(
|
55 |
|
56 |
# Panoptic Segmentation
|
57 |
panoptic_inputs = processor(images=image, task_inputs=["panoptic"], return_tensors="pt")
|
58 |
panoptic_outputs = model(**panoptic_inputs)
|
59 |
# pass through image_processor for postprocessing
|
60 |
-
predicted_semantic_map = processor.post_process_panoptic_segmentation(
|
61 |
```
|
62 |
|
63 |
For more examples, please refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/oneformer).
|
|
|
45 |
semantic_inputs = processor(images=image, task_inputs=["semantic"], return_tensors="pt")
|
46 |
semantic_outputs = model(**semantic_inputs)
|
47 |
# pass through image_processor for postprocessing
|
48 |
+
predicted_semantic_map = processor.post_process_semantic_segmentation(semantic_outputs, target_sizes=[image.size[::-1]])[0]
|
49 |
|
50 |
# Instance Segmentation
|
51 |
instance_inputs = processor(images=image, task_inputs=["instance"], return_tensors="pt")
|
52 |
instance_outputs = model(**instance_inputs)
|
53 |
# pass through image_processor for postprocessing
|
54 |
+
predicted_instance_map = processor.post_process_instance_segmentation(instance_outputs, target_sizes=[image.size[::-1]])[0]["segmentation"]
|
55 |
|
56 |
# Panoptic Segmentation
|
57 |
panoptic_inputs = processor(images=image, task_inputs=["panoptic"], return_tensors="pt")
|
58 |
panoptic_outputs = model(**panoptic_inputs)
|
59 |
# pass through image_processor for postprocessing
|
60 |
+
predicted_semantic_map = processor.post_process_panoptic_segmentation(panoptic_outputs, target_sizes=[image.size[::-1]])[0]["segmentation"]
|
61 |
```
|
62 |
|
63 |
For more examples, please refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/oneformer).
|