← Back

ofxOrt

github.com/yutaokuyama/ofxOrt · @yutaokuyama
OF 0.11 Machine Learning Artificial Intelligence

Thin wrapper of ONNX runtime for openFrameworks

19 4 Last commit 3y ago Created 5y ago

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.

federicohyo/ofxOrt by @federicohyo · ★ 0 · pushed 2y ago

README

ofxOrt

Thin wrapper of ONNX runtime for openFrameworks.
Image from Gyazo

Note

This addon is still in an experimental stage, and I'm not skilled developer, so I'll make breaking changes frequently :(

Dependencies

Prepare

Install ONNX runtime by following the document.

Environment

Author's environment is I think it may also work in other environments, such as Linux and Mac, but I have not tested.(I'll be verifying this soon.)

Usage

Prepare ONNX model and copy it to /bin

Windows

If you use CUDA on windows, please copy onnxruntime_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);
``

References

ONNX Runtime Inference Examples onnx_runtime_cpp

License

ofxOrt is under MIT license.

Get this addon

HTTPS
SSH