Thin wrapper of ONNX runtime for openFrameworks
Forks
Forks pushed to more recently than yutaokuyama/ofxOrt itself, plus any admin-confirmed fork with commits of its own — worth checking if you're hitting issues with the original.
README
ofxOrt
Thin wrapper of ONNX runtime for openFrameworks.
Note
This addon is still in an experimental stage, and I'm not skilled developer, so I'll make breaking changes frequently :(Dependencies
- ofxCv
- ofxOpenCV
Prepare
Install ONNX runtime by following the document.Environment
Author's environment is- Windows10
- NVIDIA Driver:462.80
- CUDA 11.0.221
- cuDNN: 8.0.2.39
- Visual studio 2019
- oF:11.0
Usage
Prepare ONNX model and copy it to/bin Windows
If you use CUDA on windows, please copyonnxruntime_providers_cuda.dll and onnxruntime_providers_shared.dll to /bin.``
C++ //First, create ofxOrt instance ofxOrt ofxOrt(ORT_TSTR("model.name");
//Create input and output tensors auto memory_info = Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeCPU); ofxOrtImageTensor<float> input_tensor(memory_info, content.getTexture()); ofxOrtImageTensor<float> output_tensor(memory_info, numChannels, outWidth, outHeight, true);
//Run inference ort.forward(Ort::RunOptions{ nullptr }, input_names, &(input_tensor.getTensor()), 1, output_names, &(output_tensor.getTensor()), 1); ``
ofxAddons