Sony Spresense Inference Issues

Hi there,

I tested the new added features for the Sony Spresense. The firmware for all the sensors (Cam, mics and accelerometer), capturing data went OK. Now, when I flashed the package I found one problem and one question:

1)- I used the cli to run the camera inference and I got an error telling me that it couldn’t allocate tensors. (See the screenshot)

2)- How do I get the source code for the NuttX package you generate for the Spresense?

Regards,
Carlos.

Hello @BigCatBrother,

To answer your first question:

  1. Failed to allocate tensor arena -> This is because your model RAM usage is too big for your board, could you try:
  • To chose a smaller Transfer Learning (MobileNetV1 for example)
  • Use smaller images (48x48)
  1. I am not sure, I ask the team

Regards,

Louis

Hi @BigCatBrother,

Regarding your 2nd question, we’re using an exported version of the Spresense SDK. This includes the Nuttx OS. You can download the SDK using this tutorial: https://developer.sony.com/develop/spresense/docs/sdk_set_up_en.html or pull in directly from github: https://github.com/sonydevworld/spresense

If you want to make changes to the Spresense SDK you should first load in the configuration file of the Edge Impulse project -> https://github.com/edgeimpulse/firmware-sony-spresense/blob/main/spresense-exported-sdk/nuttx/.config using the Spresense tools/config.py script.

A description on how to create an exported SDK for the Spresense board can be found here: https://github.com/sonydevworld/spresense-exported-sdk/tree/2ec2a1538362696118dc3fdf56f33dacaf8f4067

Good luck!
Arjan

2 Likes

I also had this problem. Tested different models to check the behavior after flashing. If the model becomes to big, then edge-impulse-run-impulse might not even start inferencing.

[SER] Serial is connected, trying to read config...
[SER] Failed to get info off device:undefined. Is this device running a binary built through Edge Impulse? Reconnecting in 5 seconds...

The largest vision model I’ve tested and that could be executed so far is MobileNetV2 0.05.

Any plans by Edge Impulse to flag in the deployment/build process when model exceeds available device resources?

Thanks for great service,
A.

Hi @alexjaw

You’re right, large vision models won’t run on the smaller boards. MobileNetV1 usually give the best results on embedded targets.

For most targets, the compiler returns an error in the build process. Sony build doesn’t return an error, because it uses heap memory (so it’s a runtime error). But it’s a good idea to create a separate mechanism for Sony to determine if the model fits.

Thanks!

@alexjaw Yeah it’s super annoying. It’s been a long standing wish for me to get the device selection much earlier into project creation (as part of the new wizard: what do you want to do? where do you want to run it?) and then only suggest things that will work as-is on the device. So we’re definitely tracking it, just so much stuff to do (if someone reads this: we’re hiring :wink: )

I heard Sony will release a new camera board, I hope it will consume less resources so we can take advantage of the full potential without doing that much work. We will see. The 5MP camera is great for doing things by code but I guess a smaller resolution one will be more suitable for the current state of tiny machine learning.

1 Like