# goyashek/signature-forgery-verification architecture

> Architecture diagram of the GitHub repository goyashek/signature-forgery-verification, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/goyashek/signature-forgery-verification
- Repository: https://github.com/goyashek/signature-forgery-verification

## Overview

This repository is an offline signature-forgery verification demo and model-development project. The main user flow is to upload 3–5 genuine reference signatures and a questioned signature in the Gradio app; shared inference deduplicates and preprocesses them, embeds them with the saved model, then returns a calibrated genuine, forged, or inconclusive verdict. Separate supporting branches prepare combined datasets, detect known leakage patterns, and document model experiments. The graph follows the sampled runtime and README; notebook internals were not inspected.

Main entry points: [`inference.py`](https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py) (Image inference), [`app.py`](https://github.com/goyashek/signature-forgery-verification/blob/main/app.py) (Gradio app), [`sign_data`](https://github.com/goyashek/signature-forgery-verification/tree/main/sign_data) (Signature datasets), [`analyze_band.py`](https://github.com/goyashek/signature-forgery-verification/blob/main/analyze_band.py) (Threshold analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Demo workflow"]
  node_app["Gradio app<br/>[app.py]"]
  node_sampledata[("NFI samples")]
end

subgraph group_verification["Verification runtime"]
  node_inference["Image inference<br/>[inference.py]"]
  node_preprocess["Image preprocessing<br/>[inference.py]"]
  node_embedding["Embedding model"]
  node_calibration["Writer decision<br/>[inference.py]"]
  node_metadata["Model metadata"]
end

subgraph group_data["Dataset preparation"]
  node_source_data[("Signature datasets")]
  node_combined[("Combined manifest<br/>[manifest.csv]")]
  node_builder["Dataset builder"]
  node_leakcheck["Leak detector<br/>[check_data_leak.py]"]
end

subgraph group_research["Model research"]
  node_experiments["Model experiments"]
  node_bandanalysis["Threshold analysis<br/>[analyze_band.py]"]
end

node_user(("Verifier"))

node_user -->|"uploads images"| node_app
node_app -->|"calls verification"| node_inference
node_app -->|"loads samples"| node_sampledata
node_inference -->|"preprocesses images"| node_preprocess
node_inference -->|"predicts embeddings"| node_embedding
node_inference -->|"scores embeddings"| node_calibration
node_inference -->|"loads settings"| node_metadata
node_source_data -->|"provides images"| node_builder
node_builder -->|"writes manifest"| node_combined
node_source_data -->|"checks leakage"| node_leakcheck
node_experiments -->|"demonstrates shared path"| node_inference
node_bandanalysis -->|"loads model"| node_embedding
node_bandanalysis -.->|"uses calibration settings"| node_metadata

click node_app "https://github.com/goyashek/signature-forgery-verification/blob/main/app.py"
click node_sampledata "https://github.com/goyashek/signature-forgery-verification/tree/main/sign_data_nfi"
click node_inference "https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py"
click node_preprocess "https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py"
click node_embedding "https://github.com/goyashek/signature-forgery-verification/blob/main/models/siamese_bh_embedding.keras"
click node_calibration "https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py"
click node_metadata "https://github.com/goyashek/signature-forgery-verification/blob/main/models/siamese_bh_meta.json"
click node_source_data "https://github.com/goyashek/signature-forgery-verification/tree/main/sign_data"
click node_combined "https://github.com/goyashek/signature-forgery-verification/blob/main/sign_data_combined/manifest.csv"
click node_builder "https://github.com/goyashek/signature-forgery-verification/blob/main/build_combined_dataset.py"
click node_leakcheck "https://github.com/goyashek/signature-forgery-verification/blob/main/check_data_leak.py"
click node_experiments "https://github.com/goyashek/signature-forgery-verification/tree/main/notebooks"
click node_bandanalysis "https://github.com/goyashek/signature-forgery-verification/blob/main/analyze_band.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_sampledata toneBlue
class node_inference,node_preprocess,node_embedding,node_calibration,node_metadata toneAmber
class node_source_data,node_combined,node_builder,node_leakcheck toneMint
class node_experiments,node_bandanalysis toneRose
class node_user toneIndigo
```

## Components

### Demo workflow

- [Gradio app](https://github.com/goyashek/signature-forgery-verification/blob/main/app.py): `app.py`
- [NFI samples](https://github.com/goyashek/signature-forgery-verification/tree/main/sign_data_nfi): `sign_data_nfi`

### Verification runtime

- [Image inference](https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py): `inference.py`
- [Image preprocessing](https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py): `inference.py`
- [Embedding model](https://github.com/goyashek/signature-forgery-verification/blob/main/models/siamese_bh_embedding.keras): `models/siamese_bh_embedding.keras`
- [Writer decision](https://github.com/goyashek/signature-forgery-verification/blob/main/inference.py): `inference.py`
- [Model metadata](https://github.com/goyashek/signature-forgery-verification/blob/main/models/siamese_bh_meta.json): `models/siamese_bh_meta.json`

### Dataset preparation

- [Signature datasets](https://github.com/goyashek/signature-forgery-verification/tree/main/sign_data): `sign_data`
- [Combined manifest](https://github.com/goyashek/signature-forgery-verification/blob/main/sign_data_combined/manifest.csv): `sign_data_combined/manifest.csv`
- [Dataset builder](https://github.com/goyashek/signature-forgery-verification/blob/main/build_combined_dataset.py): `build_combined_dataset.py`
- [Leak detector](https://github.com/goyashek/signature-forgery-verification/blob/main/check_data_leak.py): `check_data_leak.py`

### Model research

- [Model experiments](https://github.com/goyashek/signature-forgery-verification/tree/main/notebooks): `notebooks`
- [Threshold analysis](https://github.com/goyashek/signature-forgery-verification/blob/main/analyze_band.py): `analyze_band.py`

### Other components

- **Verifier**

## Connections

- Verifier → Gradio app: uploads images (evidence: `README.md`)
- Gradio app → Image inference: calls verification (evidence: `app.py`)
- Gradio app → NFI samples: loads samples (evidence: `app.py`)
- Image inference → Image preprocessing: preprocesses images (evidence: `inference.py`)
- Image inference → Embedding model: predicts embeddings (evidence: `inference.py`)
- Image inference → Writer decision: scores embeddings (evidence: `inference.py`)
- Image inference → Model metadata: loads settings (evidence: `inference.py`)
- Signature datasets → Dataset builder: provides images (evidence: `build_combined_dataset.py`)
- Dataset builder → Combined manifest: writes manifest (evidence: `build_combined_dataset.py`)
- Signature datasets → Leak detector: checks leakage (evidence: `check_data_leak.py`)
- Model experiments → Image inference: demonstrates shared path (evidence: `README.md`)
- Threshold analysis → Embedding model: loads model (evidence: `analyze_band.py`)
- Threshold analysis → Model metadata: uses calibration settings
