added code
This commit is contained in:
parent
4a9c0cec50
commit
1bacaba9d1
|
@ -1,4 +1,4 @@
|
||||||
# TinyML-CAM - Image Recognition System that Runs at 60 FPS in 1 Kb of RAM
|
# TinyML-CAM - Image Recognition System that Runs at 80 FPS in 1 Kb of RAM
|
||||||
|
|
||||||
### Image Recognition Demo - ESP32
|
### Image Recognition Demo - ESP32
|
||||||
ESP32 classifying Raspberry Pi Pico, Portenta H7, Wio Terminal from image frames
|
ESP32 classifying Raspberry Pi Pico, Portenta H7, Wio Terminal from image frames
|
||||||
|
@ -14,3 +14,9 @@ Following can be observed from the video:
|
||||||
- **Accuracy** As expected during Pairplot analysis, Portenta and Pi (features overlapped) are mislabelled quite often, which can be rectified by improving dataset quality.
|
- **Accuracy** As expected during Pairplot analysis, Portenta and Pi (features overlapped) are mislabelled quite often, which can be rectified by improving dataset quality.
|
||||||
|
|
||||||
- **Memory** Consumes only 1 kB of RAM - difference between the RAM calculated by Arduino IDE before and after adding the TinyML-CAM image recognition system.
|
- **Memory** Consumes only 1 kB of RAM - difference between the RAM calculated by Arduino IDE before and after adding the TinyML-CAM image recognition system.
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
- [ipynb]-TinyML-CAM-full-code-with-markdown.ipynb
|
||||||
|
- [h]-HOG-plus-RandomForest-classifier.h
|
||||||
|
- [ino]-arduino-ESP32-code.ino - upload to
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,53 @@
|
||||||
|
#include "eloquent.h"
|
||||||
|
#include "eloquent/print.h"
|
||||||
|
#include "eloquent/tinyml/voting/quorum.h"
|
||||||
|
|
||||||
|
// replace 'm5wide' with your own model
|
||||||
|
// possible values are 'aithinker', 'eye', 'm5stack', 'm5wide', 'wrover'
|
||||||
|
#include "eloquent/vision/camera/m5wide.h"
|
||||||
|
|
||||||
|
#include "HogPipeline.h"
|
||||||
|
#include "HogClassifier.h"
|
||||||
|
|
||||||
|
Eloquent::TinyML::Voting::Quorum<7> quorum;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
delay(3000);
|
||||||
|
Serial.println("Begin");
|
||||||
|
|
||||||
|
camera.qqvga();
|
||||||
|
camera.grayscale();
|
||||||
|
|
||||||
|
while (!camera.begin())
|
||||||
|
Serial.println("Cannot init camera");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (!camera.capture()) {
|
||||||
|
Serial.println(camera.getErrorMessage());
|
||||||
|
delay(1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply HOG pipeline to camera frame
|
||||||
|
hog.transform(camera.buffer);
|
||||||
|
|
||||||
|
// get a stable prediction
|
||||||
|
// this is optional, but will improve the stability of predictions
|
||||||
|
uint8_t prediction = classifier.predict(hog.features);
|
||||||
|
int8_t stablePrediction = quorum.vote(prediction);
|
||||||
|
|
||||||
|
if (quorum.isStable()) {
|
||||||
|
eloquent::print::printf(
|
||||||
|
Serial,
|
||||||
|
"Stable prediction: %s \t(DSP: %d ms, Classifier: %d us)\n",
|
||||||
|
classifier.getLabelOf(stablePrediction),
|
||||||
|
hog.latencyInMillis(),
|
||||||
|
classifier.latencyInMicros()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
camera.free();
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue