Implement Face detection using keras-yolo3.
- Keras 2.2.4 or lower (Issue : qqwweee/keras-yolo3#544)
- Tensorflow 1.13.2 or lower (Issue : NVIDIA/TensorRT#339)
- keras2onnx 1.5.1 (1.5.2 failed to convert onnx)
- keras-yolo3 (checked on version Jul 31, 2018 e6598d13c703029b2686bc2eb8d5c09badf42992)
- onnx 1.6.0 or later
- onnxconverter-common 1.6.0 (1.7.0 failed to convert onnx)
- Python 3.5 or later
- OpenCV
git submodule init
git submodule update
Download fddb dataset (FDDB-folds and originalPics folder) and put in the each folder.
http://vis-www.cs.umass.edu/fddb/
Folder layout examples.
/Volumes/ST5/dataset/fddb/FDDB-folds/*.txt
/Volumes/ST5/dataset/fddb/originalPics/2002/*
/Volumes/ST5/dataset/fddb/originalPics/2003/*
Create fddb annotation data.
python3 annotation.py fddb /Volumes/ST5/dataset/
Output is train_fddb.txt.
Download medical mask dataset.
Create medical-mask-dataset annotation data.
python3 annotation.py medical-mask-dataset /Volumes/ST5/dataset/
Output is train_medical-mask-dataset.txt.
Create fddb + medical-mask-dataset annotation data.
python3 annotation.py mixed /Volumes/ST5/dataset/
Output is train_mixed.txt.
Training from fddb 2845 pictures.
python3 train.py fddb ./model_data/face_classes.txt ./model_data/tiny_yolo_anchors.txt
This is an output data path.
./model_data/log/trained_weights_final.h5
Trained from medical-mask-dataset 678 pictures.
python3 train.py medical-mask-dataset ./model_data/mask_classes.txt ./model_data/tiny_yolo_anchors.txt
Trained from fddb + medical-mask-dataset 2845 + 678 pictures.
python3 train.py mixed ./model_data/mask_classes.txt ./model_data/tiny_yolo_anchors.txt
cd keras-onnx
python3 keras-yolo3-to-onnx.py ../model_data/logs/trained_weights_final.h5 ../model_data/face_classes.txt ../model_data/tiny_yolo_anchors.txt ../model_data/ax_face.onnx
cd keras-onnx
python3 keras-yolo3-to-onnx.py ../model_data/logs/trained_weights_final.h5 ../model_data/mask_classes.txt ../model_data/tiny_yolo_anchors.txt ../model_data/ax_masked_face.onnx
cd keras-onnx
python3 inference.py ../model_data/ax_face.onnx ../model_data/face_classes.txt ../images/couple.jpg output.jpg
cd keras-onnx
python3 inference.py ../model_data/ax_masked_face.onnx ../model_data/mask_classes.txt ../images/couple.jpg output.jpg
Optimize onnx file and export prototxt file
cd onnx-ailia
python3 onnx_optimizer.py --yolov3 ../model_data/ax_face.onnx
python3 onnx2prototxt.py ../model_data/ax_face.opt.onnx
cd onnx-ailia
python3 onnx_optimizer.py --yolov3 ../model_data/ax_masked_face.onnx
python3 onnx2prototxt.py ../model_data/ax_masked_face.opt.onnx
Inference using detector API
cd onnx-ailia
python3 inference.py ../model_data/ax_face.opt.onnx ../model_data/face_classes.txt ../images/couple.jpg output.jpg
cd onnx-ailia
python3 inference.py ../model_data/ax_masked_face.opt.onnx ../model_data/mask_classes.txt ../images/couple.jpg output.jpg
- keras-yolo3 : https://github.com/qqwweee/keras-yolo3
- keras2onnx : https://github.com/onnx/keras-onnx/tree/master/applications/yolov3