OpenVINO.CSharp.API
2024.3.0.2
dotnet add package OpenVINO.CSharp.API --version 2024.3.0.2
NuGet\Install-Package OpenVINO.CSharp.API -Version 2024.3.0.2
<PackageReference Include="OpenVINO.CSharp.API" Version="2024.3.0.2" />
paket add OpenVINO.CSharp.API --version 2024.3.0.2
#r "nuget: OpenVINO.CSharp.API, 2024.3.0.2"
// Install OpenVINO.CSharp.API as a Cake Addin #addin nuget:?package=OpenVINO.CSharp.API&version=2024.3.0.2 // Install OpenVINO.CSharp.API as a Cake Tool #tool nuget:?package=OpenVINO.CSharp.API&version=2024.3.0.2
<p align="center">
<a href="./LICENSE.txt">
<img src="https://img.shields.io/github/license/guojin-yan/openvinosharp.svg">
</a>
<a >
<img src="https://img.shields.io/badge/Framework-.NET 8.0%2C%20.NET 6.0%2C%20.NET 5.0%2C%20.NET Framework 4.8%2C%20.NET Framework 4.7.2%2C%20.NET Framework 4.6%2C%20.NET Core 3.1-pink.svg">
</a>
</p>
简体中文| English
📚 简介
OpenVINO™ 是一个用于优化和部署 AI 推理的开源工具包。
- 提升深度学习在计算机视觉、自动语音识别、自然语言处理和其他常见任务中的性能
- 使用流行框架(如TensorFlow,PyTorch等)训练的模型
- 减少资源需求,并在从边缘到云的一系列英特尔®平台上高效部署
OpenVINO™ C# API 是一个 OpenVINO™ 的 .Net wrapper,应用最新的 OpenVINO™ 库开发,通过 OpenVINO™ C API 实现 .Net 对 OpenVINO™ Runtime 调用,使用习惯与 OpenVINO™ C++ API 一致。OpenVINO™ C# API 由于是基于 OpenVINO™ 开发,所支持的平台与 OpenVINO™ 完全一致,具体信息可以参考 OpenVINO™。通过使用 OpenVINO™ C# API,可以在 .NET、.NET Framework等框架下使用 C# 语言实现深度学习模型在指定平台推理加速。
<img title="NuGet" src="https://s2.loli.net/2023/08/08/jE6BHu59L4WXQFg.png" alt="" width="40">NuGet Package
Core Managed Libraries
Native Runtime Libraries
Integration Library
Package | Description | Link |
---|---|---|
OpenVINO.CSharp.Windows | All-in-one package for Windows |
⚙ 如何安装
以下提供了OpenVINO™ C# API在不同平台的安装方法,可以根据自己使用平台进行安装。
Windows
通过dotnet add package
指令安装或通过Visual Studio安装以下程序包
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.win
或者安装集成包——>
dotnet add package OpenVINO.CSharp.Windows
Linux
linux平台我们根据官方编译的平台制作了对应的NuGet Package,以ubuntu.22-x86_64为例,通过dotnet add package
指令安装:
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.ubuntu.22-x86_64
运行一次程序后,添加环境变量:
export LD_LIBRARY_PATH={Program generated executable file directory}/runtimes/ubuntu.22-x86_64/native
例如——>
export LD_LIBRARY_PATH=/home/ygj/Program/sample1/bin/Debug/net6.0/runtimes/ubuntu.22-x86_64/native
如果对于一个全新平台(未安装过OpenVINO C++),需要安装一下依赖环境,切换到{Program generated executable file directory}/runtimes/ubuntu.22-x86_64/native
目录下,运行以下指令:
sudo -E ./install_openvino_dependencies.sh
Mac OS
通过dotnet add package
指令安装以下程序包
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.macos-arm64
🏷开始使用
- 使用方法
如果你不知道如何使用,通过下面代码简单了解使用方法。
using OpenVinoSharp; // 引用命名空间
namespace test
{
internal class Program
{
static void Main(string[] args)
{
using Core core = new Core(); // 初始化 Core 核心
using Model model = core.read_model("./model.xml"); // 读取模型文件
using CompiledModel compiled_model = core.compiled_model(model, "AUTO"); // 将模型加载到设备
using InferRequest infer_request = compiled_model.create_infer_request(); // 创建推理通道
using Tensor input_tensor = infer_request.get_tensor("images"); // 获取输入节点Tensor
infer_request.infer(); // 模型推理
using Tensor output_tensor = infer_request.get_tensor("output0"); // 获取输出节点Tensor
}
}
}
项目中所封装的类、对象例如Core、Model、Tensor等,通过调用 C api 接口实现,具有非托管资源,需要调用Dispose()方法处理或者使用using,否则就会出现内存泄漏。
💻 应用案例
获取耕读应用案例请参考:OpenVINO-CSharp-API-Samples
🗂 API 文档
如果想了解更多信息,可以参阅:OpenVINO™ C# API API Documented
🎖 贡献
如果您对OpenVINO™ 在C#使用感兴趣,有兴趣对开源社区做出自己的贡献,欢迎加入我们,一起开发OpenVINO™ C# API。
如果你对该项目有一些想法或改进思路,欢迎联系我们,指导下我们的工作。
<img title="" src="https://user-images.githubusercontent.com/48054808/157835345-f5d24128-abaf-4813-b793-d2e5bdc70e5a.png" alt="" width="40"> 许可证书
本项目的发布受Apache 2.0 license许可认证。
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on OpenVINO.CSharp.API:
Package | Downloads |
---|---|
OpenVINO.CSharp.API.Extensions
Based on the C # platform, call the OpenVINO suite to deploy a deep learning model. |
|
OpenVINO.CSharp.API.Extensions.OpenCvSharp
Based on the C # platform, call the OpenVINO suite to deploy a deep learning model. |
|
OpenVINO.CSharp.Windows
OpenVINO wrapper for .NET. All-in-one package for Windows users. |
|
OpenVINO.CSharp.API.Extensions.EmguCV
Based on the C # platform, call the OpenVINO suite to deploy a deep learning model. |
|
OpenVINO.CSharp.API.Extensions.PaddleOCR
Deploy PaddleOCR model using OpenVINO C # API to achieve text image recognition. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OpenVINO.CSharp.API:
Repository | Stars |
---|---|
guojin-yan/YoloDeployCsharp
Deploying Yolov8-det, Yolov8-pose, Yolov8-cls, and Yolov8-seg models based on C # programming language.
|
Version | Downloads | Last updated |
---|---|---|
2024.3.0.2 | 1,141 | 8/4/2024 |
2024.2.0.1 | 539 | 6/28/2024 |
2024.1.0.1 | 2,510 | 4/27/2024 |
2024.0.0.1 | 1,564 | 3/11/2024 |
2023.2.0.4 | 725 | 1/18/2024 |
2023.2.0.4-develop | 498 | 12/30/2023 |
2023.2.0.3 | 587 | 11/30/2023 |
2023.2.0.2 | 339 | 11/26/2023 |
2023.2.0.1 | 313 | 11/24/2023 |
2023.1.0.1 | 634 | 10/22/2023 |
This version is a pre release version of OpenVINO™ C# API 3.0 and its features are not yet fully developed. If there are any issues during use, please feel free to contact me.