Fix IoT engine integration and add edge inference support#903
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iot_edge_client.pyruns 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
Engine.Dockerfileecho_engine_iot.pyasecho_engine.pyEngine/requirements.txtscikit-learnecho_engine.jsonAPI_URLfield (was hardcoded)echo_engine_iot.py_handle_edge_prediction(), route onpayload["type"], fix duplicate importtest_iot_integration.pylight_echo_engine.jsonIoT/edge_inference/iot_edge_client.pyIoT/edge_inference/requirements.txttflite-runtime,librosa,sounddevice)IoT/edge_inference/README.mdArchitecture 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.