Open Joaquin-aliaga opened 3 years ago
@Joaquin-aliaga I've already find a solution for not using mtccn twice and post here if anyone faces the same issue. Since mtcnn.detect() returns bounding boxes and probs, just use:
bbx, prob = mtcnn.detect(img)
if (bbx is not None):
face_cropped = mtcnn.extract(img,bbx,None)
...
else:
return None
In that way you don't have to pass your image twice through the CNN.
However it would be nice if mtcnn() returns None when no face was detected.
The problem has been solved.
if type(boxes) == numpy.ndarray:
for bbox in boxes:
Hi, I'm developing a face verification system, so I'm using mtcnn to detect faces and then do the verification step.
The code I have is something like:
However, I'm wondering if there is a way to handle the "no face in image" case without use mtcnn twice, because I assume mtcnn.detect() and mtcnn() use almost the same code.
If I just use
face_cropped = mtcnn(img)
and img has no face, I get an error.Thanks in advance