简体中文 | English
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。
Package | Description | Link |
---|---|---|
OpenVINO.CSharp.Windows | All-in-one package for Windows |
The following provides OpenVINO ™ The installation method of C # API on different platforms can be customized according to the platform you are using.
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
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
Install the following package using the dotnet add package
command
dotnet add package OpenVINO.CSharp.API
dotnet add package OpenVINO.runtime.macos-arm64
- 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.
If you want to learn more information, you can refer to: OpenVINO™ C# API API Documented
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.
The release of this project is certified under the Apache 2.0 license .