Document Signature Detector v1
A one-class document object detector for locating handwritten signatures. The model is a YOLOS detector published in the Hugging Face Transformers format. It predicts the class signature (label ID 0). It is not an Ultralytics YOLO checkpoint and does not detect stamps or other document marks.
Model details
- Architecture:
YolosForObjectDetection(model_type: yolos) - Image processor:
YolosImageProcessor - Checkpoint:
model.safetensors - Input preprocessing: resize to 640 × 640, rescale and normalize using the image processor configuration
- Labels:
0 → signature - The repository currently requires Hugging Face access approval/authentication to download model files.
Inference
Install a recent Transformers release and Pillow:
pip install "transformers>=4.45" torch pillow
import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModelForObjectDetection
model_id = "ducln-business/document-signature-detector-v1"
processor = AutoImageProcessor.from_pretrained(model_id)
model = AutoModelForObjectDetection.from_pretrained(model_id)
model.eval()
image = Image.open("document.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.inference_mode():
outputs = model(**inputs)
height, width = image.size[1], image.size[0]
predictions = processor.post_process_object_detection(
outputs, threshold=0.5, target_sizes=torch.tensor([[height, width]])
)[0]
for score, label, box in zip(predictions["scores"], predictions["labels"], predictions["boxes"]):
print(model.config.id2label[int(label)], float(score), [round(float(v), 1) for v in box])
Boxes are returned as [x_min, y_min, x_max, y_max] in the original image's pixel coordinates. Choose the confidence threshold for the intended use case; 0.5 is an example only.
Fine-tuning
This checkpoint is a Transformers YOLOS model. Fine-tune it with a Transformers detection training loop and labels prepared for YolosImageProcessor (COCO-style annotations). For a different label set, initialize with the target id2label and label2id and use ignore_mismatched_sizes=True so the detection classifier is recreated for the requested classes. Evaluate on a validation split and reserve the test split for final reporting.
It cannot be loaded with ultralytics.YOLO(...). Use the Transformers APIs above. Converting it to an Ultralytics .pt checkpoint would require a different model architecture and is not a file-format conversion.
Evaluation
The repository's test_benchmark.json records the following detection metrics for the reported test run:
| Metric | Score |
|---|---|
| mAP (IoU 0.50:0.95) | 0.4587 |
| mAP@0.50 | 0.9364 |
| mAP@0.75 | 0.3920 |
| AR@100 | 0.5674 |
Validation history is available in training_history.json. The repository does not currently document the evaluation dataset composition or benchmark command, so treat these scores as reported run results rather than a fully reproducible benchmark.
Limitations
- The only documented output class is
signature; the model is not a general document-element detector. - Performance can vary with scan quality, handwriting style, document language, layout and image resolution.
- The model card does not identify training-data provenance, license, or demographic/domain coverage. Confirm rights and suitability before redistribution or deployment.
- The model files are gated; users must have access to the repository to download them.
Files
config.json: model architecture and label mappingpreprocessor_config.json: image preprocessing configurationmodel.safetensors: trained weightstraining_history.json: per-epoch training and validation metricstest_benchmark.json: reported test metrics