Zephyr: report the host reference label alongside the top-5 - #23353
Conversation
gen_input.py writes MV2_HOST_TOP1 and MV2_HOST_LABEL into mv2_input.h, but nothing reads them. The sample prints bare class IDs, so the output cannot be interpreted on target without an ImageNet label table. Print the recorded host prediction after the top-5 and state whether the device top-1 agrees, which turns the result into something readable: host float32 reference: class 258 (Samoyed) -> device top-1 MATCHES Guarded on both defines, so headers generated before this change still build. Costs no label table on target. Verified on an Alif Ensemble E8 DevKit (Cortex-M55 HP + Ethos-U55 256 MAC) with Zephyr 4.4.0 and Zephyr SDK 1.0.1, classifying a photograph prepared by gen_input.py. Authored with Claude.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23353
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 57a3ce8 with merge base 89809c4 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is correct, narrowly scoped, and backward compatible.
Review effort: Balanced
Findings: None
What changed in this PR
Adds readable host-reference output to the Zephyr MobileNetV2 sample.
Changes:
- Prints the host class ID and label after top-5 results.
- Reports whether device top-1 matches the host prediction.
- Preserves compatibility with older generated headers.
| File | Description |
|---|---|
zephyr/samples/mv2-ethosu/src/main.cpp |
Adds guarded host-reference reporting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gen_input.pywritesMV2_HOST_TOP1andMV2_HOST_LABELintomv2_input.h, but nothing reads them. The sample prints bare class IDs, so a reader cannot interpret the output on target without an ImageNet label table.This prints the recorded host prediction after the top-5 and states whether the device top-1 agrees:
Guarded on both defines, so headers generated before #23300 still build. No label table is added to the target; the single string already comes from the generated header.
Verification
Flashed and run on an Alif Ensemble E8 DevKit (Cortex-M55 HP at 400 MHz + Ethos-U55, 256 MAC) with Zephyr 4.4.0 and Zephyr SDK 1.0.1, using a photograph prepared by
gen_input.pyand an INT8 model calibrated on 250 ImageNet photos. Inference completed in 28 ms and the device top-1 matched the float32 torchvision reference.Flash cost is 160 bytes.
Authored with Claude.