File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
examples/EdgeImpulse/EdgeImpulseExample Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* *
2
+ * This example shows how to use the Eloquent library
3
+ * to perform inference using the EdgeImpulse generated library
4
+ */
5
+ #include < replace_with_edge_impulse_inferencing.h>
6
+ #include < eloquent.h>
7
+ #include < eloquent/tinyml/edgeimpulse.h>
8
+
9
+
10
+ Eloquent::TinyML::EdgeImpulse::Impulse impulse;
11
+
12
+
13
+ void setup () {
14
+ Serial.begin (115200 );
15
+ delay (3000 );
16
+ Serial.println (" Starting EdgeImpulse inference" );
17
+ Serial.println (" Paste your feature vector in the Serial Monitor and get the predicted value" );
18
+ Serial.print (" (expecting " );
19
+ Serial.print (EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE);
20
+ Serial.println (" comma-separated features)" );
21
+ }
22
+
23
+
24
+ void loop () {
25
+ float features[EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE] = {0 };
26
+
27
+ if (!Serial.available ())
28
+ return ;
29
+
30
+ for (int i = 0 ; i < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; i++)
31
+ features[i] = Serial.readStringUntil (' ,' ).toFloat ();
32
+
33
+ Serial.print (" Predicted class: " );
34
+ Serial.println (impulse.predict (features));
35
+ Serial.print (" Predicted label: " );
36
+ Serial.println (impulse.getLabel ());
37
+
38
+ // debug class probabilities and timing
39
+ impulse.printTo (Serial);
40
+ }
You can’t perform that action at this time.
0 commit comments