TinyML for RTL8720DN

TinyML_AirDigit.ino
This code runs well using ESP32 (NodeMCU-32S).

Arduino:1.8.19 (Windows 10), 開發板:“BW16 (RTL8720DN), Disable, Enable”

Compilation Errors:

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\core\api\flatbuffer_conversions.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\core\api\op_resolver.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\kernels\kernel_util.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\all_ops_resolver.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\cmsis-nn\add.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\cmsis-nn\mul.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\cmsis-nn\pooling.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\conv_test_common.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\detection_postprocess.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\reshape.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\kernels\shape.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\memory_helpers.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\micro_allocator.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\micro_interpreter.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\recording_micro_allocator.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\simple_memory_allocator.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\test_helpers.cpp

Error while detecting libraries included by D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\schema\schema_utils.cpp

In file included from c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\ext\string_conversions.h:43:0,
from c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\bits\basic_string.h:5429,
from c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\string:52,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/third_party/flatbuffers/include/flatbuffers/base.h:42,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/third_party/flatbuffers/include/flatbuffers/flatbuffers.h:21,
from d:\users\rkuo2\documents\arduino\libraries\eloquenttinyml\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\schema\schema_generated.h:22,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow.h:39,
from D:\Users\rkuo2\Documents\Arduino\examples\TinyML\TinyML_AirDigit\TinyML_AirDigit.ino:2:
c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\cstdio:127:11: error: ‘::printf’ has not been declared
using ::printf;
^~~~~~
c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\cstdio:137:11: error: ‘::sprintf’ has not been declared
using ::sprintf;
^~~~~~~
In file included from c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\algorithm:62:0,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/third_party/flatbuffers/include/flatbuffers/base.h:46,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/third_party/flatbuffers/include/flatbuffers/flatbuffers.h:21,
from d:\users\rkuo2\documents\arduino\libraries\eloquenttinyml\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\schema\schema_generated.h:22,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow.h:39,
from D:\Users\rkuo2\Documents\Arduino\examples\TinyML\TinyML_AirDigit\TinyML_AirDigit.ino:2:
c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\bits\stl_algo.h: In function ‘void std::random_shuffle(_RAIter, _RAIter)’:
c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\bits\stl_algo.h:4451:8: error: ‘Rand’ is not a member of ‘std’
+ std::rand() % ((__i - __first) + 1);
^~~
c:\users\rkuo2\appdata\local\arduino15\packages\realtek\tools\ameba_d_asdk_toolchain\1.0.1\arm-none-eabi\include\c++\6.5.0\bits\stl_algo.h:4451:8: note: suggested alternative:
In file included from C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\system/component/soc/realtek/amebad/fwlib/include/rtl8721d.h:24:0,
from C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\system/component/soc/realtek/amebad/fwlib/include/ameba_soc.h:13,
from C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\system/component/soc/realtek/amebad/cmsis/cmsis.h:35,
from C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\system/component/common/mbed/targets/hal/rtl8721d/PinNames.h:5,
from C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\variants\rtl8720dn_bw16/variant.h:30,
from C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\cores\ambd/Arduino.h:126,
from C:\Users\rkuo2\AppData\Local\Temp\arduino_build_408516\sketch\TinyML_AirDigit.ino.cpp:1:
C:\Users\rkuo2\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.3\system/component/soc/realtek/amebad/swlib/string/rand.h:14:1: note: ‘Rand’
Rand (
^~~~
In file included from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_op_resolver.h:22:0,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_mutable_op_resolver.h:31,
from d:\users\rkuo2\documents\arduino\libraries\eloquenttinyml\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\all_ops_resolver.h:20,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow.h:41,
from D:\Users\rkuo2\Documents\Arduino\examples\TinyML\TinyML_AirDigit\TinyML_AirDigit.ino:2:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/op_resolver.h: In member function ‘virtual tflite::OpResolver::TfLiteDelegatePtrVector tflite::OpResolver::GetDelegates(int) const’:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/op_resolver.h:44:52: warning: unused parameter ‘num_threads’ [-Wunused-parameter]
virtual TfLiteDelegatePtrVector GetDelegates(int num_threads) const {
^~~~~~~~~~~
In file included from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_mutable_op_resolver.h:31:0,
from d:\users\rkuo2\documents\arduino\libraries\eloquenttinyml\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\all_ops_resolver.h:20,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow.h:41,
from D:\Users\rkuo2\Documents\Arduino\examples\TinyML\TinyML_AirDigit\TinyML_AirDigit.ino:2:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_op_resolver.h: In member function ‘virtual const TfLiteRegistration* tflite::MicroOpResolver::FindOp(tflite::BuiltinOperator, int) const’:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_op_resolver.h:55:40: warning: unused parameter ‘version’ [-Wunused-parameter]
int version) const final {
^~~~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_op_resolver.h: In member function ‘virtual const TfLiteRegistration* tflite::MicroOpResolver::FindOp(const char*, int) const’:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/micro/micro_op_resolver.h:61:56: warning: unused parameter ‘version’ [-Wunused-parameter]
const TfLiteRegistration* FindOp(const char* op, int version) const final {
^~~~~~~
In file included from d:\users\rkuo2\documents\arduino\libraries\eloquenttinyml\src\eloquent_tinyml\tensorflow\arm\tensorflow\lite\micro\micro_interpreter.h:25:0,
from D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow.h:43,
from D:\Users\rkuo2\Documents\Arduino\examples\TinyML\TinyML_AirDigit\TinyML_AirDigit.ino:2:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h: In member function ‘virtual void tflite::Profiler::EndEvent(uint32_t, int64_t, int64_t)’:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:74:34: warning: unused parameter ‘event_handle’ [-Wunused-parameter]
virtual void EndEvent(uint32_t event_handle, int64_t event_metadata1,
^~~~~~~~~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:74:56: warning: unused parameter ‘event_metadata1’ [-Wunused-parameter]
virtual void EndEvent(uint32_t event_handle, int64_t event_metadata1,
^~~~~~~~~~~~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:75:33: warning: unused parameter ‘event_metadata2’ [-Wunused-parameter]
int64_t event_metadata2) {}
^~~~~~~~~~~~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h: In member function ‘virtual void tflite::Profiler::AddEvent(const char*, tflite::Profiler::EventType, uint64_t, uint64_t, int64_t, int64_t)’:
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:92:37: warning: unused parameter ‘tag’ [-Wunused-parameter]
virtual void AddEvent(const char* tag, EventType event_type, uint64_t start,
^~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:92:52: warning: unused parameter ‘event_type’ [-Wunused-parameter]
virtual void AddEvent(const char* tag, EventType event_type, uint64_t start,
^~~~~~~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:92:73: warning: unused parameter ‘start’ [-Wunused-parameter]
virtual void AddEvent(const char* tag, EventType event_type, uint64_t start,
^~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:93:34: warning: unused parameter ‘end’ [-Wunused-parameter]
uint64_t end, int64_t event_metadata1,
^~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:93:47: warning: unused parameter ‘event_metadata1’ [-Wunused-parameter]
uint64_t end, int64_t event_metadata1,
^~~~~~~~~~~~~~~
D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML\src/eloquent_tinyml/tensorflow/arm/tensorflow/lite/core/api/profiler.h:94:33: warning: unused parameter ‘event_metadata2’ [-Wunused-parameter]
int64_t event_metadata2) {}
^~~~~~~~~~~~~~~
使用程式庫EloquentTinyML、版本2.4.3,位於資料夾:D:\Users\rkuo2\Documents\Arduino\libraries\EloquentTinyML
exit status 1
開發板 BW16 (RTL8720DN) 編譯錯誤。

@rkuo2000

Hi, not all libraries working for ESP32 can also be used on other boards, there are usually a lot of work to be done to port a popular library to another platform since the underlying API and hardware are designed differently.

However, BW16 already supported TensorFlow Lite examples, you may check out this link for more information on how to set up your environment,
https://www.amebaiot.com/zh/amebad-arduino-audio-tensorflow-basic/

I saw the Tensorflow Lite implementation, the sample code is too complicated to use. I prefer to use TinyML, since I have train a few models on Kaggle and successfully running on ESP32. It would be good to see RTL8720DN support TinyML.

SimonXI via Realtek Ameba IOT Developers Forum (RTL8722 RTL8195 RTL8710 RTL8720 BW16 Development board) - IOT / MCU Solutions 瑞昱開發者論壇 開發板 开發者论坛 开發板 <notifications@ameba.discoursemail.com> 於 2022年8月18日 週四 14:07 寫道: