Multi-Layered AI Document Verification System

In an era of rising digital fraud and high-quality AI-generated forgeries, standard data extraction (OCR) is no longer sufficient. This project offers a comprehensive solution for automated identity document authentication (using the Spanish DNI as a model), combining classic validation algorithms with advanced digital forensic methods.

🏆 Hackathon Winner (1st Place)

FacePhi Challenge 2026, FacePhi

How it works

1. Structural & Geographic Verification (Layer 1)

ISO Region Validation: Confirmation that issuing state and nationality codes match the ISO 3166-1 “ESP” standard

MRZ & ICAO Analysis: Full validation of the Machine Readable Zone against international format standards.

CAN Format Integrity: Verification of the 6-digit Card Access Number found on the front of the ID.

2. Logical Data Integrity (Layer 2)

Visual-MRZ Synchronization: Cross-referencing data fields between the visual zone and the MRZ, including support number, nationality, birth date, and expiry.

Mathematical Logic (Module 23): Verification of the DNI control letter using the official Spanish Ministry of the Interior algorithm.

Temporal Logic & Renewal: Calculation of the holder’s age to ensure the document’s validity period (5, 10 years, or permanent) matches Spanish legal requirements.

3. Digital Forensics & Manipulation Analysis (Layer 3)

ELA (Error Level Analysis): Detecting digital tampering by re-saving images and analyzing pixel-level changes to identify edited areas, such as photos replaced via design software.

FFT (Frequency Analysis): Utilizing Fast Fourier Transform to detect screen grids, identifying if a photo was taken of a screen or is AI-generated.

Texture Verification: Measuring spatial sharpness and micro-textures to distinguish between natural photos and suspicious, overly uniform images.

EXIF Metadata Analysis: Identifying traces of editing software, stripped metadata, or hardware inconsistencies between the front and back images.

Key Features

  • Ensemble OCR Strategy: Implements a triple-filter approach (Balanced, Sharpness, and Contrast) to maximize resolution and accuracy even in poor lighting or blurry conditions.
  • Specimen Trap: The system includes internal checksum logic to identify and block common online templates and “Specimen” documents.
  • Orchestrator & Final Scoring: An intelligent engine weights the results of every module to deliver a final fraud verdict with a calculated confidence level.

“The best way to fight fraud is to not let it happen”

This project IS open source