深度学习人脸检测框架DFace-win64的调试与视频人脸检测
在分辨率不是很高的视频中,Haar+AdaBoost的人脸检测方式精度不是很高,错检也有很多,于是尝试用深度学习的方式来做人脸检测。目标是在视频/图片中检出人脸的位置,画出Bounding Box,以便于作为输入图像进行表情。
本文用到的深度学习人脸检测框架是DFace
在其开源代码的基础上做了修改,简化了部分运算,并将其运用到视频检测中。
一、准备工作
1.Anaconda3环境:pytorch-gpu
CUDA:8.0
cuDNN:5.1
环境配置请参考https://blog.csdn.net/hhy_csdn/article/details/82263078
2.代码
链接:https://pan.baidu.com/s/1iJ7YwvTVnUgpNsZ0vKCp2A 密码:efv9
解压压缩包至K:\Desktop\face_detect\DFace-win64
二、修改代码
激活环境
activate pytorch-gpu
运行test_image.py
,执行python test_image.py
出现bug
Traceback (most recent call last):
File "test_image.py", line 20, in <module>
bboxs, landmarks = mtcnn_detector.detect_face(img)
File "K:\Desktop\face_detect\DFace-win64\src\core\detect.py", line 602, in detect_face
boxes, boxes_align = self.detect_pnet(img)
File "K:\Desktop\face_detect\DFace-win64\src\core\detect.py", line 263, in detect_pnet
cls_map, reg = self.pnet_detector(feed_imgs)
File "D:\Program Files\Anaconda3\envs\pytorch-gpu\lib\site-packages\torch\nn\modules\module.py", line 325, in __call__
result = self.forward(*input, **kwargs)
File "K:\Desktop\face_detect\DFace-win64\src\core\models.py", line 97, in forward
x =