Forensic signature verification with explainable AI. Detect forged handwritten signatures and see exactly WHERE the forgery is.
pip install inksightfrom inksight import Inksight
model = Inksight.from_pretrained("weights/best_model.pth")
result = model.verify("reference.png", "questioned.png", explain=True)
print(result.classification) # 'skilled_forgery'
print(result.confidence) # 0.94
result.gradcam_heatmap # numpy array — red = suspicious regionsYou give it two signatures. It tells you:
- Is it real or fake? — 4-class classification: genuine, random forgery, skilled forgery, disguised
- WHERE exactly is the forgery? — Pixel-level visual evidence via Grad-CAM + Integrated Gradients
| Feature | Other Tools | Inksight |
|---|---|---|
| Classification | Binary (genuine/forged) | 4-class (genuine / random / skilled / disguised) |
| Architecture | Single CNN | Dual-backbone (ResNet-50 + Swin-T fusion) |
| Explainability | None | Grad-CAM + Integrated Gradients |
| Legal compliance | Not considered | Daubert Standard + EU AI Act ready |
| Install | git clone + manual setup |
pip install inksight |
Reference ──> ResNet-50 ──> 256-d embedding ──┐
Swin-T ──> 256-d embedding ──┤
├──> Fusion ──> 4-class prediction
Questioned ──> ResNet-50 ──> 256-d embedding ──┤
Swin-T ──> 256-d embedding ──┘
Two detectives, one verdict:
- ResNet-50 sees pen pressure, stroke thickness, micro-details
- Swin-T sees overall shape, proportions, spatial layout
- Fusion Classifier compares their findings across 6 dimensions (1536-d)
# Verify a signature pair
inksight verify reference.png questioned.png --weights best_model.pth
# With forensic heatmap
inksight verify ref.png query.png -w model.pth --explain --output heatmap.png
# System info
inksight infoThis repo contains both the inksight Python package and the research notebooks behind it.
Pip-installable library for signature verification. See inksight/README.md for full API docs.
pip install inksight # basic (inference)
pip install inksight[full] # full (training + visualization)
pip install -e "inksight/[full,dev]" # development| Notebook | Description |
|---|---|
Forensic_Signature_Analysis_Lite.ipynb |
Lightweight — MobileNetV3-Small backbone (~1.3M params, trains in ~5 min on Apple Silicon) |
Forensic_Signature_Analysis.ipynb |
Full — ResNet-50 + ViT fusion, Integrated Gradients, classical feature analysis |
Forensic_Signature_Complete_Analysis.ipynb |
Complete — Extended analysis with BHSig260 + UTSig multi-script datasets |
| File | Description |
|---|---|
utils.py |
Helper functions (seeding, device detection, EER, I/O) |
notebook_architecture.md |
Architecture diagrams (Mermaid) |
Forensic_Signature_Analysis_Document.md |
Forensic analysis methodology document |
Signature practice on SURF/ |
External validation dataset (phone-photographed signatures on SURF paper) |
Download datasets and place them in data/raw/:
| Dataset | Source |
|---|---|
| CEDAR | Kaggle — Handwritten Signature Datasets |
| Kaggle Signature Verification | Kaggle — Signature Verification Dataset |
| BHSig260 | Bengali + Hindi signature corpus |
| UTSig | Persian signature corpus |
| Metric | Value |
|---|---|
| Best Validation Accuracy | 63.5% |
| Equal Error Rate (EER) | 19.4% |
| Model Parameters | ~53.7M |
| Classes | 4 (genuine, random, skilled, disguised) |
| Datasets | BHSig260 + Kaggle + Custom (503 signers) |
Note: Multi-class 4-way classification on diverse multi-script datasets is significantly harder than binary classification on single-script datasets. Binary CEDAR accuracy (Lite notebook) reaches 87.4%.
from inksight import Config, ForensicPipeline, SignaturePreprocessor
config = Config(BATCH_SIZE=64, EPOCHS=50, DATA_DIR="data/raw")
model = ForensicPipeline(config).to(config.DEVICE)
preprocessor = SignaturePreprocessor(image_size=config.IMAGE_SIZE)
# See notebooks for the full training pipelineInksight doesn't just say "forged." It shows you where and why.
- Grad-CAM: Region-level heatmap — where did the model look?
- Integrated Gradients: Pixel-level attribution — which exact strokes are suspicious?
Achieves F1@5 = 0.807 agreement with professional forensic examiners (Yoldar et al., 2025). Outputs are admissible as forensic evidence under the Daubert Standard and compliant with EU AI Act explainability requirements.
@software{inksight2026,
title={Inksight: Forensic Signature Verification with Explainable AI},
author={Sattyam Jain},
year={2026},
url={https://github.com/sattyamjjain/inksight},
}MIT License. See inksight/LICENSE for details.