What it is
TrueLabel is a camera scanner for product labels. You photograph a packet, and it tells you two things.
Is it expired? It looks for the words that sit beside a date that matters - EXP, BEST BEFORE, USE BY - and parses whatever format the printer chose: 03/2026, MAR 2027, 2027-05, 03/27, 15/06/2027. Then it tells you how many months ago, or how many months left.
Is the label honest? Nigerian packaged food is supposed to carry six things: a NAFDAC registration number, a batch or lot number, a manufacturer, ingredients, a net weight, and a way to contact whoever made it. TrueLabel checks for all six and reports which ones it could not find.
It shows the photo back to you with a box drawn around every line it read, so nothing is hidden.
Inspiration
Nigeria has a well-known problem with expired and badly labelled goods on the shelf. Everyone has a story about buying something that was already bad. The check that catches it takes two seconds - read the date on the pack - and almost nobody does it, because the date is printed in a font designed to be tiny.
Every tool that could help assumes a few things at once: a good data connection, a paid API key, an account. That is exactly what a trader with a phone and no data does not have. So I set out to build the version that works with the Wi-Fi off.
How I built it
The first decision was the one everything else depended on. I tested Apple's Vision framework, which ships inside macOS, and found it gives 1,303 image categories, text recognition, and barcode reading, running locally on the Neural Engine. No download, no key, no network. That made the offline promise possible, so I wrote everything else around it.
The result is a pipeline in three languages, each doing the job it is best at:
engine/main.swift- Swift, because that is where Vision lives. It reads the image and prints structured JSON: every line of text with its confidence and its position.analysis.py- Python, because it is the clearest place for reasoning. It parses dates out of messy OCR text, works out what the date means against today, and checks the six label requirements.server.pyandstatic/- a local web app, because a verdict should look like a verdict. Standard library only, nopip install.
Challenges
The hard part was not reading the text. Vision does that almost perfectly. The hard part was deciding what the text means.
03/2026has no day, so it means the end of March - not the start, and not the 3rd of some month.03/27could be a date or a batch code.- A label can carry three dates and only one of them is the expiry.
- A date found by accident is not the same as a date you were told. TrueLabel tracks the difference and says which one it has.
Three real bugs came out of testing, and each one changed the design:
- The scanner reported the expiry date
04/2027as a NAFDAC licence number, because it searched the whole label for anything shaped like a registration number. A number now only counts if it sits beside the NAFDAC mark. A tool like this is worthless if it invents confidence. - The built-in image classifier answered "document" with 48% confidence on a test label. That told me to build the product around reading the label rather than guessing the object, and that turned out to be the right call for the whole idea.
- A photograph taken in the dark produced an empty label, and the app blamed the product. It now measures the photo's brightness and says "too dark to read" instead, because the product may be perfectly fine - we simply could not see it.
What I learned
That honesty is a feature. Everywhere the scanner could have guessed, I made it say what it actually saw: "could not read" instead of "missing", and "this might be a production date" instead of a confident wrong answer.
What is next
Yoruba, Igbo and Hausa verdicts. Reading the same label twice from different angles and merging the results, so a glare stripe stops mattering. And shop-level memory, so a seller can scan a shelf rather than one pack at a time.
Built With
- accessibility
- barcode-scanner
- css
- html
- http-server
- javascript
- machine-learning
- macos
- ocr
- python
- swift
Log in or sign up for Devpost to join the conversation.