libfacedetection icon indicating copy to clipboard operation
libfacedetection copied to clipboard

Very low framerate

Open Thanh-Binh opened this issue 4 years ago • 16 comments

In my very good laptop it runs at 10 Hz in release mode! Any idea for improvement? Thanks

Thanh-Binh avatar Sep 24 '21 20:09 Thanh-Binh

So how good is your computer? Can you provide details on your hardware setup and running environment, such as CPU model, OS and compiler?

Also note that you should turn on high performance mode when running on a laptop.

fengyuentau avatar Sep 25 '21 06:09 fengyuentau

my computer: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz, 8 cores, 64GB RAM Ubuntu 20.04 LTS 64bits, GCC 9.3

Thanh-Binh avatar Sep 25 '21 08:09 Thanh-Binh

Looks good. If I understand correctly, '10 Hz' means 10 FPS. But,

  1. Did you turn on high performance mode?
  2. Did you compile with multi-threading enabled? You can post your CMAKE command for building the project.
  3. What is the size of your input images/frames? If your laptop is equiped with a 720P (1280x720) or 1080P (1920x1080) camera, it makes sense to have about 10FPS. Please refer to the table in readme.

fengyuentau avatar Sep 25 '21 08:09 fengyuentau

yes 10fpd Yes, it is automatically turn on in high performance mode My Video with VGA set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -O3 -mavx2 -mfma -fopenmp")

Thanh-Binh avatar Sep 25 '21 08:09 Thanh-Binh

Did you try our example (https://github.com/ShiqiYu/libfacedetection/blob/master/example/detect-camera.cpp) or compose your own? If you have not try our example, you can change the input from a webcam to your video, and uncomment line84 to verify the input size.

fengyuentau avatar Sep 25 '21 08:09 fengyuentau

@fengyuentau i tested too your example with video and have the same low FPS!

Thanh-Binh avatar Sep 26 '21 07:09 Thanh-Binh

  1. Can you confirm the input resolution? Is it 640x480?
  2. Can you confirm that the mutli-threading is enabled when the example is running? You can run htop in terminal to monitor the load of each core when running example.

fengyuentau avatar Sep 26 '21 07:09 fengyuentau

yes, VGA Screenshot from 2021-09-26 09-55-50

Thanh-Binh avatar Sep 26 '21 07:09 Thanh-Binh

@fengyuentau is it clear for you to understand my problem?

Thanh-Binh avatar Sep 27 '21 13:09 Thanh-Binh

+1; I have a quite similar problem with the performance, I cannot reach the performance reported in the tables. My PC specs are:

Processor: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz 2.21 GHz Installed RAM: 32.0 GB System type: 64-bit operating system, x64-based processor Graphics card: GeForce Nvidia RTX 2080

tofis-imverse avatar Sep 28 '21 07:09 tofis-imverse

@tofis-imverse @fengyuentau Did you find any solution for this?

Thanh-Binh avatar Oct 12 '21 07:10 Thanh-Binh

@Thanh-Binh I was able to reach almost the reported latency (maybe x1.2) using the .lib built in cmake with the suggested flags instead of adding the source files. Did you try that?

tofis-imverse avatar Oct 12 '21 08:10 tofis-imverse

@tofis-imverse I am not sure if I understood you well. Could you pls share your cmakefile.txt? Thanks

Thanh-Binh avatar Oct 12 '21 08:10 Thanh-Binh

@Thanh-Binh Yes, you can find it here https://drive.google.com/file/d/1I9DwiPCRac8dhrL8irG5moLHEpNNcdFS/view?usp=sharing.

tofis-imverse avatar Oct 12 '21 08:10 tofis-imverse

@tofis-imverse thanks for sharing. I will test it soon

Thanh-Binh avatar Oct 12 '21 08:10 Thanh-Binh

@tofis-imverse same problem here, I used a pretty good i7 9 generation cpu laptop, using the demo: detect-camera, test results: average of 500ms per frame. you mentioned that some cmake flags should be as suggested, BUT after i use your cmake file, the result is same as the default cmake file build version.

pinojojo avatar Nov 03 '21 02:11 pinojojo