C++ implementation of Joint Cascade Face Detection and Alignment.
$ git clone https://github.com/luoyetx/JDA.git
$ cd JDA
$ mkdir build && cd build
$ cmake ..
$ make
If you are on Windows, make sure you have set environment variable OpenCV_DIR
to OpenCV's build directory like D:/3rdparty/opencv2.4.11/build
. You may also need Visual Studio to compile the source code. If you are on Linux or Unix, install the development packages of OpenCV via your system's Package Manager like apt-get
on Ubuntu or yum
on CentOS. However, Compile the source code of OpenCV will be the best choice of all.
You should prepare your own data and all data should be under data
directory. You need two kinds of data, face with landmarks and background images. You also need to create two text file train.txt
and nega.txt
(you can change the name of these two text file by editing the code in common.cpp
).
Every line of train.txt
stores a face image's path with its landmarks. The number of landmarks can be changed in common.cpp
and the order of landmarks does not matter.
../data/train/00001.jpg x1 y1 x2 y2 ........
../data/train/00002.jpg x1 y1 x2 y2 ........
....
....
The face images should be resized to the pre-defined size and you should do any data augmentation by yourself, the code will exactly use the face images you provide.
nega.txt
is much more simpler. Every line stores where the background image in the file system.
../data/nega/000001.jpg
../data/nega/000002.jpg
../data/nega/000003.jpg
....
....
Background images should have no face and we will do data augmentation during the hard negative mining.
You may refer to script/gen.py
for more detail.
$ ./jda train
If you are using Visual Studio, make sure you know how to pass command line arguments to the program. The model will be saved to model
directory. The model file is stored in binary form and I may change the data format later, so training the model on your own risk. However, I will try to make sure that the further code can load the model parameter correctly.
This project is not completed yet and may has some hidden bugs. Welcome any question or idea through the issues.
BSD 3-Clause