Views
No views yet
1from transformers import AutoImageProcessor, RfDetrForInstanceSegmentation
2import torch
3from PIL import Image
4import requests
5
6url = "http://images.cocodataset.org/val2017/000000039769.jpg"
7image = Image.open(requests.get(url, stream=True).raw)
8
9processor = AutoImageProcessor.from_pretrained("stevenbucaille/rf-detr-seg-small")
10model = RfDetrForInstanceSegmentation.from_pretrained("stevenbucaille/rf-detr-seg-small")
11
12inputs = processor(images=image, return_tensors="pt")
13outputs = model(**inputs)
14
15target_sizes = [image.size[::-1]]
16results = processor.post_process_instance_segmentation(
17 outputs, target_sizes=target_sizes, threshold=0.5
18)
19for item in results:
20 for k, v in item.items():
21 if hasattr(v, "shape"):
22 print(k, tuple(v.shape))
23 else:
24 print(k, v)segmentation (480, 640)
segments_info [{'id': 1, 'label_id': 17, 'was_fused': False, 'score': 0.983507}, {'id': 2, 'label_id': 75, 'was_fused': False, 'score': 0.985495}, {'id': 3, 'label_id': 75, 'was_fused': False, 'score': 0.969946}, {'id': 4, 'label_id': 17, 'was_fused': False, 'score': 0.975114}]config.id2label.1@misc{robinson2026rfdetrneuralarchitecturesearch,
2 title={RF-DETR: Neural Architecture Search for Real-Time Detection Transformers},
3 author={Isaac Robinson and Peter Robicheaux and Matvei Popov and Deva Ramanan and Neehar Peri},
4 year={2026},
5 eprint={2511.09554},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://huggingface.co/papers/2511.09554},
9}