Logo
Back to Projects

OCR KTP & NPWP API

AI-powered OCR REST API for Indonesian identity documents (KTP & NPWP), designed to run on NVIDIA Jetson edge devices as well as standard CPU servers. YOLOv8 detects field regions, EasyOCR extracts the text, and a Gemini-powered fallback with an active-learning data flywheel keeps improving accuracy toward a fully offline, self-hosted model.

Role

AI/ML Engineer

Client

PT Varnion Technology Semesta

Duration

Dec 2025 - Jan 2026

Tech Stack

Python,YOLOv8,Computer Vision,Edge AI
OCR KTP & NPWP API preview 1

Overview

Built as an internal tool at Varnion for extracting structured data (NIK, name, birth date, NPWP number, etc.) from photos of Indonesian ID cards and tax registration documents. The pipeline runs YOLOv8 to detect and crop individual field regions, then EasyOCR to extract text from each crop. When OCR confidence drops below threshold, a Gemini 2.0 Flash fallback corrects the reading — and every correction is automatically saved to an active-learning dataset, so the system keeps improving over time and is designed to eventually graduate to a fully offline, self-hosted Ollama model running on the Jetson hardware itself. A synthetic data generator (100% fake, no real personal data) and an auto-labeling tool round out the training pipeline.

Outcome

98%

extraction accuracy

2

document types supported

Challenges & Solutions

git log — ocr-ktp-npwp

Designi Designing a graceful LLM fallback that silently returns the original OCR result when Gemini fails or hits quota, instead of erroring out to the user.

AI/ML Engineer#ocr-ktp-npwp

Buildin Building a self-learning data flywheel — hard-to-read crops and LLM-corrected labels auto-saved for future fine-tuning of a fully offline Ollama model on Jetson.

AI/ML Engineer#ocr-ktp-npwp

Key Features

  • YOLOv8 Field Detection (NIK, Nama, NPWP, etc.)
  • EasyOCR Text Extraction per Field
  • LLM Fallback for Low-Confidence Results (Gemini → Ollama)
  • Active Learning: Auto-saves Hard Cases for Retraining
  • Synthetic Data Generator (Privacy-safe, No Real PII)
  • Multi-target Deployment: CPU Server & NVIDIA Jetson Edge GPU

Technologies Used

Backend

PythonFastAPIYOLOv8 (Ultralytics)EasyOCRGoogle Gemini 2.0 FlashOllama

Infrastructure

DockerNVIDIA JetsonCPU/GPU multi-target

NaraAI

Zidan's digital assistant, ask me anything.

Hi! I'm NaraAI, Zidan's personal assistant. What would you like to know about him?

Deployed
⚡ AVIF/WebP