Skip to content

Commit

Permalink
speed up 2x to 3x & parallelization is disabled
Browse files Browse the repository at this point in the history
The algorithm has been speeded up 2x to 3x. Multi-core parallelization
is disabled.
  • Loading branch information
ShiqiYu committed Oct 6, 2016
1 parent 95568e2 commit a52c054
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 34 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
2016-10-6
---------------------
* The algorithm has been speeded up greatly (2x to 3x).
* Multi-core parallelization has been disabled. The detection time is still the same.

2016-9-16
---------------------
* Speedup again.
* Change function name facedetect_frontal_tmp() to facedetect_frontal_surveillance(). This function now uses a new trained classifier which can achieve a higher detection speed.

Expand Down
Binary file removed FDDB-results-of-3functions.png
Binary file not shown.
Binary file added FDDB-results-of-4functions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 16 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,35 @@
libfacedetection
====================
# libfacedetection

This is a binary library for face detection in images.
The 32-bit and 64-bit dll files are provided.

To achieve better performance, the 64-bit dll is recommended.

examples/libfacedetect-example.cpp shows how to use the library.

Comparison on Windows
-------------

| Method | Time | FPS | Misc |
|--------|--------|------|--------|
|OpenCV | 21.2ms | 47.2 | Yaw angle: -40 to 40 degrees. Classifier: haarcascade_frontalface_alt.xml |
|frontal | 2.7ms | 370.4 | Yaw angle: -60 to 60 degrees|
|frontal-surveillance| 3.8ms | 263.2 | Yaw angle: -70 to 70 degrees |
|multiview| 6.6ms | 151.5 | Yaw angle: -90 to 90 degrees |
|multiview_reinforce| 9.5ms | 105.3 | Yaw angle: -90 to 90 degrees |
| Method | Time(Win32) | FPS(Win32) |Time(X64) | FPS(X64) | Misc |
|--------------------|-------------|------------|------------|-----------|--------|
|frontal | 2.92ms | 342.5 | 2.41ms | 414.9 | Yaw angle: -60 to 60 degrees|
|frontal-surveillance| 3.83ms | 261.1 | 3.37ms | 269.7 | Yaw angle: -70 to 70 degrees |
|multiview | 7.12ms | 140.4 | 5.81ms | 172.1 | Yaw angle: -90 to 90 degrees |
|multiview_reinforce | 10.95ms | 91.3 | 9.15ms | 109.3 | Yaw angle: -90 to 90 degrees |

* 640x480 image size (VGA), scale=1.2, minimal window size = 48
* Intel(R) Core(TM) i7-4770 CPU @ 3.4GHz
* Multi-core parallelization is enabled for these five methods.

Comparison on iPhone(+)
-------------

| Method | Time (iPhoneSE) | FPS (iPhoneSE) | Time (iPhone5S) | FPS (iPhone5S) | Misc |
|--------|--------|------|--------|------|--------|
|frontal | 14.9ms | 67.1 | 23.8 | 42.0 | Yaw angle: -60 to 60 degrees|
|multiview| 47.3ms | 21.1 | 75.1 | 13.3 |Yaw angle: -90 to 90 degrees |
|multiview_reinforce| 83.2ms | 12.0 | 132.4 | 7.6 | Yaw angle: -90 to 90 degrees |

* 640x480 image size (VGA), scale=1.2, minimal window size = 48
* Multi-core parallelization is disabled.
* C programming language, and no SIMD instruction is used.
* (+) The performance data on iPhone was obtained using a previous version. Currrent version can gain ~40% speed improvement.
* Only one CPU core is utilized. Multi-core parallelization is *disabled* for these four methods.


Comparison on ARM
-------------

| Method | Time | FPS | Misc |
|--------|--------|------|--------|
|frontal | 21.5ms | 46.5 | Yaw angle: -60 to 60 degrees|
|frontal-surveillance| 36.5ms | 27.4 | Yaw angle: -70 to 70 degrees |
|multiview| 67.1ms | 14.9 | Yaw angle: -90 to 90 degrees |
|multiview_reinforce| 112.6ms | 8.9 | Yaw angle: -90 to 90 degrees |
| Method | Time | FPS | Misc |
|--------------------|--------|------|--------|
|frontal | 12.5ms| 46.5 | Yaw angle: -60 to 60 degrees|
|frontal-surveillance| 15.7ms| 27.4 | Yaw angle: -70 to 70 degrees |
|multiview | 27.8ms| 14.9 | Yaw angle: -90 to 90 degrees |
|multiview_reinforce | 38.4ms| 8.9 | Yaw angle: -90 to 90 degrees |

* 640x480 image size (VGA), scale=1.2, minimal window size = 48
* NVIDIA TK1 "4-Plus-1" 2.32GHz ARM quad-core Cortex-A15 CPU
Expand All @@ -58,7 +42,7 @@ Evaluation
-------------
FDDB: http://vis-www.cs.umass.edu/fddb/index.html

![Evaluation on FDDB](https://github.com/ShiqiYu/libfacedetection/blob/master/FDDB-results-of-3functions.png "Evaluation on FDDB")
![Evaluation on FDDB](https://github.com/ShiqiYu/libfacedetection/blob/master/FDDB-results-of-4functions.png "Evaluation on FDDB")

* scale=1.08
* minimal window size = 16
Expand Down
Binary file modified bin/libfacedetect-x64.dll
Binary file not shown.
Binary file modified bin/libfacedetect.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions example/libfacedetect-example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ SOFTWARE.
#include <opencv.hpp>

#include "facedetect-dll.h"
#pragma comment(lib,"libfacedetect.lib")
//#pragma comment(lib,"libfacedetect-x64.lib")
//#pragma comment(lib,"libfacedetect.lib")
#pragma comment(lib,"libfacedetect-x64.lib")

using namespace cv;

Expand Down
Binary file modified lib/libfacedetect-x64.lib
Binary file not shown.
Binary file modified lib/libfacedetect.lib
Binary file not shown.

0 comments on commit a52c054

Please sign in to comment.