mmdeploy/csrc/apis/csharp
Chen Xin 9e6a3c8ec5
add csharp support (#388)
* add csharp support, init commit

* export MMDeploySharpExtern.dll when build sdk

* refactor code

* multi frameworks

* move csharp demo to demo folder

* try to fix lint

* try to fix lint

* update csharp demo Readme

* rename MMDeploySharp -> MMDeploy

* add comment why build MMDeployExtern.dll

* squeeze MMDeploy project

* remove Mm

* print error code

* update c# api build README.md

* fix exception

* fix exception

* update demo

* update README.md

* fix typo

* fix ci

* fix ci

* fix formatresult

* add options whether build MMDeployExtern.dll

* update CMakeListst.txt

* change MMDEPLOY_BUILD_CSHARP_EXTERN -> MMDEPLOY_BUILD_SDK_CSHARP_API

* c# api -> C# API

Co-authored-by: chenxin2 <chenxin2@sensetime.com>
2022-05-27 16:02:29 +08:00
..
MMDeploy add csharp support (#388) 2022-05-27 16:02:29 +08:00
MMDeploy.sln add csharp support (#388) 2022-05-27 16:02:29 +08:00
README.md add csharp support (#388) 2022-05-27 16:02:29 +08:00

README.md

Installation

Binaries

We provide nuget package on our release page. Currently the prebuilt package only support tensorrt and onnxruntiem backend.

To use the nuget package, you also need to download the backend dependencies. For example, if you want to use the tensorrt backend, you should install cudatoolkit, cudnn and tensorrt, remember to add the dll directories to your system path. The version of backend dependencies that our prebuit nuget package used will be offered in release note.

backend dependencies
tensorrt cudatoolkit, cudnn, tensorrt
onnxruntime onnxruntime / onnxruntime-gpu

From Source

Requirements

  • Environment required by building sdk
  • .NET Framework 4.8 / .NET core 3.1
  • Visual Studio 2019+

Installation

Step 0. Build sdk.

Before building the c# api, you need to build sdk first. Please follow this tutorial/教程 to build sdk. Remember to set the MMDEPLOY_BUILD_CSHARP_EXTERN option to ON. We recommend setting BUILD_SHARED_LIBS to OFF and use the static third party libraries(spdlog, pplcv, opencv, etc.). If so, you only need add the backend dependencies to your system path, or you need to add all dependencies.

If you follow the tutorial, the MMDeployExtern.dll will be built in build\bin\release. Make sure the expected dll is in that path or the next step will throw a file-not-exist error.

Step 1. Build MMDeploy nuget package.

There are two methods to build the nuget package.

(option 1) Use the command.

If your environment is well prepared, you can just go to the csrc\apis\csharp folder, open a terminal and type the following command, the nupkg will be built in csrc\apis\csharp\MMDeploy\bin\Release\MMDeploy.1.0.0.nupkg.

dotnet build --configuration Release -p:Version=1.0.0

(option 2) Open MMDeploy.sln && Build.

You can set the package-version through Properties -> Package Version. The default version is 1.0.0 if you don't set it.

If you meets some missing dependencies error, follow the vs instructions.