It is the training program for libfacedetection. The source code is based on FaceBoxes.PyTorch and ssd.pytorch.
-
Install PyTorch >= v1.0.0 following official instruction.
-
Clone this repository. We will call the cloned directory as
$TRAIN_ROOT
.
git clone https://github.com/ShiqiYu/libfacedetection.train
Note: Codes are based on Python 3+.
- Download WIDER FACE dataset, place the images under this directory:
$TRAIN_ROOT/data/WIDER_FACE_rect/images
and create a symbol link to this directory from
$TRAIN_ROOT/data/WIDER_FACE_landmark/images
- Train the model using WIDER FACE:
cd $TRAIN_ROOT/tasks/task1/
python3 train.py
cd $TRAIN_ROOT/tasks/task1/
./detect.py -m weights/yunet_final.pth --image_file=filename.jpg
The following bash code can export a CPP file for project libfacedetection
cd $TRAIN_ROOT/tasks/task1/
./exportcpp.py -m weights/yunet_final.pth -o output.cpp
You can copy $TRAIN_ROOT/tasks/task1/ to $TRAIN_ROOT/tasks/task2/ or other similar directory, and then modify the model defined in file: tasks/task2/yufacedetectnet.py .