All B-Agent apps Home
Case study · B-Agent

B-Agent Sign

Checks whether a cheque signature matches the one on file.

Built it end to end: the React app, the Node.js API, the Python ML service and the Entra sign-in.

30–90 sML cold start the design works around
3sign-in layers
90 / 92match threshold, normal / simple signature
105×105grayscale input per signature crop
The problem

Teams that process cheques compare the signature on each cheque with the one on the signature circular by eye. It is slow, it varies from person to person, and stamps or a second signature on the page make it harder.

The approach

Its own ML service finds every signature on both documents, turns each into an embedding and compares them pair by pair. The result is a 0 to 100 score and a clear Match, Review or No match decision, with a stricter bar for simple signatures.

How it works

From request to answer, step by step.

  1. 01Upload documentsCheque and signature circular, as images or PDFs
  2. 02PDF to imagesEach page rendered so every page is scanned
  3. 03Detect signaturesYOLOv8 crops every signature region it finds
  4. 04Embed each cropSiamese CNN turns a 105×105 grayscale crop into 256 numbers
  5. 05Compare all pairsEvery reference crop against every query crop, best pair wins
  6. 06DecideScore from 0 to 100, stricter threshold for simple signatures
  7. 07Review and historyApprove or retry; every comparison is kept

What it does

  • Upload a cheque and a signature circular, as images or PDFs.
  • Get a 0 to 100 score with a Match, Review or No match decision.
  • Approve or retry, and keep a history of every comparison.

Under the hood

  • Its own ML service: YOLOv8 finds the signatures, a Siamese CNN turns each into a 256-number fingerprint.
  • Every pair of detected regions is compared, so stamps and second signatures don't fool it.
  • Simple signatures automatically get a stricter threshold.
  • Microsoft sign-in in three layers: the site, an API token check, an IP-locked ML service.
Hard problems

What took real engineering.

Problem 1

A 45-second cap on a 90-second job

Static Web Apps cuts off proxied API calls at 45 seconds, but a comparison can take 30 to 90 seconds while the ML models load after idle. So the browser calls the API directly with its own Microsoft token instead of going through the proxy. That led to sign-in in three layers: the site, a token check in the API, and an ML service that only accepts traffic from the API's servers.

Problem 2

Stamps and second signatures

Comparing the largest region on each page fails when a stamp or a second signature is bigger than the one that matters. The service embeds every detected region on both documents, scores every pair and reports the best one, along with which regions and pages it came from. For single-page documents it also scores the full page as one more candidate.

Problem 3

Simple signatures need a stricter bar

A short, simple signature looks like many others, so a high score means less. The service measures each crop's ink ratio, contour count and stroke complexity, and raises the match threshold when either side is simple. A fallback model keeps the service working if the main verifier cannot load, and every response says which path was used.

Built with
ReactTypeScriptNode.jsPythonPyTorchYOLOv8Docker