diff --git a/models/face_detection_yunet/demo.py b/models/face_detection_yunet/demo.py index 083372c7..cdc0b85e 100644 --- a/models/face_detection_yunet/demo.py +++ b/models/face_detection_yunet/demo.py @@ -62,7 +62,7 @@ def visualize(image, results, box_color=(0, 255, 0), text_color=(0, 0, 255), fps if fps is not None: cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color) - for det in (results if results is not None else []): + for det in results: bbox = det[0:4].astype(np.int32) cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2) diff --git a/models/face_detection_yunet/yunet.py b/models/face_detection_yunet/yunet.py index 5b7369bb..21558255 100644 --- a/models/face_detection_yunet/yunet.py +++ b/models/face_detection_yunet/yunet.py @@ -52,4 +52,4 @@ def setInputSize(self, input_size): def infer(self, image): # Forward faces = self._model.detect(image) - return faces[1] + return np.array([]) if faces[1] is None else faces[1]