Case study

Applied AI

Structural Verification for Generated Images

A deterministic quality gate for generative image edits, using a hand-implemented Sobel edge detector and edge-overlap IoU scoring to flag structural changes.

Outcome

Deterministic geometry checks around a non-deterministic staging model.

The constraint

Generative staging can produce a plausible room while quietly moving a wall, window, or door. Visual quality alone is not enough for a listing image; the pipeline needs a deterministic check that can flag structural drift for human review.

Verification path

01

Original

Immutable source image

02

Generated

Staged model output

03

Edge maps

Explicit 3×3 Sobel kernels

04

Overlap

Edge-intersection IoU

05

Gate

Pass, flag, or fail

Engineering decision

Put a deterministic check around the generative step.

  • Convert both images to raw grayscale buffers and calculate horizontal and vertical gradients
  • Threshold gradient magnitude into comparable structural edge maps
  • Score the intersection over union of edge pixels instead of trusting a visual-quality model
  • Keep the scoring code unit-tested and separate from the staging model
  • Send borderline or conflicting results to review rather than silently accepting them

Staging output

Empty room before stagingBefore
AI staged roomAfter
Empty room before stagingBefore
AI staged roomAfter

Internal production tool; access is restricted.

3×3

Sobel Kernels

IoU

Edge-Overlap Score

Fail Closed

Ambiguous Results

Tested

Deterministic Gate

Built With

TypeScriptComputer VisionSobel OperatorIoU ScoringVitestGoogle Gemini