Delivered client system · Ain Shams University IT desk · 2025

PhotoValidator

A staged photo-validation pipeline that sorts university image batches into valid, invalid, or human review. The engineering story is the gate design: cheap checks first, expensive models only when needed, and uncertainty kept as a legitimate output.

Role: Designer and implementerOutcome: Delivered and certifiedStack: OpenCV, ConvNeXt, PaddleOCR, PyIQA, Python
Live TUI demo · 0:17
0:00 / 0:00
A batch does not become one number.The terminal surface keeps stage counters, flagged files, and review decisions visible to the operator.

Recorded run envelope. The ranges below are observed process measurements; the false-positive figure is a target threshold, kept visually separate from measured behavior.

95–98%text detection range
180–350msper-image processing
<3%false-positive target
8–12%manual-review band

01 · Architecture

Four gates, one honest output contract.

PhotoValidator uses a staged cascade with a parallel middle. Specification and border checks can short-circuit obvious failures; candidates that pass those cheap gates fan out to text, watermark, and perceptual-quality modules that can run concurrently before the confidence engine returns valid, invalid, or manual review.

01 · SPECIFICATION

Does the file fit?

Dimensions, format, aspect, and basic image constraints catch cheap failures before model work begins.

fast checks
02 · BORDER

Is the frame acceptable?

Canny edges, morphology, and contour reasoning identify border and framing violations.

OpenCV geometry
03 · TEXT + WATERMARK

What is visible?

ConvNeXt and PaddleOCR detect unwanted text and watermark patterns, with outputs kept separate.

parallel vision + OCR
04 · QUALITY

Is it usable?

BRISQUE, NIQE, and CLIPIQA combine into an adaptive quality decision with review when confidence is low.

parallel quality gate
PhotoValidator high-level four-stage architecture
The system view. Preprocessing fans out into text, watermark, specification, border, and quality modules before the confidence engine creates its outputs.View complete technical documentation
PhotoValidator detailed pipeline flow
The flow view. The early gates short-circuit obvious failures; the expensive checks run as a coordinated parallel fan-out for survivors.View complete technical documentation

02 · Vision, made visible

Every check you can see.

The documentation treats each processing stage as an inspectable figure. The same test image travels from the original frame through grayscale, Sobel gradients, and Canny edges; worked border, text, and watermark examples then carry their confidence scores and final classification on the page. Click any figure to read it at full resolution.

The unmodified baseline every detector is measured against.
Stage 1Original test imageThe unmodified baseline every detector is measured against.
Grayscale conversion revealing structure while eliminating colour distractions.
Stage 2Grayscale blueprintStructure without colour — the blueprint for edge work.
Sobel X gradient highlighting vertical structures and frame edges.
Stage 3Sobel X gradientHorizontal gradients expose vertical structures and frames.
Gradient magnitude showing combined edge strength from all directions.
Stage 4Gradient magnitudeCombined directional edge strength across the frame.
Canny edge detection result showing clean, continuous edge boundaries.
Stage 5Canny edgesClean, continuous boundaries feeding the border decision.
Worked border-detection example with confidence scores and final classification.
Border verdictBorder Detection POSITIVE (0.87) → BORDERED IMAGE.
Text detection visualization with bounding boxes and confidence scores.
Text verdictText Detection POSITIVE (0.94) → TEXT OVERLAY DETECTED.
Watermark detection test with multi-method verdict block.
Watermark verdictWatermark Detection POSITIVE (0.96) → WATERMARKED IMAGE.

03 · Training and failure

470,000 synthetic images taught the wrong lesson.

The first training path produced a large synthetic dataset, but the result overfit the generation process instead of generalizing to the faculty’s visual conditions. The valuable engineering move was recognizing the failure and changing the pipeline, rather than treating dataset size as progress.

470ksynthetic-image pivot

The experiment exposed a distribution problem. The final system leans on staged checks, targeted detectors, shared preprocessing, caching, and a review band instead of trusting one overfit classifier.

PhotoValidator resulting data flow, memory, and scalability architecture
What changed after the synthetic-data result?

The pipeline moved toward the signals that corresponded to the actual task: specification and border checks, watermark/text evidence, and multiple quality metrics. Shared preprocessing and loaded-once models reduced repeated work, while CPU fallback, graceful GPU handling, and heuristic paths kept the operator from losing an entire batch when one dependency was unavailable.

04 · Engineering judgment

The important decisions protect people and operators.

Compatibility

Patch the OCR boundary.

PaddleOCR wrote outputs in a path shape that conflicted with the rest of the pipeline. A runtime monkey patch normalized that boundary without rewriting the model.

Human-centered vision

Do not crop away identity.

A face/shoulder crop was abandoned because it could cut religious headwear and natural features. Validation should respect the person in the image.

Operations

Make review explicit.

Manual review is a first-class destination. The system can load once, process in parallel, fall back to CPU or heuristics, and leave a clear queue when confidence is not enough.

Operator surface

The TUI exposes batch queues, stage-level counters, flagged files, and a review path rather than hiding the pipeline behind a single progress bar.

queued → spec → border → text → quality
valid · invalid · manual review
Measured envelope

Recorded behavior includes 98–99% specification checks, 90–95% border detection, 93–96% watermark detection, 85–92% quality scoring, 200–400 images per minute, and a 5–10 second cold start.

models loaded once · shared preprocessing · graceful fallback

05 · Delivery

Production readiness is part of the case study.

The implementation was delivered with model memory controls, cache-aware execution, parallel processing, CPU/GPU fallback, reports, and the certificate above. The system is valuable because another operator can understand what it decided and what still needs attention.

What the deployment envelope includes

The documented footprint is approximately 800MB–1.5GB depending on the loaded models. The pipeline reports stage-level tallies, keeps review files separate, and supports a batch-oriented terminal flow. A valid/invalid decision is always accompanied by the underlying checks rather than presented as an unexplained confidence score.

06 · Complete record

Open the report when you want the whole build.

The page gives the visual and engineering story. The original local artifacts preserve the full documentation, certificate, and working demo.