![]() |
VOOZH | about |
dotnet add package JYPPX.OpenVINO.CSharp.API --version 3.3.0
NuGet\Install-Package JYPPX.OpenVINO.CSharp.API -Version 3.3.0
<PackageReference Include="JYPPX.OpenVINO.CSharp.API" Version="3.3.0" />
<PackageVersion Include="JYPPX.OpenVINO.CSharp.API" Version="3.3.0" />Directory.Packages.props
<PackageReference Include="JYPPX.OpenVINO.CSharp.API" />Project file
paket add JYPPX.OpenVINO.CSharp.API --version 3.3.0
#r "nuget: JYPPX.OpenVINO.CSharp.API, 3.3.0"
#:package JYPPX.OpenVINO.CSharp.API@3.3.0
#addin nuget:?package=JYPPX.OpenVINO.CSharp.API&version=3.3.0Install as a Cake Addin
#tool nuget:?package=JYPPX.OpenVINO.CSharp.API&version=3.3.0Install as a Cake Tool
👁 NuGet
👁 Downloads
👁 .NET
👁 OpenVINO
| 简体中文
英特尔发行版 OpenVINO™工具套件基于oneAPI 而开发,可以加快高性能计算机视觉和深度学习视觉应用开发速度工具套件,适用于从边缘到云的各种英特尔平台上,帮助用户更快地将更准确的真实世界结果部署到生产系统中。通过简化的开发工作流程, OpenVINO™可赋能开发者在现实世界中部署高性能应用程序和算法。
OpenVINO C# API 是 Intel OpenVINO 的 .NET 封装库,让 C# 开发者能够在 Windows、Linux、macOS 上高性能运行深度学习模型推理,支持 YOLO、ResNet、BERT 等主流模型。
当前开发版本为 OpenVINO™ C# API 3.3.0,该版本继续保持已发布 API 兼容,并补齐 OpenVINO 2026.2 C API、OpenVINO GenAI C API、runtime 自动打包、测试和文档。
OpenVinoSharp.GenAI 封装,覆盖 LLM、Whisper、VLM 等 OpenVINO GenAI C API。Core、Model、Tensor、CompiledModel、InferRequest 时不会加载 openvino_genai_c。最后,如果各位在使用中有什么问题,可以与我沟通联系,也欢迎广大C#开发者加入到OpenVINO™ C# API 开发中。
┌─────────────────────────────────────────────────────────────────────────┐
│ 一句话了解 │
│ ───────────────────────────────────────────────────────────────────── │
│ 用 C# 跑 AI 模型推理,跨平台、高性能、支持 .NET 4.6 到 .NET 10.0 │
├─────────────────────────────────────────────────────────────────────────┤
│ 四大核心优势 │
│ ───────────────────────────────────────────────────────────────────── │
│ 🚀 高性能 │ Span<T> 零拷贝内存,推理速度媲美 Python/C++ │
│ 🖥️ 跨平台 │ Windows/Linux/macOS,x64/ARM64 全支持 │
│ 🔄 异步化 │ async/await 异步推理,轻松应对高并发场景 │
│ 🔌 多设备 │ Intel CPU/iGPU/GPU/NPU,AMD CPU(部分支持) │
├─────────────────────────────────────────────────────────────────────────┤
│ 适用场景 │
│ ───────────────────────────────────────────────────────────────────── │
│ 目标检测(YOLO) │ 图像分类(ResNet) │ OCR │ 人脸识别 │ 语音合成 │ NLP │
└─────────────────────────────────────────────────────────────────────────┘
dotnet add package JYPPX.OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.win
(第二个包在不同平台设备需要安装不同的包)
如果需要使用 OpenVinoSharp.GenAI,请安装对应平台的 GenAI runtime 包,例如:
dotnet add package JYPPX.OpenVINO.GenAI.runtime.win
using OpenVinoSharp;
// 加载模型(支持 .xml/.onnx等格式)
using var core = new Core();
var model = core.compile_model("yolov8n.xml", "CPU");
// 创建推理请求并执行
using var request = model.create_infer_request();
request.set_input_tensor(new Tensor(shape, imageData));
request.infer();
// 获取检测结果
var output = request.get_output_tensor().get_data<float>();
dotnet run
📚 查看完整 YOLO 案例(包含 .NET 4.6/4.8/Core 3.1/10.0 四个版本)
| 资源 | 链接 | 说明 |
|---|---|---|
| API 文档 | guojin-yan.github.io/OpenVINO-CSharp-API | 完整的类库参考 |
| 案例源码 | samples/ | 4 个框架版本的 YOLO 检测案例 |
| NuGet 包 | nuget.org/packages/JYPPX.OpenVINO.CSharp.API | 最新版本下载 |
| 特性 | 说明 | 适用框架 |
|---|---|---|
| 🚀 多框架支持 | 支持 .NET Framework 4.6-4.8 和 .NET 5.0-10.0 | 全部 |
| 🖥️ 跨平台 | Windows、Linux、macOS 全平台支持 | 全部 |
| ⚡ 高性能 | Span<T>/Memory<T> 零拷贝内存操作 |
.NET Core 2.1+ / .NET 4.7.2+ |
| 🔄 异步推理 | 完整的 async/await 异步推理支持 | .NET Core 3.0+ |
| 💾 模型缓存 | 自动缓存编译后的模型,避免重复编译 | 全部 |
| 🏊 对象池 | 推理请求对象池,减少频繁创建销毁的开销 | 全部 |
| 📝 完整日志 | 可配置的多级别日志系统 | 全部 |
| 🌍 双语注释 | 完整的中英文 XML 文档注释 | 全部 |
| Package | Description | Link |
|---|---|---|
| JYPPX.OpenVINO.CSharp.API | OpenVINO C# API core libraries | 👁 NuGet Gallery |
| Package | Description | Link |
|---|---|---|
| OpenVINO.runtime.win | Native bindings for Windows | 👁 NuGet Gallery |
| JYPPX.OpenVINO.GenAI.runtime.win | Native OpenVINO GenAI runtime for Windows | GitHub workflow: docs/articles/installation/genai-runtime.md |
| JYPPX.OpenVINO.GenAI.runtime.ubuntu.24-x86_64 | Native OpenVINO GenAI runtime for Ubuntu 24 x86_64 | GitHub workflow: docs/articles/installation/genai-runtime.md |
| JYPPX.OpenVINO.GenAI.runtime.ubuntu.22-x86_64 | Native OpenVINO GenAI runtime for Ubuntu 22 x86_64 | GitHub workflow: docs/articles/installation/genai-runtime.md |
| JYPPX.OpenVINO.GenAI.runtime.ubuntu.22-arm64 | Native OpenVINO GenAI runtime for Ubuntu 22 ARM64 | GitHub workflow: docs/articles/installation/genai-runtime.md |
| JYPPX.OpenVINO.GenAI.runtime.rhel8-x86_64 | Native OpenVINO GenAI runtime for RHEL 8 x86_64 | GitHub workflow: docs/articles/installation/genai-runtime.md |
| JYPPX.OpenVINO.GenAI.runtime.macos-arm64 | Native OpenVINO GenAI runtime for macOS ARM64 | GitHub workflow: docs/articles/installation/genai-runtime.md |
| OpenVINO.runtime.ubuntu.24-x86_64 | Native bindings for ubuntu.24-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.ubuntu.22-x86_64 | Native bindings for ubuntu.22-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.ubuntu.20-x86_64 | Native bindings for ubuntu.20-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.ubuntu.20-arm64 | Native bindings for ubuntu.20-arm64 | 👁 NuGet Gallery |
| OpenVINO.runtime.ubuntu.18-x86_64 | Native bindings for ubuntu.18-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.ubuntu.18-arm64 | Native bindings for uOpenVINO.runtime.ubuntu.18-arm64 | 👁 NuGet Gallery |
| OpenVINO.runtime.debian10-armhf | Native bindings for debian10-armhf | 👁 NuGet Gallery |
| OpenVINO.runtime.debian9-arm64 | Native bindings for debian9-arm64 | 👁 NuGet Gallery |
| OpenVINO.runtime.debian9-armhf | Native bindings for debian9-armhf | 👁 NuGet Gallery |
| OpenVINO.runtime.centos7-x86_64 | Native bindings for centos7-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.rhel8-x86_64 | Native bindings for rhel8-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.macos-x86_64 | Native bindings for macos-x86_64 | 👁 NuGet Gallery |
| OpenVINO.runtime.macos-arm64 | Native bindings for macos-arm64 | 👁 NuGet Gallery |
GenAI runtime packages are published only for official archives that also have
a valid .sha256 sidecar. OpenVINO GenAI 2026.2.0 does not currently provide
packageable Ubuntu 20.04 or macOS x86_64 GenAI archives, even though the core
OpenVINO runtime still has packages for those platforms.
| Package | Description | Link |
|---|---|---|
| OpenVINO.CSharp.Windows | All-in-one package for Windows | 👁 NuGet Gallery |
using OpenVinoSharp;
// 方式1:自动加载(推荐)
// Core 会自动加载 OpenVINO 动态库,但需要先安装运行时包:
// NuGet: OpenVINO.runtime.win / OpenVINO.runtime.ubuntu / OpenVINO.runtime.macos等,具体根据自己设备安装
using var core = new Core();
// 方式2:手动指定动态库路径(Linux/macOS 等自定义安装场景)
// 如果未安装运行时包,或动态库不在默认搜索路径,需手动初始化
// Linux 示例:
Ov.Initialize("/opt/intel/openvino/lib/openvino_c.so");
// Linux 环境变量设置(如需永久生效,添加到 ~/.bashrc):
// export LD_LIBRARY_PATH=/opt/intel/openvino/lib:$LD_LIBRARY_PATH
// Windows 示例:
Ov.Initialize(".\dll\win-x64/openvino_c.dll");
💡 提示:Windows 通常自动识别,Linux/macOS 若遇到
DllNotFoundException,请确保已安装对应平台的OpenVINO.runtime.xxxNuGet 包,或手动指定库路径。
// 启动异步推理
request.start_async();
// 等待完成(带超时)
bool completed = request.wait_for(5000); // 5秒超时
if (completed)
{
var output = request.get_output_tensor();
// 处理结果...
}
// 创建推理请求池
using var pool = new InferRequestPool(compiledModel, initialSize: 4, maxSize: 16);
// 使用对象池执行推理
pool.RunInference(
request => request.set_input_tensor(input),
request =>
{
var output = request.get_output_tensor();
ProcessResults(output);
}
);
// 使用 Span<T> 直接访问底层内存,避免数组拷贝
Span<float> data = tensor.get_span<float>();
for (int i = 0; i < data.Length; i++)
{
data[i] = data[i] / 255.0f; // 原地归一化
}
OpenVINO.CSharp.API/
├── src/OpenVINO.CSharp.API/ # 源代码
│ ├── core/ # 核心类 (Core, Tensor, InferRequest等)
│ ├── preprocess/ # 预处理 (PrePostProcessor)
│ ├── extensions/ # 扩展功能 (Benchmark, Utils)
│ ├── native/ # C API P/Invoke 声明
│ └── Internal/ # 内部工具类
├── samples/ # 示例项目
│ ├── Yolo26Det-net4.6/ # .NET Framework 4.6 示例
│ ├── Yolo26Det-net4.8/ # .NET Framework 4.8 示例
│ ├── Yolo26Det-netcoreapp3.1/# .NET Core 3.1 示例
│ └── Yolo26Det-net10.0/ # .NET 10.0 示例
├── docs/ # 文档配置
├── .github/workflows/ # CI/CD 工作流
└── README.md # 本文件
# 克隆仓库
git clone https://github.com/guojin-yan/OpenVINO-CSharp-API.git
cd OpenVINO-CSharp-API
# 还原依赖
dotnet restore
# 构建项目
dotnet build -c Release
# 打包 NuGet 包
dotnet pack -c Release
using OpenVinoSharp.Internal;
// 设置最小日志级别
OvLogger.MinLevel = LogLevel.DEBUG;
// 启用时间戳
OvLogger.EnableTimestamp = true;
// 设置自定义日志回调(集成 NLog/Serilog 等)
OvLogger.SetCallback((level, message) =>
{
Console.WriteLine($"[{level}] {message}");
});
| 格式 | 扩展名 | 说明 |
|---|---|---|
| OpenVINO IR | .xml + .bin | 推荐格式,Intel 优化最佳 |
| ONNX | .onnx | 通用格式,主流框架都支持导出 |
| PaddlePaddle | .pdmodel | 百度飞桨模型 |
| 平台 | 最低版本 | 支持架构 |
|---|---|---|
| Windows | Windows 10+ | x64, x86 |
| Linux | Ubuntu 18.04+ / CentOS 7+ | x64, ARM64 |
| macOS | 10.15+ | x64, ARM64 |
欢迎提交 Issue 和 Pull Request!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)本项目采用 开源。
1. 开源协议声明
作者所有开源项目代码均遵循 Apache License 2.0 开源协议。
特别说明:本项目集成了若干第三方库。若任何第三方库的许可协议与 Apache 2.0 协议存在冲突或不一致,均以该第三方库的原始许可协议为准。本项目不包含也不代表这些第三方库的授权声明,使用前请务必阅读并遵守第三方库的相关许可。
2. 代码开发与质量说明
3. 免责声明(重要)
请在将本代码应用于任何实际项目(特别是商业、工业或关键任务环境)之前,务必进行详尽、严格的自行测试与验证。 鉴于上述可能存在的代码缺陷及测试覆盖不足,因使用本代码而导致的任何直接或间接损失(包括但不限于设备故障、数据丢失、系统瘫痪或利润损失等),本作者概不负责。 一旦您开始使用本代码,即表示您已知晓上述风险并同意自行承担一切后果,相关问题与本作者无关。
4. 代码开源范围
本项目承诺核心逻辑代码完全开源,但上述提到的“第三方库”的二进制文件、源代码或相关资源不在本项目的开源义务范围内,请根据其各自的指引获取。
5. 社区与反馈
尽管存在上述不足,我们仍欢迎大家下载使用、提交 Issue 或参与测试,共同完善项目。如果您在使用过程中发现 Bug、内存溢出或有改进建议,欢迎通过项目主页提供的联系方式与作者取得联系,我们将尽力在有限的时间内提供协助。
Copyright © 2026 Guojin Yan. All Rights Reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Framework | net46 net46 is compatible. net461 net461 is compatible. net462 net462 is compatible. net463 net463 was computed. net47 net47 is compatible. net471 net471 is compatible. net472 net472 is compatible. net48 net48 is compatible. net481 net481 is compatible. |
Showing the top 1 NuGet packages that depend on JYPPX.OpenVINO.CSharp.API:
| Package | Downloads |
|---|---|
|
JYPPX.DeploySharp
DeploySharp is a cross-platform model deployment framework designed for C# developers, offering end-to-end solutions from model loading and configuration management to inference execution. Its modular namespace architecture significantly reduces the complexity of integrating deep learning models into the C# ecosystem. |
Showing the top 1 popular GitHub repositories that depend on JYPPX.OpenVINO.CSharp.API:
| Repository | Stars |
|---|---|
|
guojin-yan/DeploySharp
Deploying deep learning models on multiple platforms (OpenVINO/ONNX Runtime, etc.)
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.3.0 | 128 | 6/10/2026 |
| 3.2.2 | 1,052 | 3/7/2026 |
| 3.2.1 | 110 | 3/7/2026 |
| 3.2.0 | 154 | 2/24/2026 |
| 3.2.0-beta | 113 | 2/22/2026 |
3.3.0: refreshed OpenVINO 2026.2 C API coverage, added optional OpenVINO GenAI C API wrappers, improved UTF-8 and Unicode path handling, kept GenAI runtime optional for core APIs, updated runtime packaging workflows, tests, samples, and documentation.