Model Card for Model ID
Model Details
Model Description
This model is an imagee-embedding network developed for offline signature verification. It determines whether two scanned signature images are likely to have been written by the same person by mapping each image into a 256-dimensional embedding space.
Rather than directly predicting a signer identity or producing a binary genuine/forged classification, the model learns a similarity representation using deep metric learning. Signature pairs can then be compared using cosine similarity.
The model uses an EfficientNetV2-S backbone and was trained with $L_{SC+}$, a modified metric-learning objective that emphasises difficult negative examples while also encouraging genuine signatures from the same signer to form compact clusters.
The model was developed as part of a university final-year research project on offline signature verification.
- Developed by: Me!
- Funded by: Independently developed as an academic final-year project
- Shared by: Me!
- Model type: Convolutional neural network image encoder / deep metric-learning model
- Input modality : Greyscale signature images
- Output: 256-dimensional L2-normalised embedding
- Language: Not applicable; the model processes images
- License: GNU General Public License v3.0
- Finetuned from model:
timm/tf_efficientnetv2_m.in1k
Model Sources
- Repository: GitHub
- Write-Up Project Garden
- Demo: streamlit
Uses
Direct Use
The model can be used to:
- Extract feature embeddings from offline signature images.
- Compare two signatures using cosine similarity.
- Rank candidate signatures by similarity.
- Support research experiments involving writer-independent signature verification.
- Explore deep metric learning for biometric image matching.
A typical verification workflow is:
- Preprocess two signature images.
- Pass each image through the encoder.
- Obtain two normalised 256-dimensional embeddings.
- Calculate their cosine similarity.
- Compare the similarity score against a threshold calibrated for the target dataset and operating conditions.
The model does not include a universally valid verification threshold. Users should select a threshold using validation data representative of their deployment environment.
Downstream Use [optional]
The model may be incorporated into:
- Signature-verification research systems.
- Document-processing prototypes.
- Signature retrieval or matching applications.
- Embedding visualisation and clustering experiments.
- Transfer-learning experiments on other handwriting or biometric datasets.
Additional fine-tuning is recommended before using the model on signature styles, writing systems, scanners, cameras, or document formats that differ substantially from the training data.
Out-of-Scope Use
The model is not intended for:
- Use as the sole basis for legal, financial, forensic, or identity-related decisions.
- Authentication of high-value transactions without additional safeguards.
- Definitive authorship attribution.
- Verification of online signatures captured as pen trajectories.
- Identifying the signer from a known list of individuals.
- Evaluating signatures from writing systems or populations not represented during development without additional validation.
- Replacing examination by trained forensic document specialists.
- Production deployment without domain-specific testing, calibration, monitoring, and human review.
The model should not be treated as proof that a signature is genuine or forged.
Bias, Risks, and Limitations
The model was primarily evaluated using the CEDAR signature dataset, which contains Latin-script signatures collected under controlled conditions. Its performance may not generalise to other populations, scripts, acquisition devices, document backgrounds, compression levels, or image qualities.
Important limitations include:
- Dataset size: CEDAR contains a relatively small number of writers compared with large-scale biometric datasets.
- Script limitation: The model was not comprehensively evaluated on Chinese, Arabic, Indic, or other non-Latin signature styles.
- Domain shift: Performance may decrease on photographs, mobile scans, noisy documents, low-resolution images, or signatures extracted from complex backgrounds.
- Skilled forgeries: A high similarity score does not guarantee that a signature is genuine, especially when a forgery closely imitates the genuine writer.
- Threshold sensitivity: Verification results depend on the decision threshold selected by the user.
- Preprocessing sensitivity: Cropping, padding, resizing, background artefacts, and binarisation may influence the generated embeddings.
- Writer-independent evaluation: Results from one evaluation split may not transfer directly to unseen datasets or deployment populations.
- Interpretability: Similarity scores do not provide a complete explanation of which handwriting characteristics caused a match or mismatch.
- Security: The model has not been evaluated against adversarial attacks, deliberate image manipulation, replay attacks, or model-extraction attacks.
Grad-CAM analysis conducted during development indicated that the network could sometimes attend to image boundaries, padding regions, and isolated marks. This suggests that acquisition and preprocessing artefacts may influence some predictions.
Recommendations
Users should:
- Calibrate the verification threshold using a representative validation set.
- Report false acceptance and false rejection behaviour alongside aggregate metrics.
- Evaluate performance separately for genuine pairs, random forgeries, and skilled forgeries.
- Test the model on the intended population, writing system, scanner, and document format.
- Retain human review for consequential decisions.
- Avoid interpreting a similarity score as conclusive evidence of identity or fraud.
- Monitor for performance degradation when the input distribution changes.
- Use multiple reference signatures where possible rather than relying on a single comparison.
- Apply consistent image extraction, cropping, and normalisation procedures.
- Document any threshold, preprocessing, or fine-tuning changes made in downstream systems.
How to Get Started with the Model
The model produces normalised feature embeddings rather than final genuine/forged labels.
The following example illustrates the intended inference process. The exact checkpoint-loading code may need to be adjusted to match the keys stored in the published checkpoint.
1from pathlib import Path
2
3import timm
4import torch
5import torch.nn as nn
6import torch.nn.functional as F
7
8from PIL import Image
9from torchvision import transforms
10
11
12class SignatureEncoder(nn.Module):
13 def __init__(self, embedding_dim: int = 256) -> None:
14 super().__init__()
15
16 self.backbone = timm.create_model(
17 "tf_efficientnetv2_m.in21k_ft_in1k",
18 pretrained = False,
19 in_chans=1,
20 num_classes = 0,
21 global_pool = "avg"
22 )
23
24 feature_dim = self.backbone.num_features
25
26 self.embedding_head = nn.Sequential(
27 nn.Linear(feature_dim, 512),
28 nn.BatchNorm1d(512),
29 nn.ReLU(inplace=True),
30 nn.Dropout(p=0.4),
31 nn.Linear(512, embedding_dim),
32 nn.BatchNorm1d(embedding_dim),
33 )
34
35 def forward(self, images: torch.Tensor) -> torch.Tensor:
36 features = self.backbone(images)
37 embeddings = self.embedding_head(features)
38 return F.normalize(embeddings, p=2, dim=1)
39
40def load_signature_image(image_path: str | Path) -> torch.Tensor:
41 preprocessing = transforms.Compose(
42 [
43 transforms.Grayscale(num_output_channels=1),
44 transforms.Resize((384, 384)),
45 transforms.ToTensor(),
46 transforms.Normalize(mean=[0.5], std=[0.5]),
47 ]
48 )
49 image = Image.open(image_path).convert("L")
50 return preprocessing(image).unsqueeze(0)
51
52device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
53
54model = SignatureEncoder(embedding_dim = 256)
55
56checkpoint = torch.load(
57 "signature_encoder.pt",
58 map_loction=device,
59 weights_only=True,
60)
61# Adjust this line if the checkpoint stores the state dictionary
62# under a key such as "model_state_dict".
63
64state_dict = checkpoint.get("model_state_dict", checkpoint)
65model.load_state_dict(state_dict)
66
67model.to(device)
68model.eval()
69
70signature_a = load_signature_image("signature_a.png").to(device)
71signature_b = load_signature_image("signature_b.png").to(device)
72
73with torch.inference_mode():
74 embedding_a = model(signature_a)
75 embedding_b = model(signature_b)
76
77 cosine_similarity = F.cosine_similarity(
78 embedding_a,
79 embedding_b,
80 ).item()
81
82print(f"Cosine similarity: {cosine_similarity:.4f}")
A higher cosine similarity generally indicates that the two images are more likely to originate from the same signer. However, the score must be compared with a threshold calibrated on representative validation data.
1
2# Example only; do not use without calibration
3threshold = 0.75
4
5prediction = (
6 "likely same signer"
7 if cosine_similarity >= threshold else
8 "likely different signer"
9)
10
11print(prediction)
12
The example threshold above is illustrative and is not a recommended deployment threshold
Training Details
Training Data
The model was developed using the CEDAR offline signature dataset.
CEDAR contains:
- 55 writers.
- 24 genuine signatures per writer.
- 24 skilled forgeries per writer.
- 2,640 signature images in total.
The dataset includes genuine signatures and skilled forgeries produced by individuals attempting to imitate another person's signature.
A small self-collected signature set was also used during the broader project for demonstration and exploratory testing. It should not be interpreted as a statistically representative benchmark.
Users must obtain CEDAR separately and comply with its original licence and usage conditions. The dataset is not redistributed with this model.
Training Procedure
The model was trained as a writer-independent metric-learning system. During training, signature images were converted into embeddings, and online mining was used to identify informative positive and negative relationships within each batch.
The training procedure used a PK-style sampler to include multiple signatures from multiple writers while balancing genuine signatures, skilled forgeries, and negative examples.
Preprocessing
Training images were converted to greyscale and resized to approximately 384 × 384 pixels.
Training-time augmentation included:
- Random affine transformation of approximately ±5 degrees.
- Translation of up to approximately 10%.
- Scaling between approximately 0.95 and 1.05.
- Shearing of approximately ±5 degrees.
- Random resized cropping.
- Pixel normalisation using a mean of 0.5 and standard deviation of 0.5.
Evaluation preprocessing was deterministic and consisted primarily of:
- Grayscale conversion.
- Resizing.
- Tensor conversion.
- Normalisation using a mean of 0.5 and standard deviation of 0.5.
Exact preprocessing should be kept consistent between model evaluation and downstream inference.
Training Hyperparameters
- Backbone: EfficientNetV2-M
- Input channels: 1
- Input resolution: Approximately 384 × 384
- Embedding dimension: 256
- Intermediate projection dimension: 512
- Dropout: 0.4
- Loss: SCT+
- Loss margin: 1.0
- Optimizer: AdamW
- Initial learning rate: 0.001
- Weight decay: 0.001
- Batch size: 32
- Training regime: Mixed-precision training
- Learning-rate schedule: Linear warm-up followed by cosine annealing
- Warm-up duration: 5 scheduler iterations
- Warm-up starting factor: 0.1
- Cosine annealing T_max: EPOCH - 5
- Minimum learning rate: 0.000001
- Early stopping patience: Approximately 8–10 epochs
- Embedding similarity: Cosine similarity
- Sampling: PK-style batch sampling with online negative mining
Evaluation
Testing Data, Factors & Metrics
Testing Data
The model was evaluated on held-out signature comparisons constructed from the CEDAR dataset.
The main reported result focuses on skilled-forgery verification, where forged signatures were produced by individuals attempting to imitate the genuine writer.
The precise train, validation, and test writer split should be documented alongside the released evaluation code to ensure reproducibility.
Factors
Evaluation performance may vary according to:
- Genuine versus forged comparison pairs.
- Skilled versus random forgeries.
- Writer identity.
- Signature complexity.
- Image quality.
- Cropping and alignment.
- Background noise.
- Threshold selection.
- Number of available reference signatures.
The current public result is not disaggregated across demographic groups or writing systems.
Metrics
The primary reported metric is ROC-AUC.
ROC-AUC measures how effectively similarity scores rank positive same-writer pairs above negative different-writer or forged pairs across all possible thresholds.
It was selected because it:
- Does not require committing to one operating threshold.
- Reflects ranking quality across false-positive and true-positive trade-offs.
- Is suitable for comparing verification systems during research.
Accuracy, precision, and recall depend on a selected threshold. They should only be reported together with the threshold-selection procedure and evaluation split.
Results
| Evaluation setting | Metric | Result |
|---|
| CEDAR skilled-forgery verification | ROC-AUC | 0.9284 |
| Threshold-based accuracy | Accuracy | Not reported |
| Threshold-based precision | Precision | Not reported |
| Threshold-based recall | Recall | Not reported |
Summary
The model achieved a ROC-AUC of 0.9284 on the project's CEDAR skilled-forgery evaluation.
This indicates that the learned embedding space was generally effective at assigning higher similarity scores to genuine same-writer comparisons than to skilled-forgery comparisons.
The result should not be interpreted as an expected production accuracy. Performance may differ under alternative writer splits, pair-generation methods, preprocessing pipelines, datasets, or threshold-selection procedures.
Model Examination
Grad-CAM was used during development to inspect the visual regions influencing the model.
The analysis suggested that the network learned to attend to portions of the signature strokes, but it also occasionally focused on:
- Image boundaries.
- Padding regions.
- Small isolated marks.
- Top-left or edge-related visual artefacts.
These observations motivated experiments involving binarisation, reduced augmentation, and alternative preprocessing. They also indicate that some predictions may be influenced by dataset-specific artefacts rather than handwriting characteristics alone.
Embedding distributions and verification errors should be examined further before deployment on new datasets.
Environmental Impact
The model was trained on local computing hardware. A formal carbon-emissions assessment was not performed.
Carbon emissions may be estimated using the Machine Learning Impact Calculator described by Lacoste et al. (2019).
Hardware type: NVIDIA consumer GPU
Specific GPU: RTX 4070 Super
Hours used: Not recorded
Cloud provider: None / local hardware
Compute region: Malaysia
Carbon emitted: Not calculated
Because the total training duration and energy consumption were not recorded, a reliable emissions estimate cannot currently be provided.
Technical Specifications
Model Architecture and Objective
The model is a convolutional image encoder trained using deep metric learning.
For an input signature image (x), the encoder produces an embedding:
$$z = f_\theta(x)$$
The embedding is L2-normalized:
$$\hat{z} = \frac{z}{\lVert z \rVert_2}$$
Two signatures are compared using cosine similarity:
$$s(x_1, x_2) = \hat{z}_1^\top \hat{z}_2$$
Because the embeddings are normalized, the dot product corresponds to cosine similarity.
A larger score indicates greater similarity. The final verification decision depends on a user-selected threshold:
$$
\text{decision} =
\begin{cases}
\text{same writer}, & s \geq \tau
\text{different writer}, & s < \tau
\end{cases}
$$
where (\tau) is calibrated on a validation dataset.
Compute Infrastructure
Hardware
The final training run used:
GPU: RTX 4070 Super
CPU: Intel(R) Core(TM) i7-14700K
System memory: 32GB
Software
The project used software including:
- Python
- PyTorch
- torchvision
- timm
- NumPy
- scikit-learn
- OpenCV and/or Pillow
- Streamlit for the demonstration interface
Exact package versions should be obtained from the repository's environment or dependency file.
Citation
There is currently no peer-reviewed paper associated with this model. When referring to the model, cite the repository or final-year project.
BibTeX:
1@software{ding_offline_signature_verification_2026,
2 author = {Ding, Jimmy Jia Kang},
3 title = {Offline Signature Verification with Deep Metric Learning},
4 year = {2026},
5 url = {[ADD REPOSITORY OR MODEL URL]},
6 note = {EfficientNetV2-S signature embedding model trained with SCT+}
7}
APA:
Ding, J. J. K. (2026). Offline signature verification with deep metric learning [Computer software]. [ADD REPOSITORY OR MODEL URL]
Glossary
- Offline signature: A signature represented as a static image, such as a scanned paper signature.
- Online signature: A signature recorded as a time series containing information such as pen position, pressure, speed, and stroke order.
- Genuine signature: A signature produced by the claimed writer.
- Skilled forgery: A signature produced by another person who has attempted to imitate the genuine writer's signature.
- Random forgery: A signature from a different writer without an intentional attempt to imitate the target.
- Embedding: A numerical vector representing the visual characteristics of an input image.
- Metric learning: A training approach that learns a representation in which similar samples are close and dissimilar samples are far apart.
- Hard negative: A negative sample that appears highly similar to the anchor and is therefore difficult for the model to distinguish.
- Semi-hard negative: A negative sample that is farther from the anchor than its positive match but remains within the loss margin.
- Cosine similarity: A measure of the angular similarity between two vectors.
- ROC-AUC: The area under the receiver operating characteristic curve, measuring ranking performance across possible thresholds.
- False acceptance: A forged or different-writer signature incorrectly accepted as genuine.
- False rejection: A genuine signature incorrectly rejected.
More Information
This model was developed for research and educational purposes as part of an offline signature-verification project.
The associated project explores:
- Deep metric learning.
- Hard-negative mining.
- Skilled-forgery detection.
- Signature embedding visualisation.
- Model interpretability.
- Cross-domain and preprocessing limitations.
Users are encouraged to report results transparently and document:
- Dataset splits.
- Pair-generation procedures.
- Verification thresholds.
- Preprocessing steps.
- Random seeds.
- Evaluation protocols.
- Any fine-tuning or architecture changes.
Model Card Contact
Name: Jimmy Ding Jia Kang | GitHub:
HappyPotatoHead | LinkedIn:
LinkedIn | Email:
Gmail