ARM-software / armnn

Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
https://developer.arm.com/products/processors/machine-learning/arm-nn
MIT License
1.15k stars 307 forks source link

NN with one input and multiple output #583

Closed thielchris closed 2 years ago

thielchris commented 2 years ago

I have a problem executing a neural network with one input and 4 ouputs using armnn. I've seen the post https://github.com/ARM-software/armnn/issues/243#issue-478620605, but this didn't help me. For following code

        std::vector<float> boxes(40);
        std::vector<float> classes(10);
        std::vector<float> scores(10);
        std::vector<float> numClasses(1);

        armnn::OutputTensors output{
            {outputBindingInfo.first, armnn::Tensor(outputBindingInfo.second, &boxes[0])},
            {outputBindingInfo1.first, armnn::Tensor(outputBindingInfo1.second, &classes[0])},
            {outputBindingInfo2.first, armnn::Tensor(outputBindingInfo2.second, &scores[0])},
            {outputBindingInfo3.first, armnn::Tensor(outputBindingInfo3.second, &numClasses[0])}
        };
        runtime->EnqueueWorkload(networkID,
                                 MakeInputTensors(inputBindingInfo, &inputArray[0]),
                                 MakeOutputTensors(outputBindingInfo, &output[0]));

i get the error: terminate called after throwing an instance of 'armnn::InvalidArgumentException' what(): No tensor supplied for output 43008

I use following pretrained network for detect objects and extract bounding boxes: SSD MobileNet V1 (download-link: https://coral.ai/models/object-detection/ ) I checked the size for the outputs with GetNumBytes(), and everything is ok. I don't know which outputBindingInfo I need to select for the Enequeworkload() function (or how do I get all 4 in the function?). Propably is that the mistake i have. So can somebody help me with that? Also: What does the '43008' mean? Maybe this help me find the issue. Thanks !

thielchris commented 2 years ago

I've seen my mistake in a sample. MakeOutputTensors(...) is wrong - it is a tensor. So just change the last function call to:

        runtime->EnqueueWorkload(networkID,
                                 MakeInputTensors(inputBindingInfo, &inputArray[0]),
                                 output);
xiaotongnii commented 2 years ago

armnn can support multiple intpu or not