Skip to main content

Engineering Guide

This page is for implementation and integration engineers, covering the full path from model setup, Agent configuration, dashboard and Webhook integration to prompt customization and daily operations. For the solution positioning and business value, see the Solution Description.

1. Scenarios​

The core action: place a waybill in the camera's view, and the fields land in your system.

ScenarioObjectsTypical use
Parcel stations / warehouse in-outWaybillsTracking number, carrier, weight into the system automatically
Finance / customer serviceWaybills, receiptsReceiver and contact-phone search and reconciliation
Any "image → structured fields" entryVarious documentsReplaces manual photo-reading entry

Not a fit: you need the full text with text-box coordinates (use the PP-OCR pipeline of the Document Recognition solution — complementary to this one); or the layout is extremely messy and fields must be 100% accurate (small vision models have field-level errors — keep a manual-review channel).

Extraction scope: the 12 fields of the sample configuration (customizable)​

The sample configuration extracts the following 12 waybill fields (using the DPD waybill from our validation as the example; the field list is customizable — see 5.3), each written back as a device virtual metric virtual.ocr.<field>:

FieldVirtual metricMeaningReference value on the sample waybill
tracking_novirtual.ocr.tracking_noTracking number (the 4 digit groups by the barcode)1550 1804 9197 451
referencevirtual.ocr.referenceReference number (Ref line, usually 8 digits)10448206
carriervirtual.ocr.carrierCarrier brandDPD
servicevirtual.ocr.serviceService typeNEXT DAY SERVICE
weightvirtual.ocr.weightTotal weight10 kg
postcodevirtual.ocr.postcodePostcodeGB-NN11 8LR
ship_datevirtual.ocr.ship_dateShip date and time21/08/19 04:10
receiver_namevirtual.ocr.receiver_nameReceiver nameAmazon Fulfillment Center
receiver_addressvirtual.ocr.receiver_addressFull receiver address (joined to one line)Unit A Daventry Distribution Center, Yoyal Oak Way N, Daventry, United Kingdom
contact_namevirtual.ocr.contact_nameContact block person/companyDPD GROUP LTD
contact_addressvirtual.ocr.contact_addressContact block addressRoebuck Lane, BIRMINGHAM, B66 1BY
contact_phonevirtual.ocr.contact_phoneContact block phone0121 500 2500

Fields not visible on the current waybill are written as null or skipped. To add/remove fields or switch to another document type, edit the prompt and field list only (see 5.3).

2. Components (BOM)​

#ItemModel / SpecQtyPurpose
1NE302 camera38 × 38 mm mini AI camera, white fill-light LED1 per pointWaybill capture, image upload
2Solution firmwareNE302 Docsnap branch firmware (download ne302_App_signed_*_pkg.bin) + DocAligner model package (download); upgrade steps in Document Recognition 4.11 setOn-device document detection, "place and shoot"
3NeoMind hostNG4500 AI Box / server / PC with GPU memory reserved for MiniCPM-V-4.7-1B (built-in catalog)1 setDevice access, Agent recognition, field write-back, dashboard, Webhook

Recognition is done by the vision-language model on the NeoMind host — no extra camera-side model is needed for it; the DocAligner package only provides the on-device "place and shoot" detection trigger.

3. Topology​

General requirements:

  • MQTT reachability between camera and NeoMind host; the built-in broker works out of the box (configured on the camera's Data Transmission page)
  • Images above 1 MiB are chunked by the camera and reassembled by the platform — no extra setup
  • GPU memory on the NeoMind host must fit the vision model (it can co-exist with the main engine; if memory is squeezed out the recognition service stops — see section 6)

4. Setup​

Complete the setup in six steps, mapped to subsections 4.1–4.6:

  1. Confirm the MiniCPM vision model is enabled
  2. Register the NE302 device
  3. Create the waybill recognition Agent
  4. Verify recognition and write-back
  5. Configure the dashboard field cards
  6. Configure the Webhook push

Note: the tool policy, prompt, 12-field list, dashboard cards and Webhook subscriptions below target the DPD test waybill used to validate this solution — they are a sample configuration. When replicating, adapt the prompt and field list to your own document type and business fields (see 5.3); every other step stays the same.

4.1 Confirm the MiniCPM vision model is enabled​

  1. Top-right Settings → LLM Backends: the currently enabled built-in model shows as a card — confirm MiniCPM-V-4.7-1B is there (in our environment it runs as the Vision companion next to the main engine, carried by the llama.cpp CUDA runtime)
  2. If not enabled: click Switch Model and pick the MiniCPM vision model from the built-in catalog — it downloads automatically on first use, no API key, fully offline
  3. Once enabled, the model appears in the Model dropdown of the AI Agent editor

About MiniCPM: MiniCPM is an end-side LLM series open-sourced by OpenBMB (the open-source organization built by ModelBest together with Tsinghua University's NLP lab), focused on delivering strong performance at small parameter sizes; MiniCPM-V is its multimodal branch, positioned for on-device image understanding with an emphasis on OCR and document capabilities. MiniCPM-V-4.7-1B in the NeoMind built-in catalog belongs to this series — in this solution it runs locally on the NeoMind host through the llama.cpp runtime, with no API key required. Open-source repo: OpenBMB/MiniCPM

LLM Backends: built-in model catalog and vision model runtime state

Settings → LLM Backends: MiniCPM-V-4.7-1B running as the vision companion (llama.cpp CUDA runtime), selectable in the Agent's Model dropdown

4.2 Register the NE302 device​

Identical to the Document Recognition solution: point the camera's Data Transmission page at the NeoMind host (built-in broker, port 1883), then add a ne302_camera device on the platform with the same device ID as the camera. Afterwards place a waybill — the device detail page should show an image_data metric update.

4.3 Create the waybill recognition Agent​

Platform navigation AI Agents → Create AI Agent, then work through the three form sections:

Left sidebar · basics:

  • Name: e.g. NE302-OCR
  • Model: pick MiniCPM-V-4.7-1B (badged Vision) from the dropdown

1. Mission & Data Sources:

  • Mission (the prompt): paste the waybill extraction prompt at the end of this section, replacing the device ID 20006C in the write-back command with your own device ID
  • Sources → Add Data Source: add the device NE302's image_data metric (freshness policy Any · Report stale)

2. Actions & Output:

  • Model tools: pick Scoped allowlist and check shell — the Agent needs it to write fields back to the device
  • JSON fields: switch on, then add the 12 fields one by one (name + description; the description is injected into the prompt to guide recognition — see the field list below)
  • Publish as platform data sources: keep off (fields land on device metrics via write-metric; the Agent's ai: data sources are not rendered by dashboard components)

3. Schedule, Guardrails & Notifications:

  • Trigger type Event, event source device NE302 (fires on image_data updates)
  • Failure breaker: 3 (auto circuit-break after consecutive failures)
  • Notify: enable On failure as needed

Click Save agent; use Dry run to test one execution without saving first.

Agent edit form (stitched): top — mission prompt, data source, tool policy and the 12 fields; bottom — event trigger, guardrails and notifications

Edit Agent form (two segments stitched, the duplicated field list kept once): top — Model set to MiniCPM-V-4.7-1B, Model tools set to Scoped allowlist with shell checked, JSON fields on with 12 fields defined; bottom — trigger type Event, source device NE302 checked, Failure breaker at 3, notifications as needed

The full prompt (paste into Mission, replace the device ID; the prompt targets the DPD test waybill from our validation — adapt its fields and self-check rules to your own document type, see 5.3):

You are a parcel waybill information extraction engine. Extract every specified field from the waybill image reported by the device.

Requirements:
1. Search each field actively. Pay special attention to the Contact block (contact name, address, phone), Total Weight, and package count.
2. For the reference field, take the number on the same line as the Ref label or on the immediately following line. It is usually 8 digits and must NOT be a tracking number.
3. Field values must use the literal text printed in the image. If a field is not visible, return null for it.
4. Output JSON only, with exactly the specified keys.

MANDATORY self-check. Before producing the final JSON, verify each of these and fix the value if it fails:
- tracking_no: the Track number is printed as 4 groups of 4 digits (e.g. 1550 1804 9197 451), usually right above or below the barcode. Take ONLY those 4 groups. Never append the Ref number. Never repeat groups. Never drop the leading group.
- reference: must be the short number on the Ref line (usually 8 digits). Never a tracking number. Never 13+ digits.
- contact_name: must be the carrier company printed inside the Contact block (e.g. DPD GROUP LTD). Never the receiver name (e.g. Amazon).
- contact_address: must be the street/city/postcode lines inside the Contact block (e.g. Roebuck Lane, BIRMINGHAM, B66 1BY). Never the receiver address. Never placeholder digits such as 0000000000 or 3000000000.
- contact_phone: must be the real phone printed after Phone in the Contact block (e.g. 0121 500 2500). Never placeholder digits such as 00000000.
- receiver_address: must be the FULL multi-line address of the receiver/consignee, joined into one line with a comma and space. Never truncate it to a single word.

AFTER you finish extracting, persist EVERY non-null field to the device by calling the shell tool once per field. The command form is:

neomind device write-metric 20006C --metric virtual.ocr.<NAME> --value '<VALUE>'

CRITICAL quoting rule: wrap the value in SINGLE quotes so that spaces are preserved. The value itself must NOT contain any quotes inside.
Correct: --value 'DPD'
Correct: --value 'Unit A Daventry Distribution Center, Yoyal Oak Way N, Daventry, United Kingdom'
WRONG: --value '"DPD"'
WRONG: --value Unit A Daventry Distribution Center (unquoted: gets truncated at the first space)

Write these 12 metrics, one shell call each (skip any field whose value is null):
virtual.ocr.tracking_no, virtual.ocr.reference, virtual.ocr.carrier, virtual.ocr.service, virtual.ocr.weight, virtual.ocr.postcode, virtual.ocr.ship_date, virtual.ocr.receiver_name, virtual.ocr.receiver_address, virtual.ocr.contact_name, virtual.ocr.contact_address, virtual.ocr.contact_phone

Rules for the shell calls:
- Keep each value on ONE line. Replace any newline inside a value with a comma and space.
- Always wrap the value in single quotes.
- If a value itself contains a single quote, replace that inner quote with a space.
- Do not stop until all non-null fields have been written.

Three hard rules in the prompt (keep them when editing): ① each field is written back by calling neomind device write-metric <device-id> --metric virtual.ocr.<field> --value '<value>'; ② values are wrapped in single quotes — an unquoted value with spaces gets truncated to its first letter; ③ values contain no quotes, and newlines become "comma + space".

JSON fields list (sample fields; field name + description, descriptions are verbatim English and injected into the prompt):

FieldDescription
tracking_noFull tracking number next to the Track label, all 4 digit groups complete including any leading group, e.g. 1550 1804 9197 451
referenceNumber on the same line as the Ref label or on the immediately following line (usually 8 digits, e.g. 10448206)
carrierCarrier brand name, e.g. DPD
serviceService type, e.g. NEXT DAY SERVICE
weightTotal weight shown next to Total Weight, e.g. 10 kg
postcodePostcode, e.g. GB-NN11 8LR
ship_dateShip date and time, e.g. 21/08/19 04:10
receiver_nameReceiver name, the first line of the upper block on the waybill, e.g. Amazon Fulfillment Center
receiver_addressFull receiver address including every street line and the city, postcode and country, joined with commas, e.g. Unit A Daventry Distribution Center, Yoyal Oak Way N, Daventry, United Kingdom
contact_nameContact person or company name in the Contact block, e.g. DPD GROUP LTD
contact_addressFull address in the Contact block, including street, city and postcode, e.g. Roebuck Lane, BIRMINGHAM, B66 1BY
contact_phonePhone number following Phone in the Contact block, e.g. 0121 500 2500

4.4 Verify recognition and write-back​

  1. Place a waybill in the camera's view (or click Command Control → Capture on the device detail page for a manual capture)
  2. AI Agents → open the Agent → History: a new execution should appear with 12 consecutive shell tool calls
  3. Device detail → Real-time Metrics: the virtual.ocr.* metrics appear with Virtual badges, values showing the latest recognition

Agent detail: execution stats, the latest recognition result and the 12 output fields

Agent detail Overview: execution stats (103 executions, 28 s average) and the 12 output-field values of the latest run

Device detail: virtual.ocr.* field metrics alongside native device metrics

Device detail page: the 12 virtual.ocr. fields (badged Virtual) shown alongside image_data and the on-device detection result*

4.5 Configure the dashboard field cards​

  1. Visual Dashboard → New Dashboard, named e.g. NE302-Waybill-OCR
  2. Add 12 value cards from the component library, each bound to one of the device NE302's virtual.ocr.* metrics (data source type device metric, read mode latest; the cards mirror the sample fields one-to-one and follow any field-list changes)
  3. Binding note: the data source must be a device metric — the Agent's ai: data source has values on the backend but is not rendered by frontend components, so binding it shows a blank card
  4. Save, then place a waybill: the card values refresh with every capture

4.6 Configure the Webhook push​

  1. Data Explorer → Data Push → Create Target
  2. Target Type = Webhook, enter the business system's Webhook URL; Schedule = Event-driven; data scope as source patterns — for per-field subscription list each one, e.g. device:<device-id>:virtual.ocr.carrier, device:<device-id>:virtual.ocr.tracking_no, etc.
  3. Configure retries and batching as needed (sample: 3 retries with exponential backoff); save and start
  4. Place a waybill — the business endpoint should receive a push shaped like this (one per subscribed field):
{
"source_id": "device:20006C:virtual.ocr.carrier",
"value": "DPD",
"timestamp": 1796127154
}

Push status and the delivery log are visible in the target list.

Data Push: the webhook target running, event-driven, subscribed to waybill fields

Data Explorer → Data Push: the ne302-ocr-webhook-test target Running, Event-driven, subscribed to virtual.ocr. fields*

4.7 End-to-end verification​

All four checks passing completes site acceptance:

  1. Trigger: place a waybill → a new execution appears in the Agent's History with 12 shell calls
  2. Write-back: the device detail's virtual.ocr.* metrics all update
  3. Dashboard refresh: the 12 cards show the latest field values
  4. Push arrival: the business Webhook receives the field pushes

5. Data Integration​

5.1 Field semantics​

  • One virtual metric per field, string type; values are the literal text from the waybill, long addresses joined to one line (comma + space)
  • Fields not visible on the current waybill are recorded as null in the recognition result but not written back — the device metric keeps the previous capture's value; compare the metric timestamp against the capture time instead of treating a non-empty value as "this waybill has this field"
  • Accuracy must be validated on site: dense digit regions (segmented tracking numbers) are a known weakness of small vision models; keep manual review for business-critical fields

5.2 Webhook consumption advice​

  • One push per subscribed field; source_id identifies the source field (e.g. device:20006C:virtual.ocr.carrier) — route records into your system by it
  • One capture triggers several pushes; deduplicate on source_id + timestamp
  • To receive all fields of one capture, widen the subscription pattern to device:<device-id>:virtual.ocr.* — one capture then pushes several messages (one per field), and the business side aggregates them into a single record by timestamp

5.3 Prompt customization guide​

  • Add/remove fields: change two places in sync — the write-metric metric list at the end of the Mission, and the JSON fields list in Actions & Output (names and descriptions)
  • Switch document type: rewrite the extraction and self-check rules; "correct value / wrong value" contrast examples in descriptions work best
  • The three value-format rules (single-quote wrapping, no quotes inside values, one line) are already in the prompt — do not remove them, or values with spaces get truncated to their first letter

6. Daily Operations​

Symptom / taskHandling
Dashboard cards blankCard data sources must be device metrics; binding the Agent's ai: data source is not rendered by frontend components
Field value truncated to first letterThe write-back command's value was not wrapped in single quotes (spaces truncated); check the prompt's quoting rule is unchanged
Field value has extra quotesThe model added an extra layer of quotes; confirm the "no quotes inside values" rule is still in the prompt and run once more
Agent not triggeringEdit Agent → section 3: confirm the trigger type is Event and the source device is checked; consecutive failures trip the Failure breaker — investigate the failure cause first (see the row above), then resume the agent
Recognition timeout / execution failedSettings → LLM Backends: confirm the model is Running; if GPU memory was squeezed out the service stops — reserve memory and re-activate
tracking_no missing groups / mixedDense digit regions are a known weakness of small vision models: improve angle and fill light, or strengthen that field's self-check description in the prompt; if still short, evaluate a larger model
Fields persistently nullThe field is not visible on the current waybill — normal; if persistently null, check shooting distance and the waybill's share of the frame
Change fields / document typeSee 5.3 prompt customization guide

7. Performance & Specs​

MetricValue
Input imageNE302 capture (1280 × 720 JPEG)
Recognition modelMiniCPM-V-4.7-1B (built-in vision model, llama.cpp CUDA runtime, local inference, no API key)
Execution duration~28 s average measured (12 field extractions + 12 write-backs; validate on site)
Execution success rate98% in our validation environment (103 executions, 101 succeeded)
Field-level accuracyMost fields stable; dense digit regions (segmented tracking numbers) have known errors — validate on site
TriggerEvent-driven (image_data updates); Dry run for manual test execution
Data retentionField virtual metrics go to the device time-series store; retention per platform data-management settings

8. Support​

Learn More​