Can I use two Sprense AIs at the same time?

Asked 2 years ago, Updated 2 years ago, 106 views

DNNRT dnnrt;
DNNRT dnnrt2;

The second DNNRT bigin() will fail.

spresense

2022-09-30 21:43

1 Answers

Certainly, it is not possible to make two instances of DNNRT.It's probably a resource issue.However, it seems that DNNRT can be used sequentially.I actually tried using the following code:

/*trial of 1st neural network*/ 
dnnrt.begin("model.nnb");
DNNVariable input (size);
   ...snip...
dnnrt.inputVariable(input,0);
dnnrt.forward();
DNNVariable output = dnnrt.outputVariable(0);
   ...snip...
dnnrt.end();

/* trial of 2nd neural network*/ 
dnnrt.begin("model2.nnb");
   ...snip...
dnnrt.inputVariable(input,0); /*Use input data all over */
dnnrt.forward();
output = dnnrt.outputVariable(0);
   ...snip...
dnnrt.end();

This one can use less memory effectively, so why don't you try it?


2022-09-30 21:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.