rtdetr-v2-r18vd-print-sheet-qc
Fine-tuned RT-DETRv2 r18vd that inspects a full print sheet from a top-down camera: it detects every order on the sheet and flags common print defects, for a label/sign printing quality-control scenario.
Important note on metrics. The Trainer's logged eval_map for this run is 0.0066 — that number is an evaluation-plumbing artifact (transformers v5 prediction payload handling), not a property of the weights. The metrics below were computed with an independent manual torchmetrics pipeline over 30 validation sheets, bypassing the Trainer entirely.
Verified metrics (manual torchmetrics mAP, 30 validation sheets)
- mAP@[.5:.95] = 0.7815
- mAP@50 = 0.8654
- mAP@75 = 0.8138
- MAR@100 = 0.9344 (MAR@large = 0.9967 — near-perfect recall on large objects)
- mAP small/medium/large = 0.624 / 0.776 / 0.877
Per-class AP@[.5:.95] (class order: order, smear, scratch, misprint, missing_element, misregistration, skewed_item):
| class | AP | MAR@100 |
|---|---|---|
| order | 0.988 | 1.00 |
| smear | 0.936 | 0.96 |
| scratch | 0.757 | 0.88 |
| misprint | 0.662 | 0.91 |
| missing_element | 0.620 | 0.80 |
| misregistration | 0.637 | 0.99 |
| skewed_item | 0.869 | 1.00 |
Known quirk: the model localizes reliably but its raw confidence scores are low (top scores typically 0.05–0.20). For deployment, rank detections by score rather than gating at a high threshold (e.g. keep top-K or gate around 0.05); the ranking quality is what the mAP numbers reflect.
Classes
7 classes: order (a printed label/sign card on the sheet), smear, scratch, misprint (wrong-ink block), missing_element, misregistration (colour-layer offset), skewed_item (card beyond alignment tolerance).
Intended use & limitations
- Prototype trained entirely on synthetic data. The training set is procedurally rendered (johko/print-sheet-qc-synthetic) — realistic in layout (top-down full-sheet view, grid of varied order cards, sensor noise + mild vignette/defocus) but not photometrically identical to any real camera. Expect a domain gap on real images; finetune on a few hundred annotated real sheets before production use.
- Resolution is 1024×768; the real camera framing should be normalized to the same view.
- Bboxes are COCO (x, y, w, h) in absolute pixels of the full sheet.
Usage
from transformers import AutoModelForObjectDetection, AutoImageProcessor
import torch
model = AutoModelForObjectDetection.from_pretrained("johko/rtdetr-v2-r18vd-print-sheet-qc")
processor = AutoImageProcessor.from_pretrained("johko/rtdetr-v2-r18vd-print-sheet-qc")
inputs = processor(images=sheet_image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
results = processor.post_process_object_detection(
outputs, threshold=0.05, target_sizes=inputs["pixel_values"].shape[:2]
)
Training procedure
- Base: PekingU/rtdetr_v2_r18vd, all weights fine-tuned
- Data: 600 train / 100 validation synthetic sheets, 7 classes
- 30 epochs, batch 8, lr 5e-5 (linear schedule), fp16, AdamW fused, seed 42, light albumentations aug (blur/perspective/flip/brightness)
- Hardware: NVIDIA A10G (a10g-small), ~13 minutes
The training loss decreased from 10.14 to 3.95 over 2250 steps. Trainer-logged eval metrics in trainer_state.json are unreliable for this run (see note above); the epoch trajectory of loss was used as the health signal.