faster-mobile-retinaface icon indicating copy to clipboard operation
faster-mobile-retinaface copied to clipboard

how can i detect face in image in face_detect.py? I am a newbie

Open phamkhactu opened this issue 5 years ago • 0 comments

here my code

    fd = MxnetDetectionModel("weights/16and32", 0,
                             scale=.4, gpu=-1, margin=0.15)
    img = cv2.imread('./images/test.jpg')
    copy = np.array(img)
    detach = fd.detect(copy)

    for res in fd._nms_wrapper(detach):
        cv2.rectangle(img, (res[0], res[1]),(res[2], res[3]), (255, 255, 0))
    cv2.imshow('face',img)
    cv2.waitKey()

and error

inferance: 0.009732400998473167
<generator object BaseDetection.non_maximum_suppression at 0x7f73341e28b8>
Traceback (most recent call last):
  File "face_detector.py", line 282, in <module>
    for res in fd._nms_wrapper(detach):
  File "face_detector.py", line 71, in non_maximum_suppression
    x1, y1, x2, y2, scores = dets.T
AttributeError: 'generator' object has no attribute 'T'

Thanks for your help!!

phamkhactu avatar Feb 09 '20 15:02 phamkhactu