A YOLO26n model trained to detect index cards in digitized archival document scans.
Model Description
This model detects index cards in scanned archival documents, returning bounding box coordinates for each detected card. It was trained specifically on historical library index cards from the National Library of Scotland's Advocates Library collection.
Single class:
index_card
Performance
Metric
Value
mAP@50
99.3%
mAP@50-95
99.1%
Precision
99.9%
Recall
98.9%
Trained on 905 images over 85 epochs.
How It Was Made
This model was built through an iterative loop using
Claude Code
to build tooling and
UV scripts
on HF Jobs for inference.
The Iterative Process
Version
Images
mAP@50-95
What happened
v1
100
94.4%
SAM3 bootstrap → manual correction → train
v2
297
95.5%
Run v1 on new images → correct outputs → retrain
v3
905
99.2%
Run v2 on more images → correct → retrain
Step by Step
Zero-shot bootstrap with SAM3
: Ran
SAM3
via a UV script on HF Jobs to get initial bounding box predictions on ~100 archival images. Result: only 31% true positive rate (many false positives on backs of cards).
Claude Code built annotation tooling
: Asked Claude Code to build an HTML bounding box editor for correcting the SAM3 outputs. It created a simple tool to visualize images, adjust boxes, and export corrected annotations.
Manual correction
: Used the bbox editor to correct annotations - removing false positives from versos (card backs) and adjusting box coordinates.
Train v1
: Fine-tuned YOLO26n on the corrected 100 images → 94.4% mAP@50-95.
Expand with model predictions
: Claude Code built scripts to run the trained model on new images from HF Hub, outputting predictions in the same format as SAM3 for the bbox editor.
Correct and retrain
: Loaded model predictions into the editor, corrected errors, merged with existing annotations, retrained → v2 (95.5%) → v3 (99.2%).
The Pattern
AI bootstraps → Claude builds tooling → human corrects → model improves → repeat
This workflow is useful when you have domain-specific detection needs but no labeled training data. The key insight: use AI (SAM3/previous model) to generate candidate annotations, then spend human time
correcting
rather than
creating from scratch
.
Usage
from ultralytics import YOLO
# Load the model
model = YOLO("davanstrien/archival-index-card-detector")
# Run inference
results = model.predict("scan.jpg")
# Get bounding boxesfor result in results:
boxes = result.boxes
for box in boxes:
x1, y1, x2, y2 = box.xyxy[0].tolist()
confidence = box.conf[0].item()
print(f"Index card detected at ({x1:.0f}, {y1:.0f}, {x2:.0f}, {y2:.0f}) with confidence {confidence:.2f}")
Cropping detected cards
from ultralytics import YOLO
from PIL import Image
model = YOLO("davanstrien/archival-index-card-detector")
image = Image.open("scan.jpg")
results = model.predict(image)
for i, box inenumerate(results[0].boxes):
x1, y1, x2, y2 = box.xyxy[0].tolist()
# Add padding (10%)
w, h = x2 - x1, y2 - y1
pad = 0.1
x1 = max(0, x1 - w * pad)
y1 = max(0, y1 - h * pad)
x2 = min(image.width, x2 + w * pad)
y2 = min(image.height, y2 + h * pad)
cropped = image.crop((x1, y1, x2, y2))
cropped.save(f"card_{i}.jpg")
Limitations
Specific card style
: Trained on NLS Advocates Library index cards (typed, early-mid 20th century). May need fine-tuning for different card formats, handwritten cards, or cards from other collections
Scan quality
: Best results on high-quality scans; may struggle with very low resolution or heavily degraded images
Single class
: Only detects "index card" - does not distinguish between different card types or sections within cards
Training Details
Base model
: YOLO26n (ultralytics)
Training images
: 905 (including ~50% negative examples)
archival-index-card-detector huggingface.co is an AI model on huggingface.co that provides archival-index-card-detector's model effect (), which can be used instantly with this davanstrien archival-index-card-detector model. huggingface.co supports a free trial of the archival-index-card-detector model, and also provides paid use of the archival-index-card-detector. Support call archival-index-card-detector model through api, including Node.js, Python, http.
archival-index-card-detector huggingface.co is an online trial and call api platform, which integrates archival-index-card-detector's modeling effects, including api services, and provides a free online trial of archival-index-card-detector, you can try archival-index-card-detector online for free by clicking the link below.
davanstrien archival-index-card-detector online free url in huggingface.co:
archival-index-card-detector is an open source model from GitHub that offers a free installation service, and any user can find archival-index-card-detector on GitHub to install. At the same time, huggingface.co provides the effect of archival-index-card-detector install, users can directly use archival-index-card-detector installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
archival-index-card-detector install url in huggingface.co: