OCR BIB — Race Bib Number Recognition
▶ Demo Available
ai

OCR BIB — Race Bib Number Recognition

Computer vision system that automatically recognizes and extracts bib numbers from race event photos using TensorFlow and OpenCV

Python TensorFlow OpenCV Flask PostgreSQL

The Problem

Race event photography generates thousands of images, and participants expect to find photos of themselves quickly. Traditionally, photographers or volunteers manually tag each photo with the bib numbers visible in it — a slow, error-prone process that can take days for a single event. For races with 10,000+ participants, this bottleneck means delayed photo delivery and frustrated runners.

The Solution

OCR BIB is an automated pipeline that takes raw event photos and extracts every visible bib number using computer vision. The system starts with image preprocessing — contrast enhancement, noise reduction, and perspective correction — to normalize photos taken under varying conditions. It then uses a custom-trained TensorFlow model to detect bib regions, followed by an OCR recognition stage that reads the numbers with high accuracy. Each recognized bib is stored in PostgreSQL, linking photos to participants instantly.

Architecture & Pipeline

The system is built as a Flask-based REST API that accepts batch uploads from photographers. Images flow through a multi-stage pipeline: ingestion, preprocessing, bib region detection (using a fine-tuned object detection model), number recognition (using a CRNN-based OCR model), and database indexing. The PostgreSQL backend stores photo metadata, detected bibs, and participant mappings, enabling fast lookup by bib number.

Challenges & Results

The biggest challenge was handling the sheer variety of race conditions — varying lighting, motion blur, partially obscured bibs, and non-standard bib designs. I addressed this with aggressive data augmentation during training and a confidence scoring system that flags uncertain reads for manual review. The final system achieves over 92% accuracy on clear bib detections and reduces the tagging workflow from days to hours, making it practical for real event use.