Comments (6)
I found a temp solution.
I copied the "Encode the Model in an Arduino Header File" code and the gesture_model.tflite file to a Linux box, created a content folder and made a shell and a python script to run the code.
Ex:
- create_content.sh
#!/bin/bash
echo "const unsigned char model[] = {" > content/model.h
cat gesture_model.tflite | xxd -i >> content/model.h
echo "};" >> content/model.h
- get_header_size.py
#!/usr/bin/env python3
import os
model_h_size = os.path.getsize("./content/model.h")
print(f"Header file, model.h, is {model_h_size:,} bytes.")
print("\nOpen the side panel (refresh if needed). Double click model.h to download the file.")
I then copied the resulting model.h code to the Arduino IDE project and was able to complete the Gesture recognition tutorial.
This worked for the "TinyML Classify objects by color" tutorial as well.
from arduinotensorflowlitetutorials.
Please refer to this example on Google Collab. I hope it helps https://github.com/PrashantDandriyal/arduino_GSoC2020/blob/master/activity_tracker/activity_tracker_motionSense_gsoc20.ipynb
from arduinotensorflowlitetutorials.
Uh, the link you provided is a GitHub link. I'm not see how that address this issue.
from arduinotensorflowlitetutorials.
It is actually a link to the iPython notebook I shared to demonstrate how I obtained the header file-model and thought it may help you get over your errors.
from arduinotensorflowlitetutorials.
I got the same problem. The model.h file was blank. I managed to solve it in part, not in a very elegant way. But I hope it helps.
I was able to solve it. What I did was to verify the file using TextEdit on a Mac. I realized some of the lines/cells of the flex.csv and punch.csv files where either empty, mixed with another cell or a whole line of cells was out. Apparently when the data from the IMU is gathered to the Arduino's serial monitor it has some issues so when you copy it to a text file, those issues stays. See the line:
This is ok:
-0.37 | 0.395 | 1.931 | 284.363 | -9.46 | -77.026
-0.648 | 0.578 | 1.737 | 795.166 | 36.743 | -190.247
-0.238 | 0.815 | 1.104 | 1028.137 | 40.283 | -246.948
This is not ok:
-0.37 | 0.395 | 1.931 | 284.363-9.46 | (empty) | -77.026
-0.648 | 0.578 | 1.737 | 795.166 | 36.743 | -190.247 -0.238 | 0.815 | 1.104 | 1028.137 | 40.283 | -246.948
So I had to open the file in excel and manually fix every error in the cells, I took me like 5 minutes but that was the only way I managed to run the Tiny ML colab webpage and run the training, convert and encode functions. After doing this, the model.h file was generated with the data (911kb).
Not everything was ok though. I ran the sketch in Arduino IDE using the IMU_Classifier, adding a tab, pasting the model.h data in it. The Arduino serial monitor is responding but is giving me just a "nan" label instead of a float eg. 0.8987
So apparently I managed to solve the model.h problem but still I don't know whats the "nan" problem.
BTW I'm following this tutorial https://blog.arduino.cc/2019/10/15/get-started-with-machine-learning-on-arduino/
from arduinotensorflowlitetutorials.
@intratron im getting the same error. Did you find any solution for same ?
The Arduino serial monitor is responding but is giving me just a "nan" label instead of a float eg. 0.8987
from arduinotensorflowlitetutorials.
Related Issues (20)
- No official Repository of Library HOT 6
- How can I add BLE to this code? HOT 2
- GestureToEmoji: Exercise 6
- tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h: No such file or directory HOT 4
- error: 'AllOpsResolver' in namespace 'tflite::ops::micro' does not name a type tflite::ops::micro::AllOpsResolver tflOpsResolver; HOT 1
- KeyError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) HOT 1
- xx bytes lost due to alignment. To avoid this loss, please make sure the tensor_arena is 16 bytes aligned HOT 1
- micro_mutable_op_resolver.h:21:10: fatal error: tensorflow/lite/c/common.h: No such file or directory HOT 1
- COM stuck after uploading IMU Classifier sketch? HOT 10
- Error compiling IMU_Classifier
- TFLite MicroInterpreter() never returns on Arduino Nano BLE 33 Sense
- Normalizing sensor data HOT 1
- it can be apply to nano 33 iot? HOT 2
- TFLite on MKR1010 Wifi - Error from CMSIS HOT 3
- Breakage caused by removal of "Arduino_TensorFlowLite" library from Library Manager HOT 2
- what does it mean about 'Button connected to pin 3 and GND.'
- Compilation error: tensorflow/lite/micro/kernels/micro_ops.h: No such file or directory HOT 5
- undefined reference to `DebugLog' in micro_error_reporter.cpp HOT 1
- no matching function for call to tflite::MicroInterpreter HOT 1
- Tinyml Workshop Runtime Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinotensorflowlitetutorials.