CNN MemoryError

Discussion related to "under the hood" OpenMV topics.
scnuelc
Posts: 6
Joined: Sun May 20, 2018 9:06 am

CNN MemoryError

Postby scnuelc » Sun Jul 22, 2018 8:59 am

MemoryError: Out of normal MicroPython Heap Memory! Please reduce the resolution of the image you are running this algorithm on to bypass this issue!

it's seem that the network(about 164KB) i trained is too large?
I want know the appropriate value of the image amount i use to train net and the image resolution i should make(32*32 or 64*64),What's more,the amount of the layer i have to train to

Best wishes
User avatar
kwagyeman
Posts: 2111
Joined: Sun May 24, 2015 2:10 pm

Re: CNN MemoryError

Postby kwagyeman » Sun Jul 22, 2018 10:56 am

Ibrahim will get back to you with an answer. The M7 the MP heap is only 128KB. So, your network is bigger than all the heap that we have. Ibrahim will try to give you a good estimate on the size of the net that can fit in the M7. This CNN feature is mostly only going to be possible on the H7 coming soon.
Nyamekye,
User avatar
iabdalkader
Posts: 497
Joined: Sun May 24, 2015 3:53 pm

Re: CNN MemoryError

Postby iabdalkader » Sun Jul 22, 2018 11:40 am

Hi, yes 164KBs is larger than the F7's heap which is only ~52K (and 240KBs on the H7). The network is allocated on the heap, so it needs to be less than 52KBs (for example, the reduced cifar10_fast.network is ~33KBs). There's no restriction on the number of layers, you can have as many as you want as long as they fit the memory. Smaller training images will reduce the size of the network, but the image size used for inference is irrelevant (it's allocated in a different memory).
Note if your network is generic and you'd like to share it please send a PR or attach it here and I'll add it to the repo.
User avatar
kwagyeman
Posts: 2111
Joined: Sun May 24, 2015 2:10 pm

Re: CNN MemoryError

Postby kwagyeman » Sun Jul 22, 2018 12:15 pm

Um, for the number of layer and image input size I'd try to stick to 32x32 or 24x24 and keep the layer count to about 3 to 4 layers of conv.
Nyamekye,
scnuelc
Posts: 6
Joined: Sun May 20, 2018 9:06 am

Re: CNN MemoryError

Postby scnuelc » Tue Jul 31, 2018 4:38 am

Thanks,and the network i trained I think it can throw away after i test it,Emmm, by the way, i think m7 is more prefer haarcascade than network.

Anyways, thanks a lot;

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests