10kinds-light-face-detector-align-recognition icon indicating copy to clipboard operation
10kinds-light-face-detector-align-recognition copied to clipboard

使用mtcnn_pfld_landmark运行getfeature时报错

Open sleepy-syr opened this issue 4 years ago • 2 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

sleepy-syr avatar Nov 11 '20 01:11 sleepy-syr

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

hpc203 avatar Nov 12 '20 02:11 hpc203

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

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

YJYlala avatar Apr 29 '22 14:04 YJYlala