# koi-nykwak/seal-verification-source architecture

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

- Interactive diagram: https://gitdiagram.com/koi-nykwak/seal-verification-source
- Repository: https://github.com/koi-nykwak/seal-verification-source

## Overview

This repository implements stamp verification: a caller supplies document or stamp images, and `StampVerificationProcessor` uses configured ONNX models and image-processing helpers to extract stamps, assess stamp shape and quality, and compare stamp images. The excerpts show document-type extraction branches and comparison logic, but not a public API or all routing details, so the graph focuses on the processor and the evidenced model/helper calls.

Main entry points: [`processor.py`](https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py) (Verification processor), [`models/baseModel.py`](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/baseModel.py) (ONNX inference base), [`models/obbModel.py`](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/obbModel.py) (Oriented detection), [`models/segModel.py`](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/segModel.py) (Stamp segmentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Verification workflow"]
  node_processor["Verification processor<br/>[processor.py]"]
  node_extraction["Stamp extraction<br/>[processor.py]"]
  node_stamp_assessment["Stamp assessment<br/>[processor.py]"]
  node_comparison["Stamp comparison<br/>[processor.py]"]
  node_result["Verification result<br/>[processor.py]"]
  node_config["Model configuration<br/>[config.py]"]
end

subgraph group_models["Inference models"]
  node_onnx_base["ONNX inference base<br/>[baseModel.py]"]
  node_obb["Oriented detection<br/>[obbModel.py]"]
  node_segmentation["Stamp segmentation<br/>[segModel.py]"]
  node_shape_model["Shape and quality<br/>[shapeModel.py]"]
  node_edge_model["Stamp embedding<br/>[edgeFace.py]"]
  node_classification["Stamp classification<br/>[clsModel.py]"]
  node_detection["Object detection<br/>[detModel.py]"]
end

subgraph group_shared["Image processing"]
  node_image_helpers["Image helpers<br/>[utils.py]"]
end

node_caller(("Image caller"))

node_caller -->|"provides images"| node_processor
node_processor -->|"uses settings"| node_config
node_processor -->|"dispatches extraction"| node_extraction
node_processor -->|"runs comparison"| node_comparison
node_processor -->|"assesses stamps"| node_stamp_assessment
node_processor -->|"runs detection"| node_obb
node_processor -->|"runs masks"| node_segmentation
node_processor -->|"gets shape"| node_shape_model
node_processor -->|"gets embeddings"| node_edge_model
node_processor -->|"uses helpers"| node_image_helpers
node_extraction -->|"detects stamp regions"| node_obb
node_extraction -->|"crops stamp images"| node_image_helpers
node_stamp_assessment -->|"checks quality"| node_shape_model
node_stamp_assessment -->|"detects stamp marks"| node_obb
node_comparison -->|"compares embeddings"| node_edge_model
node_comparison -->|"creates masks"| node_segmentation
node_comparison -->|"extracts scanner stamps"| node_image_helpers
node_processor -->|"returns results"| node_result
node_obb -->|"inherits inference"| node_onnx_base
node_segmentation -->|"inherits inference"| node_onnx_base
node_shape_model -->|"inherits inference"| node_onnx_base
node_edge_model -->|"inherits inference"| node_onnx_base
node_classification -->|"inherits inference"| node_onnx_base
node_detection -->|"inherits inference"| node_onnx_base

click node_processor "https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py"
click node_extraction "https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py"
click node_stamp_assessment "https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py"
click node_comparison "https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py"
click node_result "https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py"
click node_config "https://github.com/koi-nykwak/seal-verification-source/blob/main/config.py"
click node_onnx_base "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/baseModel.py"
click node_obb "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/obbModel.py"
click node_segmentation "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/segModel.py"
click node_shape_model "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/shapeModel.py"
click node_edge_model "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/edgeFace.py"
click node_classification "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/clsModel.py"
click node_detection "https://github.com/koi-nykwak/seal-verification-source/blob/main/models/detModel.py"
click node_image_helpers "https://github.com/koi-nykwak/seal-verification-source/blob/main/utils.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_processor,node_extraction,node_stamp_assessment,node_comparison,node_result,node_config toneBlue
class node_onnx_base,node_obb,node_segmentation,node_shape_model,node_edge_model,node_classification,node_detection toneAmber
class node_image_helpers toneMint
class node_caller toneIndigo
```

## Components

### Verification workflow

- [Verification processor](https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py): `processor.py`
- [Stamp extraction](https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py): `processor.py`
- [Stamp assessment](https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py): `processor.py`
- [Stamp comparison](https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py): `processor.py`
- [Verification result](https://github.com/koi-nykwak/seal-verification-source/blob/main/processor.py): `processor.py`
- [Model configuration](https://github.com/koi-nykwak/seal-verification-source/blob/main/config.py): `config.py`

### Inference models

- [ONNX inference base](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/baseModel.py): `models/baseModel.py`
- [Oriented detection](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/obbModel.py): `models/obbModel.py`
- [Stamp segmentation](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/segModel.py): `models/segModel.py`
- [Shape and quality](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/shapeModel.py): `models/shapeModel.py`
- [Stamp embedding](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/edgeFace.py): `models/edgeFace.py`
- [Stamp classification](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/clsModel.py): `models/clsModel.py`
- [Object detection](https://github.com/koi-nykwak/seal-verification-source/blob/main/models/detModel.py): `models/detModel.py`

### Image processing

- [Image helpers](https://github.com/koi-nykwak/seal-verification-source/blob/main/utils.py): `utils.py`

### Other components

- **Image caller**

## Connections

- Image caller → Verification processor: provides images
- Verification processor → Model configuration: uses settings (evidence: `processor.py`)
- Verification processor → Stamp extraction: dispatches extraction (evidence: `processor.py`)
- Verification processor → Stamp comparison: runs comparison (evidence: `processor.py`)
- Verification processor → Stamp assessment: assesses stamps (evidence: `processor.py`)
- Verification processor → Oriented detection: runs detection (evidence: `processor.py`)
- Verification processor → Stamp segmentation: runs masks (evidence: `processor.py`)
- Verification processor → Shape and quality: gets shape (evidence: `processor.py`)
- Verification processor → Stamp embedding: gets embeddings (evidence: `processor.py`)
- Verification processor → Image helpers: uses helpers (evidence: `processor.py`)
- Stamp extraction → Oriented detection: detects stamp regions (evidence: `processor.py`)
- Stamp extraction → Image helpers: crops stamp images (evidence: `processor.py`)
- Stamp assessment → Shape and quality: checks quality (evidence: `processor.py`)
- Stamp assessment → Oriented detection: detects stamp marks (evidence: `processor.py`)
- Stamp comparison → Stamp embedding: compares embeddings (evidence: `processor.py`)
- Stamp comparison → Stamp segmentation: creates masks (evidence: `processor.py`)
- Stamp comparison → Image helpers: extracts scanner stamps (evidence: `processor.py`)
- Verification processor → Verification result: returns results (evidence: `processor.py`)
- Oriented detection → ONNX inference base: inherits inference (evidence: `models/obbModel.py`)
- Stamp segmentation → ONNX inference base: inherits inference (evidence: `models/segModel.py`)
- Shape and quality → ONNX inference base: inherits inference (evidence: `models/shapeModel.py`)
- Stamp embedding → ONNX inference base: inherits inference (evidence: `models/edgeFace.py`)
- Stamp classification → ONNX inference base: inherits inference (evidence: `models/clsModel.py`)
- Object detection → ONNX inference base: inherits inference (evidence: `models/detModel.py`)
