1

I am compiling dlib 18.18 on Windows 10 for QT 5.6 with MinGW 4.9.2.

I have read all recommendations (http://dlib.net/faq.html#Whyisdlibslow): AVX or SSE4 instructions, Release mode.

The example "webcam_face_pose_ex.exe" works like a charm and really fast.

The problem:

But when I use the frontal_face_detector under QT the framerate is really low.

  • 640x480 ~170 ms

  • 1920x1080 ~1100 ms

System configuration: Windows 10 (x64), Intel Core i5-3550, QT 5.6, OpenCV 3.1.0, MinGW 4.9.2

Tried all variations of using AVX/SSE4 instructions in dlib and opencv. But I think that it's something different - since the example is fast. Code used in QT is copy-pasted from the example as well, even without the GUI.

In Debug mode 640x480 frames take 6-7 seconds to process.

.pro file dump:

DIR_DLIB = "$${LIBSDIR}dlib/dlib18.18/"
DEFINES += DLIB_ENABLE_ASSERTS
LIBS += -luser32 -lws2_32 -lgdi32 -lcomctl32 -limm32 -lwinmm
INCLUDEPATH += "$${DIR_DLIB}include"
DEPENDPATH += "$${DIR_DLIB}include"
LIBS += -L"$${DIR_DLIB}lib"
LIBS += -ldlib
4

1 回答 1

0

Dlib 人脸检测器是基于标头的,不依赖于用于编译 dlib.lib 本身的编译器标志。

Dlib 有一个记录的选项“-DUSE_AVX_INSTRUCTIONS=ON”,但如果您不使用 CMAKE 构建并将 dlib/cmake 文件包含到 CMakeLists.txt 中,它将不起作用

您应该将编译器的 AVX 启用标志添加到您的项目中,以使其快速运行

解决方案是在您的 .pro 文件中添加一个显式参数:

QMAKE_CXXFLAGS_RELEASE += -mavx

当您在 Qt Creator 中编译项目时,您可以看到它是如何调用编译器的以及使用了哪些标志。确保您有 -mavx 标志。-msse2 会慢 20%

于 2016-05-13T06:29:08.417 回答