onnxruntime/samples/c_cxx
Faith Xu d9cdf4b4ed
Doc updates (#1522)
* Updates

* Remove preview texts

* Update README.md

* Updates

* Update README.md

* Update README.md

* Minor wording update

* Update README.md

* Update doc on CUDA version

* revert update

* Update readme for issue #1558

* Clean up example section

* Cosmetic updates

- Add a index of build instructions for browsability
- Update build CUDA version from 9.1 to 10

* Fix broken link

* Update README to reflect upgrade to pip requirement

* Update CuDNN version for Linux Python packages

* Clean up content

Updated ordering and add table of contents

* Minor format fixes

* Move Android NNAPI under EP section

* Add link to operator support documentation

* Fix typo

* typo fix

* remove todo section
2019-08-27 21:31:19 -07:00
..
fns_candy_style_transfer Doc updates (#1522) 2019-08-27 21:31:19 -07:00
imagenet Don't create the default allocator every single time. Rename API accordingly. Expose Session/Run log severity levels. (#1615) 2019-08-23 10:33:20 -07:00
include Sample for imagenet and batch prediction (#1372) 2019-07-16 14:23:45 -07:00
MNIST Sample for imagenet and batch prediction (#1372) 2019-07-16 14:23:45 -07:00
CMakeLists.txt Add docs for the fns candy demo (#1479) 2019-07-24 08:38:04 -07:00
README.md Add docs for the fns candy demo (#1479) 2019-07-24 08:38:04 -07:00
vs.png Document for the C/C++ samples (#1442) 2019-07-22 16:14:49 -07:00

This directory contains a few C/C++ sample applications for demoing onnxruntime usage:

  1. fns_candy_style_transfer: A C application that uses the FNS-Candy style transfer model to re-style images.
  2. MNIST: A windows GUI application for doing handwriting recognition
  3. imagenet: An end-to-end sample for the ImageNet Large Scale Visual Recognition Challenge 2012

How to build

Prerequisites

  1. Visual Studio 2015/2017/2019
  2. cmake(version >=3.13)
  3. (optional) libpng 1.6

You may get a precompiled libpng library from https://onnxruntimetestdata.blob.core.windows.net/models/libpng.zip

Install ONNX Runtime

You may either get a prebuit onnxruntime from nuget.org, or build it from source by following the BUILD.md document. If you build it by yourself, you must append the "--build_shared_lib" flag to your build command. Like:

build.bat --config RelWithDebInfo --build_shared_lib --parallel

When the build is done, run Visual Studio as administrator and open the onnxruntime.sln file in your build directory. vs.png

When the solution is loaded, change the build configuration to "RelWithDebInfo"(which must match your previous build command), then select the "INSTALL" project, and build it. It will install your onnxruntime to "C:\Program Files (x86)\onnxruntime"

Build the samples

Open cmd.exe, change your current directory to samples\c_cxx, then run

mkdir build
cmake .. -A x64 -T host=x64 -DLIBPNG_ROOTDIR=C:\path\to\your\libpng\binary

You may omit the "-DLIBPNG_ROOTDIR=..." argument if you don't have the libpng library.
You may append "-Donnxruntime_USE_CUDA=ON" to the last command args if your onnxruntime binary was built with CUDA support.

Then you can open the onnxruntime_samples.sln file in the "build" directory and build the solution.