Skip to content

Latest commit

 

History

History
156 lines (110 loc) · 10.8 KB

README.md

File metadata and controls

156 lines (110 loc) · 10.8 KB

OpenVINO™ C# API

简体中文 | English

📚 What is OpenVINO™ C# API ?

OpenVINO™ 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 NuGet Gallery
OpenVINO.CSharp.API.Extensions OpenVINO C# API core extensions libraries NuGet Gallery
OpenVINO.CSharp.API.Extensions.OpenCvSharp OpenVINO C# API core extensions libraries use OpenCvSharp NuGet Gallery
OpenVINO.CSharp.API.Extensions.EmguCV OpenVINO C# API core extensions libraries use EmguCV NuGet Gallery
OpenVINO.CSharp.API.Extensions.PaddleOCR PaddleOCR Deploy in OpenVINO.CSharp.API. NuGet Gallery

Native Runtime Libraries

Package Description Link
OpenVINO.runtime.win Native bindings for Windows NuGet Gallery
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

Integration Library

Package Description Link
OpenVINO.CSharp.Windows All-in-one package for Windows NuGet Gallery

⚙ 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

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:

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:

sudo -E ./install_openvino_dependencies.sh

Mac OS

Install the following package using the dotnet add packagecommand

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.

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

🎖 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 .