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
Architecture
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.
| Build | Size | Speed | Note |
|---|---|---|---|
| Full precision | 1× | baseline | Reference accuracy |
| int8, every layer | ½ | n/a | Scores collapsed in the detection head |
| int8, convolutions only | ½ | ~3× faster on CPU | Within 1% of baseline |
| Neural engine (iOS) | ½ | real-time | Shipped on iOS |
| GPU delegate (Android) | ½ | fast | Shipped on Android |
| NNAPI (Android) | ½ | slowest measured | Dropped |
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.