Skip to content

Fix IoT engine integration and add edge inference support#903

Merged
KishanFW merged 3 commits into
mainfrom
EE/RM/iot-engine-integration
May 16, 2026
Merged

Fix IoT engine integration and add edge inference support#903
KishanFW merged 3 commits into
mainfrom
EE/RM/iot-engine-integration

Conversation

@mraula
Copy link
Copy Markdown
Collaborator

@mraula mraula commented May 13, 2026

Summary

  • Added IoT edge inference — new iot_edge_client.py runs the EfficientNetV2 TFLite model directly on the Raspberry Pi and publishes only the prediction result over MQTT (no audio transmitted). Engine updated to handle both raw-audio and edge-prediction payloads on the same topic.

Changes

File What changed
Engine.Dockerfile Deploy echo_engine_iot.py as echo_engine.py
Engine/requirements.txt Add scikit-learn
echo_engine.json Add API_URL field (was hardcoded)
echo_engine_iot.py Add _handle_edge_prediction(), route on payload["type"], fix duplicate import
test_iot_integration.py Fix import so tests run locally
light_echo_engine.json Fix MQTT broker hostname
IoT/edge_inference/iot_edge_client.py New — RPi edge inference script
IoT/edge_inference/requirements.txt New — RPi deps (tflite-runtime, librosa, sounddevice)
IoT/edge_inference/README.md New — deployment guide

Architecture change

Before: RPi → raw audio (~500 KB/clip) → MQTT → Engine runs model → API

After (edge mode): RPi → prediction only (~300 bytes) → MQTT → Engine forwards → API

Both modes work simultaneously on the same MQTT topic.

mraula and others added 3 commits May 14, 2026 01:08
Engine fixes:
- Engine.Dockerfile: deploy echo_engine_iot.py as echo_engine.py so
  the IoT engine actually runs in Docker
- Engine/requirements.txt: add scikit-learn (imported but missing)
- echo_engine.json: add API_URL field to replace hardcoded endpoint
- echo_engine_iot.py: read API URL from config, remove duplicate import,
  add _handle_edge_prediction() for edge devices, route on payload type
- test_iot_integration.py: fix import so unit tests run locally

Light engine MQTT fix:
- light_echo_engine.json: correct MQTT_CLIENT_URL from mqtt-broker to
  ts-mqtt-server-cont, fixing DNS resolution error on startup
- torch_impl/requirements.txt: add paho-mqtt==1.6.1, pymongo, geopy,
  google-cloud-storage (all imported but missing)

Edge inference (new):
- IoT/edge_inference/iot_edge_client.py: RPi script that records audio,
  runs EfficientNetV2 TFLite on-device, publishes only prediction result
  over MQTT (no audio transmitted)
- IoT/edge_inference/requirements.txt: RPi deps
- IoT/edge_inference/README.md: deployment guide
Signed-off-by: mraula <96328895+mraula@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@KishanFW KishanFW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is good

Copy link
Copy Markdown
Collaborator

@KishanFW KishanFW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everythig is good

@KishanFW KishanFW merged commit ac4f142 into main May 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants