Arduino library example

Hi, I have created a speech recognizer. It should recognize the word “light”. I want to try to turn on a led with my voice as a command
I get good performance both in live classification and when deploying the application on my arduino nano33 sense (run_impulse).
But when I compile and load the sketch example “nano_33ble_sense_microphone” from the library it really have bad performance.
Do you have any advice?

@gransasso What do you mean with ‘bad performance’? Not recognizing the keyword properly?

A big reason could be that when detecting keywords you really want to do continuous audio sampling to not miss any events, which requires a thread or DMA. This is what we use for edge-impulse-run-impulse --continuous. Not as easy to incorporate this in a basic sketch.

I have some pointers here on how to modify our example application to do this: Deployment of impulse on device not showing the expected results

Hi thank you for your answer. I understand what you wrote but I don’t think that’s my case.
I pay attention to the inferencing intervals. When I talked about bad performances I was referring to the fact that the keyword is never recognized. This happens when I download the library for Arduino and load the example that comes with it.
In the other tests (live classification, deployment) the keyword is recognized much more frequently.

@gransasso If you set the third argument to run_classifier to true it’ll print the intermediate features (after DSP) to the serial output. Could you post such a result for me?

Features (362 ms.): -0.572442 -0.389752 -1.310422 -0.707415 -0.315933 -0.758931 -0.297977 0.908655 0.745037 1.032447 -0.104585 0.405567 -0.811875 -0.220975 -0.425983 -0.465300 0.789316 0.832681 -0.392611 -0.914542 0.641506 0.442369 0.660818 -0.333249 -0.998983 0.216736 -1.069610 -0.334703 -0.324679 -0.717497 -0.234449 -1.330434 0.213572 0.883640 -0.254599 0.165161 -0.176423 -0.405650 -0.759480 -0.943952 -2.229472 -2.403554 -0.614962 -0.249396 0.299901 1.083517 1.933049 3.024513 2.895329 1.021280 2.022224 1.584827 -1.207222 -1.139360 -0.203741 0.025305 -0.522105 -1.017003 1.311271 1.735929 -0.276801 -1.487333 -2.177233 -0.219086 0.482300 -1.377017 -0.556913 -0.660076 -0.174834 0.201337 -1.008958 -1.041599 1.217849 -1.240578 -1.728970 -0.870727 -1.264410 -0.798548 -1.234222 -1.528293 -2.570484 -1.404094 1.029579 1.615797 1.222235 0.032380 -0.454270 0.284790 1.739776 1.620930 1.989090 -1.123524 -1.208474 -0.971734 1.636250 0.809962 0.873130 0.623582 -0.351671 -1.374922 -1.384896 -0.364958 -0.059554 0.552831 -1.131664 -0.672431 -0.887204 -0.382239 -1.178265 -1.376965 -0.006157 -0.049497 -1.604219 0.821260 0.400247 -0.512762 -0.381697 -1.344924 -0.467699 -1.481593 -0.728687 0.059687 0.406993 -0.332081 -1.123289 0.287320 -0.720945 -1.705080 -0.379427 -1.392130 -0.937805 -1.009313 -1.592041 -1.923506 -0.432647 -0.155896 0.517512 1.606727 1.197241 -1.001593 -0.722464 -0.476839 -0.524689 -1.211411 -0.839507 -1.373666 -1.152290 0.022987 -0.742513 -0.657938 -0.620642 -0.437502 -1.183398 -0.021202 0.724918 -0.081922 -1.181080 -1.070974 -0.489802 -1.336189 0.711492 -0.430428 -3.586104 -1.066365 -0.292273 -0.728386 -0.332570 -1.215683 -1.496748 -1.033106 -0.896216 -1.150837 0.165661 1.747533 0.140220 0.291124 0.099404 -0.473366 0.721906 -0.711208 1.070034 -0.557495 -0.927820 -0.069747 0.393735 0.136864 1.017812 -0.875550 -0.891763 -1.094171 -0.409181 -1.211459 0.403362 -0.196724 0.101593 0.718843 0.651144 0.325030 0.873383 1.502566 0.335200 1.413037 0.474014 0.123839 0.341428 -0.187213 -0.038929 -0.519367 1.314671 1.348019 0.594099 -0.316619 -1.213636 1.542839 0.395009 -0.999007 -0.590022 0.544505 0.667072 1.812467 0.438905 2.351958 0.864188 0.577553 -0.573002 -1.317009 -0.292434 0.465829 1.348940 1.632996 2.210060 1.456974 0.120370 0.143045 1.863502 1.318037 1.827107 1.102555 -0.733544 0.655017 -0.494697 -0.228675 0.627706 0.683873 1.162885 0.067182 1.209588 0.599207 1.592914 1.558305 1.012322 -0.930839 1.994940 2.398267 -0.663262 -1.388532 -0.801447 -1.199641 -1.673577 -0.626867 0.900837 1.041040 -0.593239 -0.730505 -2.832637 -1.279671 -0.027939 -1.013809 -0.815214 -0.780771 -1.072386 -1.342747 -0.909387 0.856462 1.676331 0.851396 0.027861 -1.318606 -2.279751 -1.021842 -0.768878 0.129476 0.094229 -0.652511 -0.672976 1.592749 0.437723 0.805913 -0.301776 -0.672320 -1.217123 -0.674571 0.743369 -0.497087 0.584611 1.239118 1.153767 0.516740 0.077523 -0.279653 1.640590 1.450622 -1.137859 0.122571 0.066883 -0.521117 -0.223761 -0.284282 0.713103 0.300335 -0.347288 0.301089 -0.216588 1.420469 0.026634 -0.867681 -1.010024 0.687217 -0.331915 -1.602263 0.638709 -0.028231 -0.494969 0.655066 0.755277 1.071030 1.234592 1.133128 0.702455 -1.332108 1.911545 -0.368907 -1.335003 -0.021446 -0.328277 0.226398 1.703870 1.606181 0.788746 1.204817 1.732549 1.605804 0.178871 -0.182694 -0.735940 -1.225728 -1.063115 0.859576 -0.051696 -0.502140 -0.589523 1.469065 1.070573 0.699096 0.847445 -1.042103 0.967769 -0.742592 -0.171640 0.248773 0.725614 -0.352614 -1.364809 -0.178666 1.346491 0.571275 -0.919492 -0.868872 -0.284506 -0.246511 -0.940490 0.613226 -0.035892 0.302993 0.034452 0.248981 -0.757880 -0.124384 0.364413 1.126087 1.475244 -0.790481 -0.445394 1.883970 2.413890 0.203068 0.596077 1.421031 -0.818545 -0.476958 1.404190 0.182913 0.121840 -1.501029 -0.965819 -1.204358 -1.057960 -1.108333 -0.839307 0.168204 -0.015476 0.986153 -0.843435 0.679433 1.008348 1.238631 2.082380 -0.151651 -0.109890 -0.462951 -1.042372 0.399534 -0.353832 -1.260874 -0.492273 -0.654872 0.450078 0.541178 0.450551 0.841747 1.176183 1.424754 -0.563854 -0.318957 -1.563607 -0.874973 0.754008 1.039199 2.972961 1.713080 0.487024 0.114393 -0.070541 -0.922907 -0.872455 -0.334964 0.527454 -0.438409 0.679985 0.071183 0.380415 -0.119047 -0.443256 -0.492362 0.105275 0.804233 0.516695 -0.247753 -0.328001 0.152484 -0.179754 0.262209 0.068292 1.119550 -0.325451 0.744422 0.036854 0.995385 1.955251 -0.148696 -1.424348 -1.232944 -1.991694 -1.125215 -1.267156 -1.075421 -1.246703 -0.475379 0.496847 0.128414 0.169261 -0.676218 0.772729 1.268705 0.789906 0.690294 -1.237295 -1.087809 1.190055 0.985541 0.922322 -0.740417 0.950354 0.801343 0.720072 0.593561 -1.051480 -0.673191 1.061804 1.135327 0.133030 -2.464100 0.281995 1.393969 0.286933 0.523362 -0.458654 -0.480779 -0.426901 0.431904 -0.840106 -0.519822 0.063693 -0.776015 -0.342797 -0.636551 -1.130612 1.143031 -1.605208 0.403128 -1.879987 1.474897 -0.349387 -0.289580 0.042164 1.003885 0.714385 2.222062 2.167116 1.307152 0.044248 -0.310391 0.948709 -0.532466 1.067320 0.264822 -0.103421 -0.244014 -0.276908 -1.131351 -0.127823 -0.990774 -1.666370 0.242307 -1.434006 0.367579 -0.338553 1.302227 1.349816 1.074238 0.403507 1.656348 1.729250 1.011778 0.154410 -1.657192 -0.599069 -0.206855 0.507595 -0.391062 -0.586518 0.076168 0.917776 0.606778 1.794719 1.705161 0.553118 1.055772 0.458395 0.018943 0.040653 1.127099 1.770045 -0.045146 -1.101192 1.215618 1.708010 2.137773 -0.681030 -0.685725 -0.690355 -1.445944 -0.010678 -0.882487 -0.316601 -0.182554 0.498769 0.764741 -0.120497 -1.365601 -1.083308 -1.002709 -1.243146 -0.848657 -0.723615 -0.739730 -0.869131 -0.537279 -0.141263 1.842723 1.022232 0.691847 -0.095196 0.233325 0.001255 1.961587 1.018445 0.153272 -0.868890 -0.665601 0.094786 0.569366 1.061168 1.693356 1.186802 -0.173921 -1.395746 -0.245206 0.308947 -0.433796 0.773569 -1.001962 -0.729274 -0.892572 0.471048 1.340250 0.850103 0.250011 0.382200 0.314454 -1.007541 -0.128711 -2.153506 0.253009 -0.622067 -0.770127 -0.021001 0.988606 0.469876 -0.782813 0.252315 0.518408 0.651076 -0.326883 0.807265 -0.120685 0.696701

@gransasso Can you try with this reference model: http://cdn.edgeimpulse.com/reference-models/ei-benchmark-keywords-1d-arduino-1.0.7.zip - just import into the Arduino IDE and load the microphone example on your Nano 33 BLE Sense. Should state ‘noise’ ~1.000 when not hearing anything, and ‘other’ when it hears talking. Just a sanity check.

I tried the new sketch. It seems to behave better, but it is not so accurate. I talk continuously and often it classify my words as “0.99” noise, other times “0.5 - 0.4” noise. Again it seems to have a hard time distinguishing words from noise.

@gransasso when you build the ready-to-go binary for the Nano 33 BLE Sense from the Studio this works properly right? Are you running in continuous mode then? If that’s the case you can also change our example firmware application to add your logic, see e.g. my description here: Deployment of impulse on device not showing the expected results

I’ll have one of our embedded engineers put together an example of doing continuous inferencing mode in a sketch sometime soon to make this easier in the future.