The interview problem

Practice prompt

Design a camera-based shelf counting service that reports inventory estimates without treating occluded products as absent.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume fixed shelf cameras, known shelf polygons and a daily stock audit. Ingest timestamped frames, reject blur, detect visible instances and associate detections with shelf regions. Train with instance boxes plus visibility labels; split by store and capture day. Start with visible counts and an explicit unknown-occlusion state rather than inventing hidden stock. Persist frame, model version and evidence crops so staff can correct estimates. Evaluate count error per shelf and false empty-shelf alerts separately.

2. Trace the design or derivation

Frame quality gate
  → visible-instance detection
  → shelf association
  → temporal estimate
  → staff correction

Store visibility confidence independently from count confidence. A camera blocked by a cart should mark the shelf unobserved rather than carry yesterday's count as fresh. Staff corrections need a timestamp and evidence link so training can distinguish a detector mistake from a stock change that happened after capture.

3. Calculate the example

A shelf truly contains 20 visible products. The detector finds 18 and adds two false detections: reported count is 20 despite precision and recall both being 90%. Correct totals therefore do not prove correct localization.

4. Failure cases and trade-offs

Reflections duplicate boxes and restocking temporarily hides products. Temporal voting reduces flicker but delays updates; longer smoothing can retain removed stock. Periodic physical audits remain necessary for hidden depth. Separate uncertain shelves from zero-stock alerts.

5. Validation, follow-ups and self-review

Test glare, identical adjacent packages and camera movement using held-out stores. Follow-up: how would depth sensors change observability? Self-review: explain why count accuracy and instance quality both matter and how an unknown result reaches the user.

Sources and related practice

Technical reference: arxiv.org — Object detection from images; counting, tracking and road workflows are original applications, not paper benchmark claims.

Source publication/update: Submitted June 8, 2015; revised May 9, 2016. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Detect rare manufacturing defects from images; Track anonymous objects through a camera view.

Continue your preparation

Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.