@@ -108,4 +108,96 @@ only differences are:
108108
109109Now, start the Keyword-Detection example, and observe the ML model update.
110110
111+ #### Making the ML model update demo more appealing
112+
113+ Although it is enough to observe the ML model component version bump, a more
114+ demonstrative output can be obtained with minimal effort. Follow the (optional)
115+ steps below to run the Keyword-Detection example with a modified faulty model, unable
116+ to detect any keyword, deploy the OTA update of the ML model, after which correct
117+ ML inference results can be observed after the update is complete.
118+
119+ 1 . Save the update image with a correctly working ML model.
120+
121+ By default, the keyword-detection example is built with a fully-functional
122+ ML model, fetched from the [ ML-zoo] [ kws-model ] . If you have already built
123+ the application, the signed model update is available in the build
124+ directory. Back it up together with its signature string.
125+
126+ ``` bash
127+ cp build/keyword-detection-model-update_signed.bin build/model-update-signature.txt applications/keyword_detection/ml-model-update-demo
128+ ```
129+
130+ 1. Alter the ML model artifacts in the build dir.
131+
132+ A modified model is available in
133+ ` ../../../applications/keyword_detection/ml-model-update-demo/faulty_kws_micronet_m.tflite` . Compile it with
134+ Vela and replace the original tflite file.
135+
136+ ` ` ` bash
137+ source build/mlek_resources_downloaded/env/bin/activate && vela applications/keyword_detection/ml-model-update-demo/faulty_kws_micronet_m.tflite --accelerator-config=ethos-u55-128 --optimise Performance --config components/ai/ml_embedded_evaluation_kit/library/scripts/vela/default_vela.ini --memory-mode=Shared_Sram --system-config=Ethos_U55_High_End_Embedded --output-dir=applications/keyword_detection/ml-model-update-demo --arena-cache-size=2097152
138+ cp applications/keyword_detection/ml-model-update-demo/faulty_kws_micronet_m_vela.tflite build/mlek_resources_downloaded/kws/kws_micronet_m_vela_H128.tflite
139+ ` ` `
140+
141+ 1. Build the application with the modified model.
142+
143+ Simply run the build command mentioned in the [Build
144+ instructions](# build-instructions) section.
145+
146+ 1. Run the Keyword-Detection application and confirm that no keywords are
147+ detected. Then stop the application.
148+
149+ 1. Deploy an AWS OTA job with the functional ML model from the
150+ ` ../../../applications/keyword_detection/ml-model-update-demo` dir.
151+
152+ 1. Start the Keyword-Detection example again, let it update the ML model, and
153+ detect keywords correctly again.
154+
155+
156+ Before the ML Model update:
157+
158+ ` ` `
159+ (...)
160+ 58 10031 [ML_TASK] [INFO] Running inference on an audio clip in local memory
161+ 59 10058 [OTA Agent Task] [INFO] Current State=[WaitingForJob], Event=[ReceivedJobDocument], New state=[CreatingFile]
162+ 60 10103 [ML_TASK] [INFO] ML UNKNOWN
163+ 61 10109 [ML_MQTT] [INFO] Attempting to publish (_unknown_) to the MQTT topic MyThing_eu_central_1/ml/inference.
164+ 62 10128 [ML_TASK] [INFO] For timestamp: 0.000000 (inference # : 0); label: <none>; threshold: 0.000000
165+ 63 10168 [ML_TASK] [INFO] For timestamp: 0.500000 (inference # : 1); label: <none>; threshold: 0.000000
166+ 64 10208 [ML_TASK] [INFO] For timestamp: 1.000000 (inference # : 2); label: <none>; threshold: 0.000000
167+ 65 10248 [ML_TASK] [INFO] For timestamp: 1.500000 (inference # : 3); label: <none>; threshold: 0.000000
168+ 66 10288 [ML_TASK] [INFO] For timestamp: 2.000000 (inference # : 4); label: <none>; threshold: 0.000000
169+ 67 10328 [ML_TASK] [INFO] For timestamp: 2.500000 (inference # : 5); label: <none>; threshold: 0.000000
170+ 68 10368 [ML_TASK] [INFO] For timestamp: 3.000000 (inference # : 6); label: <none>; threshold: 0.000000
171+ 69 10408 [ML_TASK] [INFO] For timestamp: 3.500000 (inference # : 7); label: <none>; threshold: 0.000000
172+ ` ` `
173+
174+ After the ML Model update:
175+
176+ ` ` `
177+ (...)
178+ 57 10000 [OTA Agent Task] [INFO] In self test mode.
179+ 58 10009 [OTA Agent Task] [INFO] New image has a higher version number than the current image: New image version=0.0.42, Previous image version=0.0.11
180+ 59 10034 [OTA Agent Task] [INFO] Image version is valid: Begin testing file: File ID=0
181+ (...)
182+ 75 12259 [OTA Agent Task] [INFO] New image validation succeeded in self test mode.
183+ (...)
184+ 95 14005 [ML_TASK] [INFO] Running inference on an audio clip in local memory
185+ 96 14032 [OTA Agent Task] [INFO] Current State=[WaitingForJob], Event=[ReceivedJobDocument], New state=[CreatingFile]
186+ 97 14078 [ML_TASK] [INFO] ML_HEARD_ON
187+ 98 14084 [ML_MQTT] [INFO] Attempting to publish (on) to the MQTT topic MyThing_eu_central_1/ml/inference.
188+ 99 14102 [ML_TASK] [INFO] For timestamp: 0.000000 (inference # : 0); label: on, score: 0.996127; threshold: 0.700000
189+ 100 14144 [ML_TASK] [INFO] For timestamp: 0.500000 (inference # : 1); label: on, score: 0.962542; threshold: 0.700000
190+ 101 14186 [ML_TASK] [INFO] ML UNKNOWN
191+ 102 14192 [ML_TASK] [INFO] For timestamp: 1.000000 (inference # : 2); label: <none>; threshold: 0.000000
192+ 103 14232 [ML_TASK] [INFO] ML_HEARD_OFF
193+ 104 14239 [ML_TASK] [INFO] For timestamp: 1.500000 (inference # : 3); label: off, score: 0.999030; threshold: 0.700000
194+ 105 14281 [ML_TASK] [INFO] ML UNKNOWN
195+ 106 14287 [ML_TASK] [INFO] For timestamp: 2.000000 (inference # : 4); label: <none>; threshold: 0.000000
196+ 107 14328 [ML_TASK] [INFO] For timestamp: 2.500000 (inference # : 5); label: <none>; threshold: 0.000000
197+ 108 14368 [ML_TASK] [INFO] ML_HEARD_GO
198+ 109 14375 [ML_TASK] [INFO] For timestamp: 3.000000 (inference # : 6); label: go, score: 0.998854; threshold: 0.700000
199+ 110 14417 [ML_TASK] [INFO] ML UNKNOWN
200+ 111 14423 [ML_TASK] [INFO] For timestamp: 3.500000 (inference # : 7); label: <none>; threshold: 0.000000
201+ ` ` `
202+
111203[kws-model]: https://github.com/ARM-software/ML-zoo/tree/9f506fe52b39df545f0e6c5ff9223f671bc5ae00/models/keyword_spotting/micronet_medium/tflite_int8
0 commit comments