Face detection based on haar, dlib, and mtcnn detectors
A simple implementation of face detection (Dlib/OpenCV/MTCNN backend)
- Clone this repo.
- Run face detection.
git clone https://github.com/Ianpanda/Face-Detection.git
python face_detection.py -i demo_images/00.jpg for image detection mode, OR
python face_detection.py -i [video_path] -o [output_path (optional)] for video detection mode.
Use -h or --help to see usage of face_detection.py:
usage: face_detection.py [-h] [-i INPUT] [-o OUTPUT]
[-d {haar,dlib,mtcnn,all}] [-s SPEED] [-v {y,n}]
detect faces based on haar or dlib
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
video or image to detect
-o OUTPUT, --output OUTPUT
video or image result
-d {haar,dlib,mtcnn,all}, --detector {haar,dlib,mtcnn,all}
choose your detector
-s SPEED, --speed SPEED
spped up video result if need
-v {y,n}, --visualize {y,n}
visualize the detect result immediately
demo:python face_detection.py -i file_in -o file_out -d detector
1.-i:video or image to detect
2.-o:result
3.-d:choose your detector
4.-s:spped up video result if need
5.-v:visualize the detect result immediately
-
The test environment is
- Python 3.5.4
- OpenCV 3.3.1
- Dlib 19.15.0
- TensorFlow 1.9.0
-
Default haar classifier are used. If you use others, try to get from $ROOT/model_weights/haar, or you can train your own xml.
-
The MTCNN model has fixed weights in model_weights/mtcnn.
- Update method to train xml
- Add MTCNN detector
- Extend other amazing Networks