ytfeng commited on
Commit
edd0844
·
1 Parent(s): 9665382

fix nontype error (#215)

Browse files
models/face_detection_yunet/demo.py CHANGED
@@ -62,7 +62,7 @@ def visualize(image, results, box_color=(0, 255, 0), text_color=(0, 0, 255), fps
62
  if fps is not None:
63
  cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color)
64
 
65
- for det in (results if results is not None else []):
66
  bbox = det[0:4].astype(np.int32)
67
  cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2)
68
 
 
62
  if fps is not None:
63
  cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color)
64
 
65
+ for det in results:
66
  bbox = det[0:4].astype(np.int32)
67
  cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2)
68
 
models/face_detection_yunet/yunet.py CHANGED
@@ -52,4 +52,4 @@ class YuNet:
52
  def infer(self, image):
53
  # Forward
54
  faces = self._model.detect(image)
55
- return faces[1]
 
52
  def infer(self, image):
53
  # Forward
54
  faces = self._model.detect(image)
55
+ return np.array([]) if faces[1] is None else faces[1]