Views
No views yet
Key Insight: Given sufficient scale and pretraining, a plain ViT along with additional few params can perform segmentation without the need for task-specific decoders or pixel fusion modules. The same model backbone supports semantic, instance, and panoptic segmentation with different post-processing 🤗
1import matplotlib.pyplot as plt
2import requests
3import torch
4from PIL import Image
5
6from transformers import EomtForUniversalSegmentation, AutoImageProcessor
7
8
9model_id = "tue-mps/ade20k_panoptic_eomt_large_1280"
10processor = AutoImageProcessor.from_pretrained(model_id)
11model = EomtForUniversalSegmentation.from_pretrained(model_id)
12
13image = Image.open(requests.get("http://images.cocodataset.org/val2017/000000039769.jpg", stream=True).raw)
14
15inputs = processor(
16 images=image,
17 return_tensors="pt",
18)
19
20with torch.inference_mode():
21 outputs = model(**inputs)
22
23# Prepare the original image size in the format (height, width)
24target_sizes = [(image.height, image.width)]
25
26# Post-process the model outputs to get final segmentation prediction
27preds = processor.post_process_panoptic_segmentation(
28 outputs,
29 target_sizes=target_sizes,
30)
31
32# Visualize the panoptic segmentation mask
33plt.imshow(preds[0]["segmentation"])
34plt.axis("off")
35plt.title("Panoptic Segmentation")
36plt.show()1@inproceedings{kerssies2025eomt,
2 author = {Kerssies, Tommie and Cavagnero, Niccolò and Hermans, Alexander and Norouzi, Narges and Averta, Giuseppe and Leibe, Bastian and Dubbelman, Gijs and de Geus, Daan},
3 title = {Your ViT is Secretly an Image Segmentation Model},
4 booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
5 year = {2025},
6}