Understanding the Size of Sony NNCs That Can Be Infeasured in the Presense

Asked 2 years ago, Updated 2 years ago, 131 views

When dnnrt.forward() files learned in nnc in the Spresense and Arduino development environment I have a few questions about the size of the nnb file.

Does the size depend on the core (main or sub) to be executed?
I think it depends on the available memory size (tile?).

Please let me know if there are any guidelines for that time.
You can assume that the program is very simple and rarely uses stacks or heaps.

Is there a way to check if the file can be inferred by a program in advance?

I look forward to your kind cooperation.

spresense

2022-09-30 21:43

2 Answers

Additional research has been conducted.

In the end, when using Camera, etc., there is almost no Heap, and in the end, the NNC's nnb file area is tens of bytes, so you can't build the AI of the network you want.

However, it seems that there is still a lot of space in the Worker portion of the 1.5MB memory of the Spresense.
So I took the memory out of that area.

https://developer.sony.com/develop/spresense/docs/sdk_developer_guide_ja.html#_asmp_framework
It's hard to understand even if you look at , but use the example as a reference to get the Shared RAM.

mpshm_tshm;
  int =mpshm_init(&shm,0,1024*512);
  int8_t*buf=mpshm_attach(&shm,0);

If you take the 512kB virtual space area instead of malloc,

size=nnbfile.size();

If the size is smaller than 512 kB,

_network=buf;

If so, you can put a 512kB nnb file.

Now we can build AI for a fairly large network.


2022-09-30 21:43

I started using NNC myself and ran into the NNB file size issue.

As far as the code goes,

DNNRT.cpp

of the

size=nnbfile.size();
  _network=(nn_nnetwork_t*)malloc(size);

It's malloc like that, so it probably depends on the Heap size.
So when I use Camera to make all kinds of apps, it seems that the size will be much smaller.

As far as I can see, there are only 768kB areas where I can use the app, so I don't use a camera, and even if the app is small, it looks like I can only take 300kB from the heap.
I'd like to expect Sony to make good use of the rest of the area.


2022-09-30 21:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.