如何使用 TBB 构建 OpenCV?
我正在尝试让 opencv_traincascade
使用多个线程,但失败了。我能找到的唯一文档说“使用 TBB 构建 OpenCV”。我不确定我是否无法使用 TBB 成功构建 OpenCV,或者是否需要为 opencv_traincascade
设置一些标志。
我已经下载了 OpenCV 版本 2.3.1 windows superpack 和 tbb40_20111003oss_win.zip
,并将其解压到 C:\tbb40_20111003oss
。然后我使用 CMake 生成 VC8 .sln
和 .proj
文件,设置
WITH_TBB:开启
TBB_INCLUDE_DIR:PATH=C:\tbb40_20111003oss\include
TBB_LIB_DIR:PATH=C:/tbb40_20111003oss/lib/intel64/vc8
OpenCV 然后构建没有错误,但是当我运行时opencv_traincascade
它是单线程的。有谁知道我做错了什么?
I'm trying and failing to make opencv_traincascade
use multiple threads. The only documentation I can find says to "build OpenCV with TBB". I'm not sure if I'm failing to successfully build OpenCV with TBB, or whether there's some flag I need to set for opencv_traincascade
.
I've downloaded the OpenCV version 2.3.1 windows superpack and tbb40_20111003oss_win.zip
, which I extracted to C:\tbb40_20111003oss
. I then generated VC8 .sln
and .proj
files using CMake, setting
WITH_TBB: ON
TBB_INCLUDE_DIR:PATH=C:\tbb40_20111003oss\include
TBB_LIB_DIR:PATH=C:/tbb40_20111003oss/lib/intel64/vc8
OpenCV then builds without errors, but when I run opencv_traincascade
it's singlethreaded. Does anyone know what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您使用的是 Mac,则可以使用 homebrew 执行此操作:
或者如果您已经安装了 homebrew:
此外,
info
命令会告诉您有关您可能感兴趣的其他标志,例如-- with-java
If you are on Mac you can do this with homebrew:
Or if you have already installed with homebrew:
Also, the
info
command tells you about other flags you might be interested in, e.g.--with-java
我知道这是一个旧线程,但我认为问题是您正在使用带有 Haart 功能的 Traincascade,而不是与使用整数而不是浮点的 LBP 功能一起使用,并且工作速度快了 3 倍。
有关更多信息,请参阅此问题中的评论作者提供的有关此的信息。快速总结:Haart 训练很难并行化,但 LBP 更容易并利用大量处理器。
希望有帮助!
I know this is an old thread but I think the problem is that you are using Traincascade with Haart feature insdead of using with the LBP features which uses integer instead of floating point and are working 3 times faster.
See the comment in this question for more information from the author about this. Quick summary: Haart training is difficult to paralelize but LBP is much easier and take advantage of a lot of processors.
Hope it help!
对于 Linux,执行以下操作:
For linux, do:
尝试使用 setNumThreads(),并将处理器核心的数量作为参数。有一个帮助函数可以找到最佳线程数(等于核心数),但我不记得了。
并确保您还重建了 train_cascade exe
Try setNumThreads(), with the number of your processor cores as parameters. There is a helper function to find the optimum number of threads (equals the number of cores), but I cannot remember it.
And make sure you also rebuild the train_cascade exe
说明如下: http://devel- open.blogspot.com.ar/2012/06/instalando-opencv-240-en-ubuntu.html
Instructions here: http://devel-open.blogspot.com.ar/2012/06/instalando-opencv-240-en-ubuntu.html
构建 tbb 二进制文件后,请确保您的路径正确地将可执行文件定向到 tbb dll。您可能正在加载非 tbb dll(这发生在我身上),并且它们不会提供多线程。
After building the tbb binaries, make sure your path is correctly directing your executable to the tbb dlls. It is possible that you are loading the non-tbb dlls (this happened to me) and these will provide no multithreading.
此外,一个接触点是在系统上安装 Intel TBB:
Also, one touch point is the installation of Intel TBB on the system: