Hello.
After building the library according to the instructions, I got a set of.a files in the onnxruntime/build/Linux/Debug/ folder(the list is given below).
onnx/libonnx.a
onnx/libonnx_proto.a
libonnxruntime_common.a
libonnxruntime_framework.a
libonnxruntime_graph.a
libonnxruntime_mlas.a
libonnxruntime_optimizer.a
libonnxruntime_providers.a
libonnxruntime_providers_nnapi.a
libonnxruntime_session.a
libonnxruntime_test_utils.a
libonnxruntime_util.a
libonnx_test_data_proto.a
libonnx_test_runner_common.a
The C++ examples shows that developers need to use onnxruntime library, but I don't have it. Please tell me what I should specify in CMakeLists.txt to build my application?
Urgency
none
System information
To Reproduce
./build.sh --android --android_sdk_path <android sdk path> --android_ndk_path <android ndk path> --use_dnnlibraryExpected behavior
Build folder contains an onnxruntime library or library provide CMakeLists.txt example.
Please append "--build_shared_lib" to the build comand
Please append "--build_shared_lib" to the build comand
Thanks for flag. The library was assembled correctly, but what should I do next? Could you help me with execution provider?
string log_id = "Foo";
auto logging_manager = std::make_unique<LoggingManager>
(std::unique_ptr<ISink>{new CLogSink{}},
static_cast<Severity>(lm_info.default_warning_level),
false,
LoggingManager::InstanceType::Default,
&log_id)
Environment::Create(std::move(logging_manager), env)
InferenceSession session_object{so,env};
session_object.RegisterExecutionProvider(std::make_unique<::onnxruntime::NnapiExecutionProvider>());
status = session_object.Load(model_file_name);
Unfortunatiely, I there are no LoggingManager and NnapiExecutionProvider in includes folder, but if I use headers from onnxruntime internal sources compiler writes errors like:
fatal error: 'core/framework/execution_provider.h' file not found
or
/home/user/ML/Android/onnxruntime/include/onnxruntime/core/common/logging/logging.h:14:10: fatal error: 'core/common/common.h' file not found
Thanks for your help.
You will need to include the libonnxruntime.so and header files from https://github.com/microsoft/onnxruntime/tree/master/include/onnxruntime/core
Depends on which API you want to use, you may choose to include
https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_c_api.h
or
https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_cxx_api.h
If you want to use NNAPI, you need to include
https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h
The usage of ORT using native code (NDK) is similar to these example code,
https://github.com/microsoft/onnxruntime/blob/9cca219b1aa2dd649d731298ba1249a184c9133f/docs/C_API.md
Now, it is working and give 9x speedup on squeezenet. Thank you very much!
Most helpful comment
You will need to include the libonnxruntime.so and header files from https://github.com/microsoft/onnxruntime/tree/master/include/onnxruntime/core
Depends on which API you want to use, you may choose to include
https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_c_api.h
or
https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_cxx_api.h
If you want to use NNAPI, you need to include
https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h
The usage of ORT using native code (NDK) is similar to these example code,
https://github.com/microsoft/onnxruntime/blob/9cca219b1aa2dd649d731298ba1249a184c9133f/docs/C_API.md