Skip to content

Commit b6e370b

Browse files
authored
fix nontype error (opencv#215)
1 parent c4684d1 commit b6e370b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/face_detection_yunet/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def visualize(image, results, box_color=(0, 255, 0), text_color=(0, 0, 255), fps
6262
if fps is not None:
6363
cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color)
6464

65-
for det in (results if results is not None else []):
65+
for det in results:
6666
bbox = det[0:4].astype(np.int32)
6767
cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2)
6868

models/face_detection_yunet/yunet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ def setInputSize(self, input_size):
5252
def infer(self, image):
5353
# Forward
5454
faces = self._model.detect(image)
55-
return faces[1]
55+
return np.array([]) if faces[1] is None else faces[1]

0 commit comments

Comments
 (0)