# OpenVINO-CSharp-API
**Repository Path**: pengguanjun/OpenVINO-CSharp-API
## Basic Information
- **Project Name**: OpenVINO-CSharp-API
- **Description**: C#调用OpenVINOTM部署Al模型项目开发项目,简称OpenVinoSharp,这是一个示例项目,该项目实现在C#编程语言下调用Intel推出的 OpenVINO™ 工具套件,进行深度学习等Al项目在C#框架下的部署。该项目由C++语言编写OpenVINO™ API接口,并在C#语言下实现应用。
- **Primary Language**: C#
- **License**: Apache-2.0
- **Default Branch**: csharp3.1
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 9
- **Created**: 2024-02-04
- **Last Updated**: 2024-02-04
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README

[简体中文](README_cn.md) | English
## 📚 What is OpenVINO™ C# API ?
[OpenVINO™](www.openvino.ai) is an open-source toolkit for optimizing and deploying AI inference.
- Boost deep learning performance in computer vision, automatic speech recognition, natural language processing and other common tasks
- Use models trained with popular frameworks like TensorFlow, PyTorch and more
- Reduce resource demands and efficiently deploy on a range of Intel® platforms from edge to cloud
This project is based on OpenVINO™ The tool kit has launched OpenVINO™ C # API, aimed at driving OpenVINO™ Application in the C # field. OpenVINO ™ The C # API is based on OpenVINO™ Development, supported platforms, and OpenVINO ™ Consistent, please refer to OpenVINO™ for specific information。
##
NuGet Package
### Core Managed Libraries
| Package | Description | Link |
| ---------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------ |
| **OpenVINO.CSharp.API** | OpenVINO C# API core libraries | [](https://www.nuget.org/packages/OpenVINO.CSharp.API/) |
| **OpenVINO.CSharp.API.Extensions** | OpenVINO C# API core extensions libraries | [](https://www.nuget.org/packages/OpenVINO.CSharp.API.Extensions/) |
| **OpenVINO.CSharp.API.Extensions.OpenCvSharp** | OpenVINO C# API core extensions libraries use OpenCvSharp | [](https://www.nuget.org/packages/OpenVINO.CSharp.API.Extensions.OpenCvSharp/) |
| **OpenVINO.CSharp.API.Extensions.EmguCV** | OpenVINO C# API core extensions libraries use EmguCV | [](https://www.nuget.org/packages/OpenVINO.CSharp.API.Extensions.EmguCV/) |
### Native Runtime Libraries
| Package | Description | Link |
| ------------------------------------- | ------------------------------------ | ------------------------------------------------------------ |
| **OpenVINO.runtime.win** | Native bindings for Windows | [](https://www.nuget.org/packages/OpenVINO.runtime.win/) |
| **OpenVINO.runtime.ubuntu.22-x86_64** | Native bindings for ubuntu.22-x86_64 | [](https://www.nuget.org/packages/OpenVINO.runtime.ubuntu.22-x86_64/) |
| **OpenVINO.runtime.ubuntu.20-x86_64** | Native bindings for ubuntu.20-x86_64 | [](https://www.nuget.org/packages/OpenVINO.runtime.ubuntu.20-x86_64/) |
| **OpenVINO.runtime.ubuntu.18-x86_64** | Native bindings for ubuntu.18-x86_64 | [](https://www.nuget.org/packages/OpenVINO.runtime.ubuntu.18-x86_64/) |
| **OpenVINO.runtime.debian9-arm64** | Native bindings for debian9-arm64 | [](https://www.nuget.org/packages/OpenVINO.runtime.win/) |
| **OpenVINO.runtime.debian9-armhf ** | Native bindings for debian9-armhf | [](https://www.nuget.org/packages/OpenVINO.runtime.debian9-armhf/) |
| **OpenVINO.runtime.centos7-x86_64** | Native bindings for centos7-x86_64 | [](https://www.nuget.org/packages/OpenVINO.runtime.centos7-x86_64/) |
| **OpenVINO.runtime.rhel8-x86_64** | Native bindings for rhel8-x86_64 | [](https://www.nuget.org/packages/OpenVINO.runtime.rhel8-x86_64/) |
| **OpenVINO.runtime.macos-x86_64** | Native bindings for macos-x86_64 | [](https://www.nuget.org/packages/OpenVINO.runtime.macos-x86_64/) |
| **OpenVINO.runtime.macos-arm64** | Native bindings for macos-arm64 | [](https://www.nuget.org/packages/OpenVINO.runtime.macos-arm64/) |
### Integration Library
| Package | Description | Link |
| --------------------------- | ------------------------------ | ------------------------------------------------------------ |
| **OpenVINO.CSharp.Windows** | All-in-one package for Windows | [](https://www.nuget.org/packages/OpenVINO.CSharp.Windows/) |
## ⚙ How to install OpenVINO™ C# API?
The following provides OpenVINO ™ The installation method of C # API on different platforms can be customized according to the platform you are using.
### **Windows**
Install the following package through the ``dotnet add package`` command or through Visual Studio
```shell
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.win
Or install =》
dotnet add package OpenVINO.CSharp.Windows
```
### **Linux**
We have created the corresponding NuGet Package for the **Linux ** platform based on the official compiled platform, For example, using **ubuntu.22-x86_64** is installed using the ``dotnet add package`` command:
```shell
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.ubuntu.22-x86_64
```
After running the program once, add environment variables:
```
export LD_LIBRARY_PATH={Program generated executable file directory}/runtimes/ubuntu.22-x86_64/native
such as =》
export LD_LIBRARY_PATH=/home/ygj/Program/sample1/bin/Debug/net6.0/runtimes/ubuntu.22-x86_64/native
```
If for a brand new platform (without installing OpenVINO C++), it is necessary to install a dependent environment and switch to ``{Program generated executable file directory}/runtimes/ubuntu.22-x86'_ 64/native ``directory, run the following command:
```shell
sudo -E ./install_openvino_dependencies.sh
```
## Mac OS
Install the following package using the ``dotnet add package``command
```shell
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.macos-arm64
```
## 🏷开始使用
## 🏷How to use OpenVINO™ C# API?
- **Simple usage**
If you don't know how to use it, simply understand the usage method through the following code.
```c#
using OpenVinoSharp;
namespace test
{
internal class Program
{
static void Main(string[] args)
{
using Core core = new 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");
infer_request.infer();
using Tensor output_tensor = infer_request.get_tensor("output0");
}
}
}
```
The classes and objects encapsulated in the project, such as Core, Model, Tensor, etc., are implemented by calling the C API interface and have unmanaged resources. They need to be handled by calling the **Dispose() ** method or `using` statement, otherwise memory leakage may occur.
## 💻 Tutorial Examples
## 🗂 API Reference
If you want to learn more information, you can refer to: [OpenVINO™ C# API API Documented](https://guojin-yan.github.io/OpenVINO-CSharp-API.docs/index.html)
## 🎖 Contribute
If you are interested in OpenVINO ™ Interested in using C # and contributing to the open source community, welcome to join us and develop OpenVINO™ C# API together.
If you have any ideas or improvement ideas for this project, please feel free to contact us for guidance on our work.
##
License
The release of this project is certified under the [Apache 2.0 license](https://github.com/guojin-yan/OpenVINO-CSharp-API/blob/csharp3.0/LICENSE.txt) .