hpc203 / 10kinds-light-face-detector-align-recognition

10种轻量级人脸检测算法的比拼,其中还包含人脸关键点检测与对齐,人脸特征向量提取和计算距离相似度

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用mtcnn_pfld_landmark运行getfeature时报错

sleepy-syr opened this issue · comments

Run person0, name:baiqianyuanTraceback (most recent call last): File "D:/Project/video_recognition/get_face_feature.py", line 101, in <module> _, face_img = detect_face.detect(srcimg) ###肖像照,图片中有且仅有有一个人脸 File "D:\Project\video_recognition\mtcnn_pfld_landmark.py", line 14, in detect bounding_boxes, landmarks = self.mtcnn.detect(srcimg) ###landmarks: numpy array, n x 10 (x1, x2 ... x5, y1, y2 ..y5) File "D:\Project\video_recognition\pfld_mtcnn\detector.py", line 397, in detect bounding_boxes = np.vstack(bounding_boxes) File "<__array_function__ internals>", line 6, in vstack File "D:\Ksoftware\Anaconda2020.2\envs\Restorch\lib\site-packages\numpy\core\shape_base.py", line 283, in vstack return _nx.concatenate(arrs, 0) File "<__array_function__ internals>", line 6, in concatenate ValueError: need at least one array to concatenate

最后打印的错误:ValueError: need at least one array to concatenate
可以看出是没有检测到图片里的人脸,导致bounding_boxes为空,因此就出错了。这算是程序里不严密的地方,应该要对没检测出人脸这种情况加一个异常保护

最后打印的错误:ValueError: need at least one array to concatenate 可以看出是没有检测到图片里的人脸,导致bounding_boxes为空,因此就出错了。这算是程序里不严密的地方,应该要对没检测出人脸这种情况加一个异常保护

应该加一个简单的判断 if bounding_boxes == []: return [],[]