Naveed Ali
‹ All work

Vision · retrieval · on-device

Shelf intelligence that runs on a phone in the aisle

A retail AI company needed to know which product sits where, what is missing and what the tag says, from a walk-through scan. I owned model training, on-device export and product identification.

Role
AI/ML Engineer
Period
2026
Team
Small team
2×smaller model after quantisation
Real-timeinference on the phone, no server per frame
Zeroretraining runs when a new product arrives
Within 1%of full-precision detection accuracy

This work was done for a client under confidentiality. Client names and internal tooling are not shown.

The problem

Retail audits are manual. Someone walks an aisle with a clipboard and records gaps, misplaced products and wrong prices. The goal was to get the same record from a phone scan, accurate enough to act on and cheap enough to run in every store.

Three sub-problems, each with its own failure mode: where the shelves and products are, which specific SKU each detection is, and what the price tag next to it reads.

Constraints

HardwareInference runs on the phone doing the scan, on iOS, Android or a CPU fallback.
Catalogue churnNew SKUs appear constantly. Retraining a classifier for each one was never going to hold.
SceneDense, cluttered shelves. Small objects, heavy occlusion, near-identical packaging.
Accuracy floorA wrong "out of stock" costs the retailer a truck roll. The system abstains when it is unsure.

Architecture

Scan frames
Rotated-box detector
Embeddings → gallerynew product = insert
Multi-view tag readingtwo views must agree
Report
Detection is the source of truth. Identity and price are independent branches that can each abstain. Hover a stage to trace it.

Product identity as retrieval

A classifier would need retraining every time the catalogue moved. Here each crop becomes an embedding matched against a gallery, so adding a new SKU means adding it to the gallery, with no retraining. A fixed crop-preprocessing contract keeps query and gallery embeddings comparable, which is the detail that breaks this kind of system.

Shortlisting combines embedding similarity with text search, then a reranking step picks the winner. Each stage can abstain, which keeps a wrong answer from passing as a confident one.

Getting it onto the device

Three export targets: iOS, Android and a cross-platform CPU path. Each one failed differently before it worked.

BuildSizeSpeedNote
Full precision1×baselineReference accuracy
int8, every layer½n/aScores collapsed in the detection head
int8, convolutions only½~3× faster on CPUWithin 1% of baseline
Neural engine (iOS)½real-timeShipped on iOS
GPU delegate (Android)½fastShipped on Android
NNAPI (Android)½slowest measuredDropped

What broke

Quantising the detection head killed the scores

Full int8 collapsed confidence outputs. Restricting quantisation to convolution layers kept the size and speed win while leaving the head in higher precision.

The obvious Android accelerator was the slow one

NNAPI measured well behind the plain GPU delegate, so it was dropped without further tuning.

Query and gallery crops drifted apart

Embedding retrieval only works if the crop fed at query time matches how the gallery was built. Without a fixed preprocessing contract the similarity scores degrade silently. Nothing errors and the results slowly get worse.

Where it landed

The identification path shipped as retrieval, so catalogue changes stopped requiring training runs. On-device inference made scanning viable without server cost per frame.

The specifics (models, thresholds, evaluation sets) stay with the client. Happy to talk through the approach in more depth.

Have a project in mind? Let’s talk.

Open to contract and full-time work. Based in Lahore, working with teams in the UK, EU and US.