Store

No products in the cart.

TUTORIAL

Build a Retail Shelf Monitoring System with Edge AI

A hands-on guide for building a retail shelf monitoring prototype with the CamThink NE301, AI Tool Stack, local model training, MQTT alerts, and Home Assistant integration.

~16 min read Updated May 2026 Products: NE301 · NG4500 · NeoMind By Harry Hua

This tutorial walks through a working retail shelf monitoring prototype for out-of-stock detection. You will use an edge AI camera to capture shelf images, train a lightweight detection model, deploy it locally, and publish structured MQTT alerts when shelf gaps appear.

The goal is not to create a finished retail operations platform in one article. The goal is to build a reliable prototype-to-pilot workflow that system integrators, developers, and retail technology teams can validate on real shelf images before designing a larger deployment.

Scope of this build

This guide covers a single-shelf OOS detection prototype using NE301, AI Tool Stack, a YOLO-family model, MQTT alerts, and Home Assistant.

It does not include a ready-made SKU database, planogram compliance engine, retail task app, or ERP/WMS integration layer. Those belong to the pilot and production design phase.

What You Will Build

The prototype detects visible shelf gaps and publishes a structured event when fill level falls below a configured threshold.

Prototype Architecture · Single Shelf OOS Detection
1
NE301 Camera
Image capture · local inference
MQTT
2
Local Broker
Mosquitto · LAN event routing
Event
3
Home Assistant
Notification · dashboard · webhook
Next
4
Pilot Integration
ERP · WMS · task app

What You Need for the Prototype

Start with the minimum stack that lets you validate image quality, model performance, MQTT event delivery, and alert workflow. Add production hardware only after the pilot target is clear.

ItemWhy You Need ItPrototype Status
CamThink NE301Edge AI camera for image capture, local inference, and MQTT event output.Required
88° FOV lens moduleBalanced coverage for standard shelf sections, depending on mounting distance and shelf layout.Recommended
Adjustable shelf mountKeeps the camera position fixed while you tune angle and coverage.Required
USB-C power or PoEUSB-C is convenient for prototypes; PoE is preferred for stable wired deployments.Required
Docker hostRuns AI Tool Stack for collection, annotation, training, quantization, and deployment.Required
MQTT brokerReceives shelf gap events from the camera.Required
Home Assistant or Node-REDRoutes events to notifications, dashboards, or webhooks.Optional
NVIDIA GPUSpeeds up training, but small prototype datasets can be trained without it.Optional
Use this BOM for prototype planning. Production deployments require additional network, mounting, installation, data governance, and integration planning.

Step 1: Place the Camera for Consistent Shelf Images

Camera placement is the most important part of the build. Consistent images reduce false positives, improve model training, and make validation easier.

Choose the Right Lens

Use the lens that gives enough product detail for the task. Wider coverage is not always better because object detail decreases as coverage increases.

LensBest ForTrade-Off
51°Narrow sections, higher detail, SKU-level visibilityLower coverage per camera
88°Standard shelf-gap prototypes and OOS detectionBalanced detail and coverage
137°Wide end caps, overview shots, broad coverageLower per-product detail

Mounting Guidelines

  • Height: start near the middle shelf rail or the area that gives a stable front-facing view of the target products.
  • Distance: choose a distance that keeps the target products large enough for detection while covering the shelf section you care about.
  • Angle: keep the camera as straight-on as practical. Severe angles can distort product geometry and reduce detection reliability.
  • Lighting: avoid glare, hard shadows, reflective packaging, and changing light patterns across the shelf face.
Prototype Tip

Capture a few test images before training. If a human reviewer cannot clearly see products and gaps, the model will struggle too.

Step 2: Boot NE301 and Connect It to the Network

Use USB-C power for fast prototyping or NE301 PoE when you want stable wired power and network in a fixed setup.

NE301 first boot and Wi-Fi setup
# 1. Power up the NE301 with USB-C or PoE
  # 2. Hold the button for 2–3 seconds until the device AP appears
  # 3. Connect to the AP and open the default Web UI
  
  $ open http://192.168.10.10
  
  # 4. In Web UI → Settings → Network, add the store Wi-Fi SSID
  # 5. Reboot the device and find the assigned LAN IP
  # 6. Reopen Web UI at the assigned IP address

For fixed retail shelf pilots, NE301 PoE simplifies power and networking with one cable. For fast bench tests, NE301 Wi-Fi with USB-C power is easier to move.

Step 3: Collect Shelf Images with AI Tool Stack

CamThink AI Tool Stack supports the prototype workflow from data collection to model deployment. For a shelf monitoring build, your dataset should capture real product appearance, lighting variation, partial stock, empty gaps, and common edge cases.

AI Tool Stack Workflow
1
Collect
Bind NE301 · capture shelf images
2
Annotate
Product present · shelf gap
3
Train
YOLO-family model
4
Quantize
INT8 model package
5
Deploy
NE301 Web UI · OTA

Install AI Tool Stack

Install and start AI Tool Stack
# Prerequisites: Docker + Docker Compose v2.0+
  
  $ git clone https://github.com/camthink-ai/AIToolStack.git
  $ cd AIToolStack
  
  # Pull the NE301 model export environment
  $ docker pull camthink/ne301-dev:latest
  
  # Start local services
  $ docker compose up -d
  
  # Open the AI Tool Stack Web UI
  $ open http://localhost:8000

Capture a Useful Prototype Dataset

For a prototype, start with enough images to test feasibility. Before evaluating a pilot model, collect more images from the real deployment environment.

  • Fully stocked shelf images for the baseline state
  • Partial fill levels such as 75%, 50%, and 25%
  • Empty shelf gaps and near-empty states
  • Morning, midday, evening, and shadow conditions
  • Common occlusions, rotated labels, misplaced items, and reflective packaging
Dataset Recommendation

Use around 200 images for a useful prototype. Collect 300–400+ real shelf images before judging pilot readiness. Final requirements depend on product variety, lighting, shelf layout, and detection target.

Step 4: Train and Export a Shelf Gap Model

The simplest OOS prototype uses two classes: product_present and shelf_gap. The model detects visible product facings and empty areas, then threshold logic decides whether to publish an alert.

YOLO-family training example
# Example training command. Adjust epochs and dataset paths for your project.
  $ yolo detect train \
      data=shelf_gap.yaml \
      model=yolov8n.pt \
      epochs=100 \
      imgsz=256 \
      device=0          # use device=cpu if no GPU is available
Why 256 input size?

For NE301 deployment, lightweight models need to be optimized for the target NPU and memory constraints. Train and export with the target deployment format in mind, not only desktop training accuracy.

Export an INT8 model package for NE301
$ docker run --rm \
      -v "$(pwd)/runs/detect/train/weights:/workspace/weights" \
      -v "$(pwd)/export:/workspace/export" \
      camthink/ne301-dev:latest \
      yolo export \
          model=/workspace/weights/best.pt \
          format=tflite \
          imgsz=256 \
          int8=True \
          data=shelf_gap.yaml
  
  # AI Tool Stack wraps the model and configuration into a deployable package.

Step 5: Deploy the Model to NE301

Model deployment is handled through the NE301 Web UI. This makes it possible to update the detection model without reflashing firmware.

1
Open the NE301 Web UI

Use the device IP address assigned on your local network.

2
Upload the model package

Go to Application Management and upload the exported NE301 model package.

3
Apply and reboot

After applying the model, confirm that the live preview displays expected detections.

4
Validate on real shelf images

Check false positives and missed gaps before using the model in a pilot.

Example inference threshold configuration
{
    "model": "shelf_gap_v1_ne301",
    "confidence_min": 0.55,
    "nms_iou": 0.45,
    "alert_classes": ["shelf_gap"],
    "alert_threshold": {
      "shelf_gap": {
        "min_area_pct": 5,
        "fill_pct_alert": 30
      }
    },
    "inference_fps": 5
  }

Step 6: Publish MQTT Alerts

MQTT turns detection output into a usable system event. The camera publishes a structured payload when a shelf gap crosses the configured threshold.

Start a Local MQTT Broker

Run Mosquitto locally for a prototype
$ docker run -d \
      --name mosquitto \
      -p 1883:1883 \
      -p 9001:9001 \
      eclipse-mosquitto:latest
  
  # Subscribe to all topics to verify messages
  $ mosquitto_sub -h localhost -t "#" -v

Configure NE301 MQTT Output

  • Broker: local broker IP address on the same LAN
  • Port: 1883
  • Topic: shelf/aisle3-bay2/events
  • Publish mode: detection event, not continuous video
Example shelf gap MQTT payload
{
    "device_id": "NE301_A3F2C1",
    "shelf_id": "aisle3-bay2-left",
    "timestamp": "2026-05-12T09:47:12Z",
    "event": "shelf_gap_detected",
    "detections": [
      {
        "class": "shelf_gap",
        "confidence": 0.91,
        "bbox": [320, 140, 580, 390],
        "fill_pct": 14
      }
    ],
    "image_url": "http://192.168.1.45/snap/20260512_094712.jpg"
  }

Step 7: Route Alerts with Home Assistant

Home Assistant is useful for a prototype because it can subscribe to MQTT topics and create mobile notifications without building a custom application. For enterprise integration, the same MQTT event can later be routed through Node-RED or middleware to ERP, WMS, or task systems.

Home Assistant automation example
alias: "Shelf OOS Alert — Aisle 3"
  trigger:
    - platform: mqtt
      topic: "shelf/aisle3-bay2-left/events"
  condition:
    - condition: template
      value_template: "{{ trigger.payload_json.detections[0].fill_pct | int < 30 }}"
  action:
    - service: notify.mobile_app_store_phone
      data:
        title: "Low Stock Alert"
        message: >
          Aisle 3, Bay 2 Left is at
          {{ trigger.payload_json.detections[0].fill_pct }}% fill.
          Please check the shelf.
        data:
          image: "{{ trigger.payload_json.image_url }}"

Step 8: Validate Before You Scale

The first model is a baseline, not the final production model. Live shelf conditions expose edge cases that a training dataset may miss.

CheckFalse positives

Record alerts that fired incorrectly, such as packaging glare, shelf shadows, or rotated products.

CheckFalse negatives

Walk the shelf and capture missed gaps. Add these examples to the next training set.

TuneThresholds

Adjust confidence and fill-level thresholds based on real shelf behavior and response workflow.

PilotWorkflow

Measure whether alerts reach the right person or system in time to support replenishment.

Accuracy depends on the deployment

Detection quality depends on camera placement, image consistency, lighting, product category, model design, and training data. Validate against held-out images and live shelf conditions before expanding.

Going Further: From Prototype to Pilot Architecture

Once the single-shelf prototype is validated, you can expand the same workflow into a larger pilot. Scaling is mainly an architecture question: how many cameras, where inference runs, how events are routed, and who owns the downstream workflow.

ArchitectureTypical UseNotes
Distributed NE301 Cameras5–30 shelf sectionsEach camera runs local inference and publishes events to a shared broker.
NE301 + NG4500 HybridMulti-camera or enterprise pilotsNE301 handles first-pass detection; NG4500 can aggregate events and run heavier analysis.
NeoMind / Fleet LayerMulti-device managementUseful for device status, model update workflow, dashboards, and local management.
ERP/WMS IntegrationOperational rolloutRequires payload mapping, deduplication, routing logic, and task workflow design.

What CamThink Provides — and What You Still Need to Build

CamThink provides the edge AI hardware and development building blocks. A complete retail deployment also needs application logic, integration design, and operational workflow.

CamThinkProvides

  • NE301 edge AI camera hardware
  • NE301 PoE option for fixed deployments
  • AI Tool Stack workflow
  • Model deployment path
  • MQTT / HTTP output options
  • NG4500 edge compute for larger pilots
  • NeoMind device management options

Your TeamBuilds or Integrates

  • Retail task workflow
  • ERP / WMS integration layer
  • SKU or planogram reference data
  • Model validation dataset
  • Alert routing and escalation rules
  • Installation playbook and field checks

FAQ

Is this a complete production retail shelf monitoring system?

No. This guide builds a working prototype and pilot workflow. A production deployment also requires installation planning, monitoring rules, task workflows, ERP/WMS integration, model validation, and operational ownership.

Can I build this without deep AI experience?

You can build a prototype without writing model training code by using AI Tool Stack. You still need to understand dataset quality, annotation review, validation, and deployment-specific edge cases.

How many images do I need?

Use around 200 images for a useful prototype and collect more deployment-specific images before judging pilot readiness. The required dataset depends on product variety, lighting, shelf layout, and target accuracy.

Should I use NE301 Wi-Fi or NE301 PoE?

Use Wi-Fi with USB-C power for fast prototyping. Use NE301 PoE for fixed deployments that need stable wired power and network access.

Can this connect to ERP or WMS systems?

Yes, but usually through a middleware layer such as Node-RED, a custom service, or an existing integration platform. The MQTT event must be mapped to the target ERP/WMS or task system schema.

When should I add NG4500?

Add NG4500 when the pilot needs multi-camera aggregation, heavier models, planogram compliance analysis, local dashboards, or store-level integration logic beyond a single camera.

Conclusion

A retail shelf monitoring prototype should prove three things: the camera can capture consistent shelf images, the model can detect meaningful shelf gaps, and the alert event can reach the right downstream workflow.

NE301, AI Tool Stack, MQTT, and Home Assistant provide a practical starting point for that validation. Once the single-shelf build works, system integrators and developers can extend the same foundation into multi-camera pilots with NG4500, NeoMind, and ERP/WMS integration.

HH
CamThink Technical Director · 10+ Years Edge AI Solutions

Harry leads CamThink’s technical strategy and solution architecture, combining deep expertise in edge AI hardware, computer vision, and enterprise system integration.

Ready to Validate a Shelf Monitoring Pilot?

Tell us your shelf category, camera count, power/network conditions, and target integration workflow. We will help identify the right evaluation hardware and pilot architecture.