Object detection with YOLOv3 in C# using OpenVINO Execution Provider:
-
The object detection sample uses YOLOv3 Deep Learning ONNX Model from the ONNX Model Zoo.
-
The sample involves presenting an image to the ONNX Runtime (RT), which uses the OpenVINO Execution Provider for ONNX RT to run inference on Intel® NCS2 stick (MYRIADX device). The sample uses ImageSharp for image processing and ONNX Runtime OpenVINO EP for inference.
The source code for this sample is available here.
How to build
Prerequisites
-
Install .NET Core 3.1 or higher for you OS (Mac, Windows or Linux).
-
Use any sample Image as input to the sample.
-
Download the latest YOLOv3 model from the ONNX Model Zoo. This example was adapted from ONNX Model Zoo.Download the latest version of the YOLOv3 model from here.
Install ONNX Runtime for OpenVINO Execution Provider
Build steps
Reference Documentation
To build nuget packages of onnxruntime with openvino flavour
./build.sh --config Release --use_openvino MYRIAD_FP16 --build_shared_lib --build_nuget
Build the sample C# Application
- Create a new console project
dotnet new console
-
Install Nuget Packages of Onnxruntime and ImageSharp
- Open the Visual C# Project file (.csproj) using VS19.
- Right click on project, navigate to manage Nuget Packages.
- Install SixLabors.ImageSharp Package from nuget.org.
- Install Microsoft.ML.OnnxRuntime.Managed and Microsoft.ML.OnnxRuntime.Openvino from your build directory nuget-artifacts.
-
Compile the sample
dotnet build
- Run the sample
dotnet run [path-to-model] [path-to-image] [path-to-output-image]