Views
No views yet
(x, y, w, h)—that are updated layer by layer to guide cross-attention and speed convergence. This formulation offers explicit positional priors for improved feature matching and demonstrated strong performance.1from transformers import AutoModelForObjectDetection, AutoImageProcessor
2from PIL import Image
3import torch
4
5model_name = "vector-institute/pmc-18m-dab-detr"
6processor = AutoImageProcessor.from_pretrained(model_name)
7model = AutoModelForObjectDetection.from_pretrained(model_name)
8
9image = Image.open("compound_figure.png").convert("RGB")
10inputs = processor(images=image, return_tensors="pt")
11
12with torch.no_grad():
13 outputs = model(**inputs)
14
15# Post-process detections—adjust thresholding and formatting as needed
16results = processor.post_process_object_detection(outputs, target_sizes=torch.tensor([image.size[::-1]]), threshold=0.5)
17
18for res in results:
19 for score, label, box in zip(res["scores"], res["labels"], res["boxes"]):
20 print(f"Label {label}: {score:.2f}, Box: {box.tolist()}")1@article{baghbanzadeh2025openpmc18m,
2 title = {Open-PMC-18M: A High-Fidelity Large Scale Medical Dataset for Multimodal Representation Learning},
3 author = {Baghbanzadeh, Negin and Ashkezari, Sajad and Dolatabadi, Elham and Afkanpour, Arash},
4 journal = {arXiv preprint arXiv:2506.02738},
5 year = {2025}
6}