Instructions to use facebook/mask2former-swin-tiny-ade-semantic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/mask2former-swin-tiny-ade-semantic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="facebook/mask2former-swin-tiny-ade-semantic")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("facebook/mask2former-swin-tiny-ade-semantic", dtype="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -60,9 +60,8 @@ class_queries_logits = outputs.class_queries_logits
|
|
| 60 |
masks_queries_logits = outputs.masks_queries_logits
|
| 61 |
|
| 62 |
# you can pass them to processor for postprocessing
|
| 63 |
-
|
| 64 |
# we refer to the demo notebooks for visualization (see "Resources" section in the Mask2Former docs)
|
| 65 |
-
predicted_semantic_map = result["segmentation"]
|
| 66 |
```
|
| 67 |
|
| 68 |
For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/mask2former).
|
|
|
|
| 60 |
masks_queries_logits = outputs.masks_queries_logits
|
| 61 |
|
| 62 |
# you can pass them to processor for postprocessing
|
| 63 |
+
predicted_semantic_map = processor.post_process_semantic_segmentation(outputs, target_sizes=[image.size[::-1]])[0]
|
| 64 |
# we refer to the demo notebooks for visualization (see "Resources" section in the Mask2Former docs)
|
|
|
|
| 65 |
```
|
| 66 |
|
| 67 |
For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/mask2former).
|