Skip to content
All work
LiveCase study

Aadhaar Mask Detector

Upload an Aadhaar card image and get back a copy with the first eight digits of the number masked, so only the last four stay readable.

Role
Solo project: model integration, API, frontend, deployment
When
2026
Status
Live, with the API on Render and the web client on Vercel.
Aadhaar Shield upload screen with a drag-and-drop area for an Aadhaar card image

Context

The problem

Aadhaar cards are routinely shared as ID proof with the full 12-digit number exposed. Masking it by hand is slow and easy to get wrong.

Solution

What I built

A FastAPI service that runs a YOLOv8 model trained to find the number, masks it with OpenCV and returns the result to a drag-and-drop web client. The API is containerised with Docker and runs on Render; the frontend is on Vercel.

Architecture

How it fits together

  1. Browser
    Upload
    drag and drop · JPEG / PNG
  2. FastAPI
    POST /mask
    validation · CORS
  3. Detect & read
    YOLOv8
    imgsz 320 · conf 0.3
    Tesseract OCR
    date of birth · gender
  4. Mask & return
    OpenCV
    first 8 digits masked
    JSON response
    base64 image + fields
The masking pipeline, from upload to response.

Engineering

Key engineering work

  • Detection with YOLOv8 (Ultralytics on CPU PyTorch) at 320 px input and a 0.3 confidence threshold, sized for a CPU-only host.
  • Masking with OpenCV: the first eight digits are covered with the card's sampled background colour and replaced with XXXX XXXX, leaving the last four readable.
  • Tesseract OCR plus regex parsing to extract date of birth and gender from the card text.
  • FastAPI upload endpoint with CORS, invalid-image handling and a JSON response carrying the masked image as base64.
  • Deployment: Dockerfile and a Render blueprint (render.yaml) for the API; static frontend on Vercel.

Technology

Stack

  • Python
  • FastAPI
  • YOLOv8
  • PyTorch
  • OpenCV
  • Tesseract OCR
  • Docker
  • Render
  • Vercel
  • JavaScript

Status

Where it stands