Upcoming maintenance
Dear Customers and Partners.
This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.
This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.
We apologize for any inconvenience.
DNNRT: runtime error
-
hello,
I was trying to implement a ML model on spresense using the DNNRT library, but I am facing an errordnnrt-mp included in bootloader isn't installed, or no memory space to load it
more precisely, the
dnnrt.begin() returns -16
How to correct this issue?
Thank you
-
-
@neo11-0
I am not sure if you are running the example in the Spresense doc or if it is your own implementation, to start with DNNRT, please refer to section 5.5. DNN Runtime and run the sample code: https://developer.sony.com/develop/spresense/docs/sdk_developer_guide_en.html#_dnn_runtimehttps://developer.sony.com/develop/spresense/docs/sdk_developer_guide_en.html#_dnn_runtimeSample code is here:
https://github.com/sonydevworld/spresense/tree/master/examples/dnnrt_lenet/I hope this helps.
-
@Armaghan
sorry, i forgot to mention that i am using my model's code but facing error in dnnrt.begin section. Samples are runnin but same model on custom dataset isn't.Thanks
-
@neo11-0 I haven't used DNNRT once, but l can give some hints.
I assume the bootloader is installed and the example sketch works.
What is your model size?
What is your setting of the memory for subcores?
How much memory do you have left?If you do not know about the memory ...
#include <MP.h> #include <fcntl.h> int used; int free; int freeContinuous; MP.GetMemoryInfo(used, free, freeContinuous); printf("Memory tile usage: used:%dK / free:%dK (Largest free:%dK)", used / 1024, free / 1024, freeContinuous / 1024); int fd; char procfs_read_buf[128] = {0}; fd = open(CONFIG_NSH_PROC_MOUNTPOINT "/meminfo", O_RDONLY); while (true) { memset(procfs_read_buf, 0, sizeof(procfs_read_buf)); int nbytesread = read(fd, (void*)procfs_read_buf, sizeof(procfs_read_buf) - 1); if (nbytesread <= 0) { break; } else { // If this line does not compile, please fix it. Serial.print(procfs_read_buf, nbytesread); } }
Btw if you search for EBUSY and files dnn*, there is only one hit
ret = dnn_mpmgr_load(config->cpu_num - 1); if (ret != RT_RET_NOERROR) { return -EBUSY; }
Following the code I would guess the memory setting for the subcores is wrong.
-
@jens6151-0-1-1 yes the example search is working, thanks for your help. Your guess regarding the memory was correct, but can you please explain where to run this code? and where I need to search for the EBUSY you are have mentioned in the second code section?
-
@neo11-0 This is the concrete link to the file
https://github.com/sonydevworld/spresense/blob/6cb78083aa3d58ef1a991f1477d9415f8951dc7e/sdk/modules/dnnrt/src-mp/runtime/runtime_client.c#L54It will call dnn_mpmgr_start_task
There are 7 reasons to fail. So if you cannot find the issue, you could add printf statements there. If you are using Arduino IDE, it is some effort to recompile the SDK though.The above code just prints the memory situation. You can call it before dnnrt.begin().
-
@jens6151-0-1-1 Thank you so much, now its working fine.
-