1

I'm testing some stuff with Dlib and I selected rectangles around instances of an object I want to recognize, using the compiled tool included in tools/imglab/build/imglab. With this xml file describing a few different views of the object I want to detect I run the train object predictor with a few changes:

training_xml_path = os.path.join(faces_folder, "cooldataset.xml")
testing_xml_path = os.path.join(faces_folder, "cooldataset.xml")

and running in the images directory, makes a detector.svm.

Now I run a modified object detector for an image, it detects many of the objects it should and puts a rectangle around them, yet it takes almost 2 seconds to find them in a 1920x1080 screenshot! This is on a i5-3230M CPU @ 2.60GHz × 4 so I wonder if there is some compression or other step that I'm missing to make it go faster or work on less powerful device. This is compiled on Ubuntu from dlib-18.16 if that matters.

NoBugs
  • 9,310
  • 13
  • 80
  • 146

1 Answers1

2

I am using Dlib's object detector for similar situation and I have 20 fps on 1920x1080 relotion with the similar processor

First of all - get latest version from github After that ensure that you have AVX support enabled (-mavx) and you are compiling optimized code (-O3 or -Ofast)

As I see - you are using Python interface for Dlib. To compile it, you should call :

python setup.py install --yes USE_AVX_INSTRUCTIONS

(follow readme.txt instruction in dlib's folder)

Evgeniy
  • 2,481
  • 14
  • 24
  • The default instructions don't set that? Is AVX also applicable if I ran it on a Raspberry Pi (ARM processor)? – NoBugs May 12 '16 at 02:22
  • cat /proc/cpuinfo will show you if your CPU supports AVX or not – Evgeniy May 12 '16 at 06:27
  • Raspberry has ARM processor inside, some ARM's have SIMD support but you should check it and I think that instrincts will be differents. default support of SIMD in GCC normally enables SSE/SSE2 in x64 mode and disable in x86. AVX/AVX2 should be enabled manually – Evgeniy May 12 '16 at 06:41
  • @Evgeniy dlib's face detector takes more time to detect face's bounding box instead where landmark point's detection is fast. How it can become fast. –  Jul 02 '16 at 10:23
  • @Evgeniy With what version did this work? Assuming you're using cmake, and the `compile_dlib_python_module.bat` I think you have to enable `option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" ON)` and similar in the dlib/cmake file, and after compiling Dlib, set `SET(Boost_USE_MULTITHREADED ON)` without the # commenting it, in dlib/add_python_module. – NoBugs Jul 03 '16 at 02:03
  • @Evgeniy What was taking 1.8s is now taking 1.4s pretty consistently, still not that great of a speedup. I am on Dlib 18.16. – NoBugs Jul 03 '16 at 02:11
  • v 19, c++ api, ubuntu – Evgeniy Jul 03 '16 at 04:19
  • After issuing this command it shows `The --yes options to dlib's setup.py don't do anything since all these options are on by default. So --yes has been removed. Do not give it to setup.py. ` that means it is enabled by default. So what are the other things going wrong? – hafiz031 Oct 28 '20 at 14:39