Signature detection, tested on signed IRS forms
25 of 28
scanned signatures found, model plus 6 tiles
Cut the page into tiles first
| Tool | Scans | Simulated photos |
|---|---|---|
| DETR, 6 tiles | 25 | 23 |
| DETR, default call | 14 | 13 |
| YOLOS-tiny, 6 tiles | 20 | 19 |
| YOLOS-tiny, default call | 11 | 8 |
| signature-detect | 0 | 0 |
DETR is tech4humans/conditional-detr-50-signature-detector, and YOLOS-tiny is mdefrance/yolos-tiny-signature-detection. Both are Apache-2.0 and run on a CPU.
Both squash any image to 640 x 640 pixels, so a signature on a full page shrinks to about 20 pixels tall.
We tried one other setting: 6 overlapping tiles, 2 across and 3 down. We picked it after the default run and did not tune it.
Tiles also box handwriting
| Run | Handwriting boxed | Unsigned pages left clean |
|---|---|---|
| DETR, 6 tiles | 10 | 2 |
| DETR, default call | 4 | 5 |
| YOLOS-tiny, 6 tiles | 12 | 1 |
| YOLOS-tiny, default call | 4 | 5 |
The models also box some handwriting that is not a signature. On the unsigned SS-4 and 2848, a handwritten name alone made the page look signed.
A higher score cutoff did not fix it. At 0.8, DETR with tiles still boxed 6 handwritten items and found only 16 signatures.
We did not test it, but if every page is the same form, you can keep only the boxes on its signature lines.
A free signature detector in Python
It cuts each page into 6 tiles, runs the DETR model on each tile, and puts the boxes back on the page.
pip install torch transformers timm pillow
python signature.py page.jpg > signatures.csv
Each row is one box: its corners in pixels and a score. It printed the same boxes as our bench on all 36 test images, about 5 seconds a page.
Show the code (74 lines)
"""Find handwritten signatures on page images. Free to use, no warranty. Brasspage, Nov 2026.
Usage: python signature.py page.jpg [more.jpg ...] > signatures.csv
Needs: pip install torch transformers timm pillow
Output rows: file, x0, y0, x1, y1 (pixels of the input image), score (0 to 1).
For a PDF, make page images first, for example: pdftoppm -r 200 -png form.pdf page
How it works: the model (tech4humans/conditional-detr-50-signature-detector, Apache-2.0) squashes any
image to 640 x 640, so a signature on a full page gets very small. This script cuts the page into 6
overlapping tiles, runs the model on each tile, puts the boxes back on the page and drops the copies
found twice where tiles overlap. A handwritten date or name can come back as a signature too.
"""
import csv
import sys
from PIL import Image
from transformers import pipeline
MODEL = "tech4humans/conditional-detr-50-signature-detector"
REVISION = "9582471a229a9cbbe721e56dcd4e95e1fef7cb8b"
MIN_SCORE = 0.5 # the pipeline's default
def tiles(w, h):
"""2 across and 3 down, each 0.6 of the page width."""
s = int(0.6 * w)
ys = [0, (h - s) // 2, h - s] if h > s else [0]
return [(x, y, s) for y in ys for x in (0, w - s)]
def merge(boxes):
"""Best score first. Drop a box that covers 70% of a kept box, or 70% of it is covered."""
kept = []
for b in sorted(boxes, key=lambda b: -b[4]):
for k in kept:
w = min(b[2], k[2]) - max(b[0], k[0])
h = min(b[3], k[3]) - max(b[1], k[1])
small = min((b[2] - b[0]) * (b[3] - b[1]), (k[2] - k[0]) * (k[3] - k[1]))
if w > 0 and h > 0 and w * h >= 0.7 * small:
break
else:
kept.append(b)
return kept
def find(detect, im):
boxes = []
for x, y, s in tiles(*im.size):
for d in detect(im.crop((x, y, x + s, y + s)), threshold=MIN_SCORE):
b = d["box"]
boxes.append(
[
b["xmin"] + x,
b["ymin"] + y,
b["xmax"] + x,
b["ymax"] + y,
round(d["score"], 4),
]
)
return merge(boxes)
def main():
detect = pipeline("object-detection", model=MODEL, revision=REVISION, device="cpu")
out = csv.writer(sys.stdout)
out.writerow(["file", "x0", "y0", "x1", "y1", "score"])
for path in sys.argv[1:]:
for b in find(detect, Image.open(path).convert("RGB")):
out.writerow([path, *b])
if __name__ == "__main__":
main()
signature-detect needs white paper
signature-detect 0.1.4 (MIT) treats anything darker than near white as ink, then judges each blob. We used the settings of its own demo.
On our grayscale scans it called 10 blobs signatures, and none matched a real one. On photos the paper is darker than its cutoff, so it found nothing.
OCR reads the words, not the signature
We ran our pdf-ocr Actor's code on the 18 scans. On this signed W-9, the signature line came out as:
# Sign Signature of ble hv" 111812026
Here | US. person Date
The labels came through. The signature turned into junk letters, and the slashes in the handwritten date came out as 1s. Use a detector for the signature and OCR for the words.
Sources
- tech4humans/conditional-detr-50-signature-detector (Apache-2.0)
- mdefrance/yolos-tiny-signature-detection (Apache-2.0)
- signature-detect on GitHub (MIT)
- Wikimedia Commons, SVG signatures (the test signatures, public domain only)
- IRS forms
How we tested
- Real IRS forms from irs.gov: W-9 page 1, SS-4 page 1, 1040 (2025) page 2, 8822 page 1, 8879 page 1 and 2848 page 2. US government forms carry no copyright.
- 16 signature lines, each page filled 3 times: all lines signed, some signed, none signed. 28 signatures and 6 unsigned pages in each set of 18 pages.
- The signatures come from Wikimedia Commons, public domain only, picked at random with a fixed seed. We dropped 5 that were drawings or had printed words. One of the 28 is a cartoon character's.
- Made-up typed text went in about half the text fields. Each signature got a date in a free handwriting font, and the SS-4 and 2848 a handwritten name: 34 handwritten items a set.
- Each page as a gray scan and as a simulated phone photo, 3024 by 4032. Not real photos.
- A signature counts as found when a box overlaps it by IoU 0.3 or more, or the box center sits inside it and the box is at most 4 times its area. Boxes with a score of 0.5 or more, the pipeline default.
- One change after the first run: signatures drawn up to 1.8 times the line height overlapped on stacked lines. We drew them at 1 to 1.4 times and ran every tool again.
- transformers 5.23.0 and torch 2.15.0 on the CPU, 2 threads, low priority. signature-detect 0.1.4 with the settings of its demo.py. Our Actor's code at commit b765c619 (version 0.1.87). Mac with Apple M5 Max, macOS 26.6.
- Not tested: tech4humans/yolov8s-signature-detector (AGPL-3.0, Hugging Face asks you to sign in and accept its terms first), and paid cloud APIs.
Scanned forms to text, no install
Run it yourself. Our Apify Actor turns scanned PDFs and images into Markdown. $0.006 a scanned page. It reads printed words, not signatures.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. Printed text only. First page free.
Questions people ask
What is the best free signature detection model?
In our test, tech4humans/conditional-detr-50-signature-detector (Apache-2.0), run on 6 tiles of each page, found 25 of 28 signatures on scans and 23 on photos. YOLOS-tiny found 20 and 19.
Why does a signature detector miss signatures on a full page?
Both models we tested squash any image to 640 x 640 pixels, so a signature on a full page shrinks to about 20 pixels tall. Cut the page into tiles first.
Can a signature detector tell if a form is signed?
Not alone. With tiles, the best model also boxed handwritten dates and names, and it called 4 of 6 unsigned scans signed.
Can OpenCV detect signatures?
signature-detect, a small OpenCV and scikit-image package, found 0 of 28 on our scans. It treats anything darker than near white as ink, so on photos it found nothing.
Can OCR detect signatures?
No. Our OCR Actor read the labels and typed fields, but each signature came out as junk letters or nothing at all.
Related guides
- Stamp detection in Python: 5 free tools on IRS forms
- Checkbox detection in Python: 3 free tools on 768 boxes
- Handwritten notes to text: 9 OCR tools on 100 notes
- Free OMR software: bubble sheet scanners tested on 20 sheets
- Free zonal OCR in Python: 7 ways tested on 24 filled forms
- Erase handwriting from a scan or PDF, tested on 50 filled pages