This directory contains a few C/C++ sample applications in Linux for demoing onnxruntime usage:
- (Windows and Linux) fns_candy_style_transfer: A C application that uses the FNS-Candy style transfer model to re-style images. It is written purely in C, no C++.
- (Linux) fns_candy_style_transfer_cxx: A C application that uses the FNS-Candy style transfer model to re-style images. It is written in C++.
- (Linux) MNIST_cxx: A handwriting recognition application that runs directly from the command line, without the Windows GUI. It's not as writable as the original MNIST, but you can use the test images from resources, or build more of your own, in 28x28 grayscale format.
- Linux Ubuntu/Centos
- cmake(version >=3.13)
- (optional) libpng 1.6
You may get a precompiled libpng library from https://onnxruntimetestdata.blob.core.windows.net/models/libpng.zip
You may either get a prebuit onnxruntime from https://github.com/microsoft/onnxruntime/releases/. For example, you may download onnxruntime-win-x64-***.zip and unzip it to any folder.
Open Developer Command Prompt for Visual Studio version you are going to use, change your current directory to samples\c_cxx, then run
mkdir build && cd build
cmake .. -DLIBPNG_ROOTDIR=\path\to\your\libpng\binary -DONNXRUNTIME_ROOTDIR=\path\to\your\ort_install
You may omit the "-DLIBPNG_ROOTDIR=..." argument if you don't have the libpng library. You may omit "-DONNXRUNTIME_ROOTDIR=..." if you installed to a default location.
You may append "-Donnxruntime_USE_CUDA=ON" or "-Donnxruntime_USE_DML=ON" to the last command args if your onnxruntime binary was built with CUDA or DirectML support respectively.
Using the Makefile generated by cmake, type make to compile the C++ code.
make
The executable files can be found in the project folder in the build directory.