Face detector trained with ssd on fddb library

Face detector trained with ssd on fddb library

If you are using opencv3.3 and above and want to see the results directly instead of training, you can skip the caffe-ssd configuration in the first section.

1. Download and compile the ssd

git clone https://github.com/weiliu89/caffe
cd caffe
git checkout ssd
cp Makefile.config.example Makefile.config
make -j8
make py

For the sake of convenience, the folder where the downloaded caffe is located will be recorded as $SSD_ROOT in the following text

2. Download this project

Switch to the $SSD_ROOT/data/ directory

cd data
git clone https://github.com/imistyrain/ssd-face

3. Run the demo

Download the pre-trained model (Baidu network disk, about 90M, password: jvhw), put it in the cpp folder, and make sure the structure is as shown below 

3.1 python version

python face_detect.py

3.2 Command line version under Windows

RunFaceDetect.bat

3.3 C++ version

If you are using opencv3.3 and above, it comes with caffe support. If it is 3.2 and below, you need to recompile opencv with opencv_extra, (note that WITH_DNN is checked)

Double-click to open ssd-face.sln, set SSDFace as the startup item, and run it after compiling

Note: For opencv cross-platform automation configuration, please refer to MRHead

4. Train your own data

4.1 Prepare training data and convert data to VOC format

If you want to train fddb directly, you can directly download the converted fddb library (Baidu network disk, password: g33x, about 102M), and place it under /home/data/Face2017. For this step process, please refer to Labeling fddb Convert to VOC format annotation

Of course, you can also replace it with your own data. We recommend an easy-to-use labeling tool: MRLabeler

4.2 Generate data in the format required for training

python create_list.py
./create_data.sh

其中create_list.py把训练图片路径及其标注按行写入到trainval.txt中,把测试图片路径及其标注按行写入到test.txt中,把测试图片路径及其大小(高度、宽度)写入到test_name_size.txt中

Note:由于fddb中含有多级目录,为了兼容SSD及YOLO的训练结构要求,此脚本将路径中的"/"转换为了"_"

create_data.sh用于生成训练所需的lmdb文件,由于要支持多标签的输入,因此其内部使用了slice data layer,避免使用hdf5生成文件过大的问题

4.3 启动训练

python face_train.py

参考

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325684421&siteId=291194637