Downloads · 30 days
8
25% of all-time downloads
harness-race/pi-r2
pi-r2 is a object detection model from harness-race. Use it when you need objects located in an image. It is set up for transformers. The card lists the license as apache-2.0.
Fine-tuned DETR (ResNet-50) for detecting layout regions in historical newspaper page scans, trained on biglam/locbeyondwords (2,846 train / 712 validation images, 7 classes).
Downloads · 30 days
8
25% of all-time downloads
All-time downloads
32
Public
Parameters
41.6M
172 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors167 MB · 97%
From the Hugging Face model README
Fine-tuned DETR (ResNet-50) for detecting layout regions in historical newspaper
page scans, trained on biglam/loc_beyond_words
(2,846 train / 712 validation images, 7 classes).
facebook/detr-resnet-50 — Apache-2.0 (open license, free to share).biglam/loc_beyond_words is CC0-1.0 (public domain).Photograph, Illustration, Map, Comics/Cartoon, Editorial Cartoon, Headline, Advertisement
| Metric | Value |
|---|---|
| AP @[IoU .50:.95] | 0.423 |
| AP @IoU .50 | 0.566 |
| AP @IoU .75 | 0.486 |
| AP small | 0.050 |
| AP medium | 0.250 |
| AP large | 0.453 |
| AR max=1 | 0.286 |
| AR max=10 | 0.574 |
| AR max=100 | 0.625 |
| Class | AP |
|---|---|
| Photograph | n/a |
| Illustration | n/a |
| Map | n/a |
| Comics/Cartoon | n/a |
| Editorial Cartoon | n/a |
| Headline | n/a |
| Advertisement | n/a |
Note:
AP_small/AP_medium/AP_largeare computed on the resized evaluation inputs, not original pixel areas; treat small-object numbers cautiously.
from transformers import DetrImageProcessor, DetrForObjectDetection
from PIL import Image
import torch
processor = DetrImageProcessor.from_pretrained("harness-race/pi-r2")
model = DetrForObjectDetection.from_pretrained("harness-race/pi-r2")
image = Image.open("page.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
results = processor.post_process_object_detection(
outputs, threshold=0.5, target_sizes=[(image.height, image.width)])[0]
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
print(model.config.id2label[label.item()], round(score.item(), 3), [round(v, 1) for v in box.tolist()])
model.safetensors, config.json, preprocessor_config.json — fine-tuned model + processorval_metrics.json — full COCO validation metrics (incl. per-class AP)figures/ — sample predictions on the validation settrain_detr.py, requirements.txt — training code for reproducibility