PaddlePaddle / PaddlePaddle/FastDeploy

编译paddleseg_cpu&gpu_csharp的infer.cs失败

Open
#1,847 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.7k
Forks
756
Avg merge
19h 28m
Merged PRs (30d)
4

Description


温馨提示:根据社区不完全统计,按照模板提问,可以加快回复和解决问题的速度


环境

  • 【FastDeploy版本】: fastdeploy-win-x64-gpu-1.0.4
  • 【编译命令】通过cmake .. -G "Visual Studio 16 2019" -A x64 -DENABLE_ORT_BACKEND=ON -DENABLE_PADDLE_BACKEND=ON -DENABLE_OPENVINO_BACKEND=ON -DENABLE_VISION=ON -DWITH_GPU=ON -DENABLE_TEXT=ON -DWITH_CAPI=ON -DWITH_CSHARPAPI=ON -DCMAKE_INSTALL_PREFIX="D:\Paddle\compiled_fastdeploy_CUDA11_2" -DCUDA_DIRECTORY="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2" -DTRT_DIRECTORY="E:\work\tools\TensorRT-8.5.2.2.Windows10.x86_64.cuda-11.8.cudnn8.6\TensorRT-8.5.2.2"编译好了C#API
  • 通过cmake .. -G "Visual Studio 16 2019" -A x64 -DFASTDEPLOY_INSTALL_DIR=E:\work\tools\fastdeploy-win-x64-gpu-1.0.4 -DCUDA_DIRECTORY="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2"编译infer.cs,生成了infer_demo.sln,
  • 【系统平台】: Windows x64(Windows10)
  • 【硬件】: 说明具体硬件型号,如 Nvidia GPU 3060, CUDA 11.2 CUDNN 8.1
  • 【编译语言】: C++

问题日志及出现问题的操作流程

cmakelist.txt 修改为

PROJECT(infer_demo CSharp)
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)

Set the C# language version (defaults to 3.0 if not set).

set(CMAKE_CSharp_FLAGS "/langversion:10")
set(CMAKE_DOTNET_TARGET_FRAMEWORK "net6.0")
set(CMAKE_DOTNET_SDK "Microsoft.NET.Sdk")

指定下载解压后的fastdeploy库路径

#option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")
option(FASTDEPLOY_INSTALL_DIR "E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\")
include(${FASTDEPLOY_INSTALL_DIR}/FastDeployCSharp.cmake)
add_executable(infer_demo ${PROJECT_SOURCE_DIR}/infer.cs)
set_property(TARGET infer_demo PROPERTY VS_DOTNET_REFERENCES ${FASTDEPLOY_DOTNET_REFERENCES})
set_property(TARGET infer_demo PROPERTY VS_PACKAGE_REFERENCES ${FASTDEPLOY_PACKAGE_REFERENCES})

我是VS2019环境,net6.0,不支持,改net5.0也不行

报错内容:
E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\examples\vision\segmentation\paddleseg\cpu-gpu\csharp\buildcuda112>nuget restore
MSBuild 自动检测: 使用来自 "C:\Program Files (x86)\Microsoft Visual Studio\2019\MSBuild\Current\Bin" 的 msbuild 版本 "16.11.2.50704"。
packages.config 中列出的所有包均已安装。
Restoring packages for E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\examples\vision\segmentation\paddleseg\cpu-gpu\csharp\buildcuda112\infer_demo.csproj...
NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0). Package OpenCvSharp4 4.7.0.20230115 supports:

  • net48 (.NETFramework,Version=v4.8)
  • net6.0 (.NETCoreApp,Version=v6.0)
  • netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  • netstandard2.0 (.NETStandard,Version=v2.0)
  • netstandard2.1 (.NETStandard,Version=v2.1)
    NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0) / win. Package OpenCvSharp4 4.7.0.20230115 supports:
  • net48 (.NETFramework,Version=v4.8)
  • net6.0 (.NETCoreApp,Version=v6.0)
  • netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  • netstandard2.0 (.NETStandard,Version=v2.0)
  • netstandard2.1 (.NETStandard,Version=v2.1)
    NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0) / win-x64. Package OpenCvSharp4 4.7.0.20230115 supports:
  • net48 (.NETFramework,Version=v4.8)
  • net6.0 (.NETCoreApp,Version=v6.0)
  • netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  • netstandard2.0 (.NETStandard,Version=v2.0)
  • netstandard2.1 (.NETStandard,Version=v2.1)
    NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0) / win-x86. Package OpenCvSharp4 4.7.0.20230115 supports:
  • net48 (.NETFramework,Version=v4.8)
  • net6.0 (.NETCoreApp,Version=v6.0)
  • netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  • netstandard2.0 (.NETStandard,Version=v2.0)
  • netstandard2.1 (.NETStandard,Version=v2.1)
    Generating MSBuild file E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\examples\vision\segmentation\paddleseg\cpu-gpu\csharp\buildcuda112\obj\infer_demo.csproj.nuget.g.props.
    Writing assets file to disk. Path: E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\examples\vision\segmentation\paddleseg\cpu-gpu\csharp\buildcuda112\obj\project.assets.json
    Failed to restore E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\examples\vision\segmentation\paddleseg\cpu-gpu\csharp\buildcuda112\infer_demo.csproj (in 311 ms).

Errors in E:\work\tools\fastdeploy-win-x64-gpu-1.0.4\examples\vision\segmentation\paddleseg\cpu-gpu\csharp\buildcuda112\infer_demo.csproj
NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0). Package OpenCvSharp4 4.7.0.20230115 supports:
- net48 (.NETFramework,Version=v4.8)
- net6.0 (.NETCoreApp,Version=v6.0)
- netcoreapp3.1 (.NETCoreApp,Version=v3.1)
- netstandard2.0 (.NETStandard,Version=v2.0)
- netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0) / win. Package OpenCvSharp4 4.7.0.20230115 supports:
- net48 (.NETFramework,Version=v4.8)
- net6.0 (.NETCoreApp,Version=v6.0)
- netcoreapp3.1 (.NETCoreApp,Version=v3.1)
- netstandard2.0 (.NETStandard,Version=v2.0)
- netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0) / win-x64. Package OpenCvSharp4 4.7.0.20230115 supports:
- net48 (.NETFramework,Version=v4.8)
- net6.0 (.NETCoreApp,Version=v6.0)
- netcoreapp3.1 (.NETCoreApp,Version=v3.1)
- netstandard2.0 (.NETStandard,Version=v2.0)
- netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package OpenCvSharp4 4.7.0.20230115 is not compatible with net40 (.NETFramework,Version=v4.0) / win-x86. Package OpenCvSharp4 4.7.0.20230115 supports:
- net48 (.NETFramework,Version=v4.8)
- net6.0 (.NETCoreApp,Version=v6.0)
- netcoreapp3.1 (.NETCoreApp,Version=v3.1)
- netstandard2.0 (.NETStandard,Version=v2.0)
- netstandard2.1 (.NETStandard,Version=v2.1)

NuGet Config files used:
C:\Users\Administrator\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages
https://api.nuget.org/v3/index.json

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CMakeLists.txt, infer.cs, generated infer_demo.csproj, and the FastDeployCSharp.cmake referenced in the issue. Run NuGet restore for the paddleseg CPU/GPU C# example and trace the target-framework compatibility errors; done means the project restores and the infer.cs example builds under the documented Visual Studio setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, csharp, opencv
Domain
build-system, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.