OpenVINO C# API

June 10, 2026 · View on GitHub

OpenVINO™ C# API

OpenVINO C# API

License NuGet Downloads .NET OpenVINO

English | 简体中文

Intel Distribution OpenVINO™ tool suite is developed based on oneAPI and can accelerate the development of high-performance computer vision and deep learning applications. It is suitable for various Intel platforms from the edge to the cloud, helping users deploy more accurate real-world results to production systems faster. By simplifying the development workflow, OpenVINO™ empowers developers to deploy high-performance applications and algorithms in the real world.

OpenVINO C# API is a .NET wrapper library for Intel OpenVINO, enabling C# developers to run deep learning model inference with high performance on Windows, Linux, and macOS. Supports mainstream models like YOLO, ResNet, BERT, etc.

The current development version is OpenVINO™ C# API 3.3.0. This release keeps the published API compatible, refreshes OpenVINO 2026.2 C API coverage, adds optional OpenVINO GenAI C API wrappers, and updates runtime packaging, tests, samples, and documentation.

📢 3.3.0 Release Highlights

  • Keeps the published core API compatible while refreshing OpenVINO 2026.2 C API coverage and adding C# friendly PascalCase helpers.
  • Adds optional OpenVinoSharp.GenAI wrappers for LLM, Whisper, VLM, and related OpenVINO GenAI C APIs.
  • Keeps GenAI runtime optional: applications that only use Core, Model, Tensor, CompiledModel, or InferRequest do not load openvino_genai_c.
  • Updates runtime NuGet automation for both core OpenVINO runtime and GenAI runtime. GenAI 2026.2 packages cover Windows, Ubuntu, RHEL, and macOS ARM64.
  • Strengthens UTF-8 strings, Windows Unicode paths, owned/borrowed native pointer lifetimes, tests, samples, and documentation.

Finally, if you have any questions during use, you can communicate and contact me. We also welcome C# developers to join OpenVINO™ C# API development.

┌─────────────────────────────────────────────────────────────────────────┐
│  One Sentence Summary                                                    │
│  ─────────────────────────────────────────────────────────────────────  │
│  Run AI model inference in C#, cross-platform, high-performance,         │
│  supporting .NET 4.6 to .NET 10.0                                        │
├─────────────────────────────────────────────────────────────────────────┤
│  Four Core Advantages                                                    │
│  ─────────────────────────────────────────────────────────────────────  │
│  🚀 High Performance  │  Span<T> zero-copy memory, speed rivals Python/C++│
│  🖥️ Cross-Platform    │  Windows/Linux/macOS, x64/ARM64 full support     │
│  🔄 Async Support     │  async/await async inference for high concurrency│
│  🔌 Multi-Device      │  Intel CPU/iGPU/GPU/NPU, AMD CPU (partial)       │
├─────────────────────────────────────────────────────────────────────────┤
│  Use Cases                                                               │
│  ─────────────────────────────────────────────────────────────────────  │
│  Object Detection(YOLO) │ Image Classification │ OCR │ Face Recognition │
│  Speech Synthesis │ NLP                                                  │
└─────────────────────────────────────────────────────────────────────────┘

🚀 Get Started in 30 Seconds

1. Install NuGet Packages

dotnet add package JYPPX.OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.win
(Install different runtime packages for different platforms/devices)

If you need OpenVinoSharp.GenAI, install a matching GenAI runtime package, for example:

dotnet add package JYPPX.OpenVINO.GenAI.runtime.win

2. Write Inference Code

using OpenVinoSharp;

// Load model (supports .xml/.onnx formats)
using var core = new Core();
var model = core.compile_model("yolov8n.xml", "CPU");

// Create inference request and execute
using var request = model.create_infer_request();
request.set_input_tensor(new Tensor(shape, imageData));
request.infer();

// Get detection results
var output = request.get_output_tensor().get_data<float>();

3. Run the Program

dotnet run

📚 View Full YOLO Samples (Includes four versions for .NET 4.6/4.8/Core 3.1/10.0)


📖 Detailed Documentation

ResourceLinkDescription
API Docsguojin-yan.github.io/OpenVINO-CSharp-APIComplete class library reference
Sample Codesamples/YOLO detection samples for 4 framework versions
NuGet Packagenuget.org/packages/JYPPX.OpenVINO.CSharp.APILatest version download

✨ Complete Feature List

FeatureDescriptionSupported Frameworks
🚀 Multi-FrameworkSupports .NET Framework 4.6-4.8 and .NET 5.0-10.0All
🖥️ Cross-PlatformFull support for Windows, Linux, macOSAll
High PerformanceSpan<T>/Memory<T> zero-copy memory operations.NET Core 2.1+ / .NET 4.7.2+
🔄 Async InferenceComplete async/await async inference support.NET Core 3.0+
💾 Model CachingAutomatic caching of compiled models to avoid recompilationAll
🏊 Object PoolInference request object pool to reduce creation/destruction overheadAll
📝 Complete LoggingConfigurable multi-level logging systemAll
🌍 Bilingual CommentsComplete Chinese and English XML documentationAll

📦 NuGet Packages

Core Managed Libraries

PackageDescriptionLink
JYPPX.OpenVINO.CSharp.APIOpenVINO C# API core librariesNuGet Gallery

Native Runtime Libraries

PackageDescriptionLink
OpenVINO.runtime.winNative bindings for WindowsNuGet Gallery
JYPPX.OpenVINO.GenAI.runtime.winNative OpenVINO GenAI runtime for WindowsGitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.ubuntu.24-x86_64Native OpenVINO GenAI runtime for Ubuntu 24 x86_64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.ubuntu.22-x86_64Native OpenVINO GenAI runtime for Ubuntu 22 x86_64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.ubuntu.22-arm64Native OpenVINO GenAI runtime for Ubuntu 22 ARM64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.ubuntu.20-x86_64Native OpenVINO GenAI runtime for Ubuntu 20 x86_64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.ubuntu.20-arm64Native OpenVINO GenAI runtime for Ubuntu 20 ARM64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.rhel8-x86_64Native OpenVINO GenAI runtime for RHEL 8 x86_64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.macos-x86_64Native OpenVINO GenAI runtime for macOS x86_64GitHub workflow: docs/articles/installation/genai-runtime.md
JYPPX.OpenVINO.GenAI.runtime.macos-arm64Native OpenVINO GenAI runtime for macOS ARM64GitHub workflow: docs/articles/installation/genai-runtime.md
OpenVINO.runtime.ubuntu.24-x86_64Native bindings for ubuntu.24-x86_64NuGet Gallery
OpenVINO.runtime.ubuntu.22-x86_64Native bindings for ubuntu.22-x86_64NuGet Gallery
OpenVINO.runtime.ubuntu.20-x86_64Native bindings for ubuntu.20-x86_64NuGet Gallery
OpenVINO.runtime.ubuntu.20-arm64Native bindings for ubuntu.20-arm64NuGet Gallery
OpenVINO.runtime.ubuntu.18-x86_64Native bindings for ubuntu.18-x86_64NuGet Gallery
OpenVINO.runtime.ubuntu.18-arm64Native bindings for ubuntu.18-arm64NuGet Gallery
OpenVINO.runtime.debian10-armhfNative bindings for debian10-armhfNuGet Gallery
OpenVINO.runtime.debian9-arm64Native bindings for debian9-arm64NuGet Gallery
OpenVINO.runtime.debian9-armhfNative bindings for debian9-armhfNuGet Gallery
OpenVINO.runtime.centos7-x86_64Native bindings for centos7-x86_64NuGet Gallery
OpenVINO.runtime.rhel8-x86_64Native bindings for rhel8-x86_64NuGet Gallery
OpenVINO.runtime.macos-x86_64Native bindings for macos-x86_64NuGet Gallery
OpenVINO.runtime.macos-arm64Native bindings for macos-arm64NuGet Gallery

Integration Library

PackageDescriptionLink
OpenVINO.CSharp.WindowsAll-in-one package for WindowsNuGet Gallery

🚀 More Usage Examples

Initialization and Dynamic Library Loading (Must Read)

using OpenVinoSharp;

// Method 1: Auto-load (Recommended)
// Core will auto-load OpenVINO dynamic libraries, but you need to install runtime packages first:
//   NuGet: OpenVINO.runtime.win / OpenVINO.runtime.ubuntu / OpenVINO.runtime.macos etc.
using var core = new Core();

// Method 2: Manually specify dynamic library path (Linux/macOS custom installation)
// If runtime package not installed, or library not in default search path, initialize manually
// Linux example:
Ov.Initialize("/opt/intel/openvino/lib/openvino_c.so");
// Linux environment variable setup (add to ~/.bashrc for permanent effect):
//   export LD_LIBRARY_PATH=/opt/intel/openvino/lib:$LD_LIBRARY_PATH

// Windows example:
Ov.Initialize(".\dll\win-x64/openvino_c.dll");

💡 Tip: Windows usually auto-detects. For Linux/macOS, if you encounter DllNotFoundException, ensure the corresponding platform's OpenVINO.runtime.xxx NuGet package is installed, or manually specify the library path.

// Start async inference
request.start_async();

// Wait for completion (with timeout)
bool completed = request.wait_for(5000); // 5 second timeout
if (completed)
{
    var output = request.get_output_tensor();
    // Process results...
}

Using Object Pool (Batch Processing)

// Create inference request pool
using var pool = new InferRequestPool(compiledModel, initialSize: 4, maxSize: 16);

// Execute inference using object pool
pool.RunInference(
    request => request.set_input_tensor(input),
    request => 
    {
        var output = request.get_output_tensor();
        ProcessResults(output);
    }
);

Zero-Copy Tensor Operations (High Performance Mode)

// Use Span<T> to directly access underlying memory, avoiding array copies
Span<float> data = tensor.get_span<float>();
for (int i = 0; i < data.Length; i++)
{
    data[i] = data[i] / 255.0f; // In-place normalization
}

🏗️ Project Structure

OpenVINO.CSharp.API/
├── src/OpenVINO.CSharp.API/    # Source code
│   ├── core/                   # Core classes (Core, Tensor, InferRequest, etc.)
│   ├── preprocess/             # Preprocessing (PrePostProcessor)
│   ├── extensions/             # Extensions (Benchmark, Utils)
│   ├── native/                 # C API P/Invoke declarations
│   └── Internal/               # Internal utility classes
├── samples/                     # Sample projects
│   ├── Yolo26Det-net4.6/       # .NET Framework 4.6 sample
│   ├── Yolo26Det-net4.8/       # .NET Framework 4.8 sample
│   ├── Yolo26Det-netcoreapp3.1/# .NET Core 3.1 sample
│   └── Yolo26Det-net10.0/      # .NET 10.0 sample
├── docs/                        # Documentation configuration
├── .github/workflows/           # CI/CD workflows
└── README.md                    # This file

🔧 Build Project

Requirements

  • .NET SDK 5.0 or higher (or Visual Studio 2019+)
  • OpenVINO Runtime 2026.2+

Build Steps

# Clone repository
git clone https://github.com/guojin-yan/OpenVINO-CSharp-API.git
cd OpenVINO-CSharp-API

# Restore dependencies
dotnet restore

# Build project
dotnet build -c Release

# Pack NuGet package
dotnet pack -c Release

📝 Logging Configuration

using OpenVinoSharp.Internal;

// Set minimum log level
OvLogger.MinLevel = LogLevel.DEBUG;

// Enable timestamps
OvLogger.EnableTimestamp = true;

// Set custom log callback (integrate with NLog/Serilog, etc.)
OvLogger.SetCallback((level, message) =>
{
    Console.WriteLine($"[{level}] {message}");
});

🛠️ Supported Model Formats

FormatExtensionDescription
OpenVINO IR.xml + .binRecommended format, best Intel optimization
ONNX.onnxUniversal format, supported by major frameworks
PaddlePaddle.pdmodelBaidu PaddlePaddle models

💻 System Requirements

PlatformMinimum VersionSupported Architectures
WindowsWindows 10+x64, x86
LinuxUbuntu 18.04+ / CentOS 7+x64, ARM64
macOS10.15+x64, ARM64

🤝 How to Contribute

Contributions via Issue and Pull Request are welcome!

  1. Fork this repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is open-sourced under the Apache-2.0 License.

🙏 Acknowledgments

📮 Contact


📢 Software Statement

1. Open Source License Statement

All open-source project code from the author is released under the Apache License 2.0.

Special Note: This project integrates several third-party libraries. If any third-party library's license conflicts with or differs from the Apache 2.0 license, the original license of that third-party library shall prevail. This project does not contain nor represent authorization statements for these third-party libraries. Please be sure to read and comply with the relevant licenses of third-party libraries before use.

2. Code Development and Quality Statement

  • AI-Assisted Development: This code was generated and optimized using artificial intelligence (AI) assistance during development and was not entirely written manually line by line.
  • Security Commitment: The author solemnly declares that there are absolutely no intentionally set backdoors, viruses, trojans, or malicious code designed to damage user devices or steal data in this code.
  • Technical Limitations: Due to the author's personal technical level and capabilities, there may be low-level issues in the code caused by non-rigorous logic, insufficient optimization, or lack of experience (such as but not limited to memory leaks, occasional crashes, unreleased resources, etc.). These issues are purely due to insufficient capability and are not intentional.
  • Test Coverage: Due to limited author energy, this software has not undergone comprehensive testing covering all edge cases.

3. Disclaimer (Important)

Please be sure to conduct thorough and rigorous testing and verification before applying this code to any actual projects (especially commercial, industrial, or mission-critical environments). Given the potential code defects and insufficient test coverage mentioned above, the author is not responsible for any direct or indirect losses caused by using this code (including but not limited to equipment failure, data loss, system paralysis, or profit loss, etc.). Once you start using this code, it means you are aware of the above risks and agree to bear all consequences yourself. Related issues have nothing to do with this author.

4. Code Open Source Scope

This project promises that the core logic code is completely open source, but the binary files, source code, or related resources of the aforementioned "third-party libraries" are not within the open source obligations of this project. Please obtain them according to their respective guidelines.

5. Community and Feedback

Despite the above shortcomings, we still welcome everyone to download and use, submit Issues, or participate in testing to jointly improve the project. If you discover bugs, memory overflow, or have improvement suggestions during use, please contact the author through the contact information provided on the project homepage. We will try our best to provide assistance within limited time.


image-20250224211044113

Copyright © 2026 Guojin Yan. All Rights Reserved.