-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use multiple Output Tensors? #67
Comments
I will hopefully push soon an example for object detection where the model takes one input tensor and has 4 output tensors.
|
Yes thanks this is what I ended up doing. At first I didnt realize that runForMultipleInputs is directly callable from outside too and was using run only. By directly using runForMultipleInputs this works perfectly for OD. Just the naming could be improved. Thank you! |
Same for me. Thats why i opened this ticket here. |
Hi @gregorscholz and @alexw92! I'm fairly new to ML and flutter development, do you know how to solve this error? I have a MobileNetSSD 320x320 model.
|
@alexw92 Thanks for this! However, I'm confused as to why I still need to determine my model's output shape. Isn't it [1,10] as what is stated in the error? Please correct me if I'm wrong. Additionally, how do I specify and change the expected output size in order to fit my model's shape in this code?
|
@Rikerz08 The error you see is probably a mismatch of one of the 4 outputs assuming your model also has 4 outputs. Seeing from the code and the error I would guess that the order of the outputs is different in your model. What happens if you change this
to this
for instance? |
We tried changing it to this:
The shape error was fixed however it had another error which is this one:
|
@Rikerz08 ah so thats some progress. Just try out all the permutations and in the end you will have the right order. Or add a print statement in the runForMultipleInputs code to check the dimensions of each output manually. Or you use Netron to look up the outputs of your model. |
E/flutter (30995): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Output object shape mismatch, interpreter returned output of shape: [1, 84, 8400] while shape of output provided as argument in run is: [8400, 4] |
I have an OD model which 4 output tensors. However I am unsure how should I give them to the loaded interpreter.
Lets take a look at the code of interpreter.dart
So we can see that the output fed into model is assigned to the first field of a Map<int, Object>. So then in runForMultipleInputs in the for-loop this outputTensors[i].copyTo(outputs[i]!) runs into a null access exception.
This is how I feed the output to the model.
So far I only made it working by just casting the input object to Map. How is this supposed to be used anyway?
The text was updated successfully, but these errors were encountered: