Detailed Work Report: February 20, 2026**

1. Core Architectural Shift

  • Infrastructure Design: Initiated the transition to a dedicated FastAPI backend for the validation service, moving away from a single-script prototype.

  • Compute Optimization: Performed a “Sanity Check” on the compute requirements, deciding to proceed with CPU-based inference rather than TPU. MediaPipe, ONNX, and CLIP embeddings were determined to run efficiently on standard CPU architectures for this stage.

  • Endpoint Planning: Defined the structure for four primary production endpoints: validate, capture, analyse, and admin.

2. Validation Engine Development (Validator Class)

  • Advanced Landmarks Integration: Integrated the MediaPipe Face Landmarker (face_landmarks_detector.task) to utilize a 468-point facial mesh for high-precision geometry analysis.

  • Geometric Algorithm Implementation:
  • Eye Aspect Ratio (EAR): Implemented the EAR formula to detect eye state (open/closed) with a standard threshold of 0.2.

  • Smile Detection: Developed a geometry-based smile detector using a mouth-to-face width ratio with a defined threshold of 0.4.

  • Accessory Detection:
  • Hat/Headgear: Loaded an ONNX neural network (hat_beard_model.onnx) for headwear detection, implementing confidence scoring with a 40% threshold.

  • Glasses: Integrated the GlassesClassifier for automated eyewear detection.

3. Production Readiness & Logic Optimization

  • Early Return Optimization: Refined the validation pipeline to use a “Fail-Fast” strategy. The service now rejects invalid images (e.g., non-square aspect ratios or multiple faces) immediately to save computational resources.

  • Model Loading Pattern: Established a “Load-Once” singleton pattern, ensuring all ML models are loaded into memory during the application’s startup phase rather than per request, drastically reducing latency.

  • Structured Error Responses: Designed a production-grade response schema that returns specific failure codes (e.g., MULTIPLE_FACES, NOT_SQUARE) and detailed metrics instead of simple booleans.

4. Project Standardization

  • Naming: Rebranded the validation microservice as FaceGate API (or Anana Validate Engine) to reflect its role as a strict gatekeeper for the platform.

  • Directory Structure: Defined a scalable, professional folder structure (app/core/, app/api/, app/services/) to maintain modularity between routing, business logic, and ML model management.

Project Status: The validation logic is fully audited and optimized for CPU deployment on Railway, with all key biometric thresholds calibrated for production use.


Day 16 - February 20, 2026

Project: FaceGate API / Anana Validate Engine

Status: Validation logic fully audited and optimized for CPU deployment on Railway.


1. Core Architectural Shift

  • Transitioned to a dedicated FastAPI backend for the validation service, moving away from a single-script prototype.
  • Optimized compute requirements, confirming CPU-based inference is sufficient for MediaPipe, ONNX, and CLIP embeddings.
  • Planned four primary production endpoints: validate, capture, analyse, and admin.

2. Validation Engine Development

  • Integrated MediaPipe Face Landmarker (face_landmarks_detector.task) for high-precision 468-point facial mesh analysis.
  • Implemented geometric algorithms:
    • Eye Aspect Ratio (EAR) for eye state detection (threshold: 0.2).
    • Smile detection using mouth-to-face width ratio (threshold: 0.4).
  • Accessory detection:
    • ONNX neural network (hat_beard_model.onnx) for headwear detection (confidence threshold: 40%).
    • GlassesClassifier for automated eyewear detection.

3. Production Readiness & Logic Optimization

  • Refined validation pipeline with a Fail-Fast strategy, immediately rejecting invalid images to save resources.
  • Established a Load-Once singleton pattern for model loading, reducing latency by loading all ML models at startup.
  • Designed structured error responses with specific failure codes (e.g., MULTIPLE_FACES, NOT_SQUARE) and detailed metrics.

4. Project Standardization

  • Rebranded the microservice as FaceGate API (Anana Validate Engine) to reflect its gatekeeper role.
  • Defined a scalable folder structure (app/core/, app/api/, app/services/) for modularity between routing, business logic, and ML model management.

Summary: Validation logic is fully audited, optimized for CPU deployment, and all key biometric thresholds are calibrated for production use.


This site uses Just the Docs, a documentation theme for Jekyll.