Closed BrainSurgeAI closed 1 year ago
Hello @Chernobyl81,
I used this to get a visual on your model. It seems that the shape of the following are incorrect compared to the 'srcShape'.
armnn::TensorShape r1iShape({1, 1, 1, 1});
armnn::TensorShape r2iShape({1, 1, 1, 1});
armnn::TensorShape r3iShape({1, 1, 1, 1});
armnn::TensorShape r4iShape({1, 1, 1, 1});
Below is a picture of the input size the model requires:
I suggest the above TensorShapes should be {1, 1, 1280, 720} to conform with 'srcShape'. Also, I would think that seeing 'downsample_ratio' is an input this will also need to be included when calling CreateNetworkFromBinaryFile(). I hope this solved your problem.
Kind Regards, Cathal.
@catcor01 Thanks for help. But it does not work too.
@Chernobyl81 Can you show log more details?
Hi, @Shelton-N, I wrote this program just for test onnx model loading.
#include "armnn/INetwork.hpp"
#include "armnn/IRuntime.hpp"
#include <armnn/Utils.hpp>
#include <armnn/Logging.hpp>
#include <armnn/Descriptors.hpp>
#include <armnnOnnxParser/IOnnxParser.hpp>
#include <iostream>
int main(int argc, char **argv)
{
using namespace armnn;
using IParser = armnnOnnxParser::IOnnxParser;
using BindingPointInfo = armnn::BindingPointInfo;
armnn::TensorShape srcShape({1, 3, 1280, 720});
armnn::TensorShape r1iShape({1, 1, 1, 1});
armnn::TensorShape r2iShape({1, 1, 1, 1});
armnn::TensorShape r3iShape({1, 1, 1, 1});
armnn::TensorShape r4iShape({1, 1, 1, 1});
armnn::TensorShape dsrShape({1});
std::map<std::string, armnn::TensorShape> inputTensors{
{"src", srcShape},
{"r1i", r1iShape},
{"r2i", r2iShape},
{"r3i", r3iShape},
{"r4i", r4iShape},
{"downsample_ratio", dsrShape}
};
auto parser(IParser::Create());
auto network = parser->CreateNetworkFromBinaryFile(argv[1]);
IRuntime::CreationOptions options;
armnn::IRuntimePtr run(armnn::IRuntime::Create(options));
armnn::IOptimizedNetworkPtr optNet = Optimize(*network, {"CpuRef"}, run->GetDeviceSpec());
if (!optNet)
{
std::cerr << "Error: Failed to optimise the input network" << std::endl;
return 1;
}
return 0;
}
And get an error:
@Chernobyl81 form log, erro happend when parser onnx model; parser onnx model op tensorshape
void TensorShape::CheckSpecifiedNumDimensions() const
{
if (Dimensionality::Specified == m_Dimensionality)
{
std::stringstream errorMessage;
errorMessage << "Invalid action on a tensor shape that has known number of dimensions.";
throw InvalidArgumentException(errorMessage.str(), CHECK_LOCATION());
}
}
from rvm_mobilenetv3_fp32.onnx INPUT ,it seems that is dynamic shape model。 And now ArmNN22.05 may not support dynamic shape for ONNX.
Notes: your log show that you maybe use not a 22.05 version.
@catcor01 Right?
@Shelton-N @catcor01 thank you a lot!
@catcor01 Is there plan to support dynamic shape for ONNX parser in the futrue?
Hi, I use armnn[22_05] to create a network from binary file rvm_mobilenetv3_fp32.onnx occurs an error:
Invalid action on a tensor shape that has unknown number of dimensions. at function CheckUnspecifiedNumDimensions
How can I fix it?