运行单元测试时出现DlibDotNet异常:System.DllNotFoundException:无法加载共享库'DlibDotNetNative'

时间:2019-05-06 09:17:18

标签: linux .net-core face-recognition dlib

我正在尝试运行为服务编写的单元测试,该服务提供人脸检测功能。但是,当它尝试使用 $ Dlib.GetFrontalFaceDetector() 引发异常

System.DllNotFoundException: Unable to load shared library 'DlibDotNetNative' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libDlibDotNetNative: cannot open shared object file: No such file or directory
  1. 我试图像这样设置LD_DEBUG变量:

set LD_DEBUG =。/ home / userhome / .nuget / packages / dlibdotnet / 19.16.0.20190223 / lib / netstandard2.0 /

  1. 我试图将二进制文件DlibDotNet.dll与其他二进制文件(<...> / Debug / netcoreapp2.2)复制到一个文件夹中
public void bool DetectFace()
{
       using (var detector = Dlib.GetFrontalFaceDetector())
       using (var img = Dlib.LoadImage<Byte>(path))
       {
<smth>
       }
<smth>
}

1 个答案:

答案 0 :(得分:0)

最后,我找到了一个决定:

  1. ldd ./libDlibDotNetNative.so

  2. 在输出中:libopenblas.o.0-找不到

  3. sudo apt-get install libopenblas-base

  4. 利润!