Face_Detection_Alignment icon indicating copy to clipboard operation
Face_Detection_Alignment copied to clipboard

pad function on face_detect seem not to work

Open inaki-loomai opened this issue 6 years ago • 0 comments

First of all congrats for the impressive work!

When trying the different demo notebooks I get an error in the pad function:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-147bcad63f9d> in <module>()
      7 bounding_boxes = np.array([[bbox.points[0][1], bbox.points[0][0], bbox.points[2][1], bbox.points[2][0], 1.]])
      8 # 1 step box regression to simulate the variance of detector
----> 9 bounding_boxes, points = detect_face.box_regression(image.pixels_with_channels_at_back() * 255, onet, bounding_boxes, 0.001)
     10 
     11 print('Box Number: %s' % bounding_boxes.shape[0])

~/repos/Face_Detection_Alignment/detect_face.py in box_regression(img, onet, total_boxes, threshold)
    399         total_boxes = rerec(total_boxes)
    400         total_boxes = np.fix(total_boxes).astype(np.int32)
--> 401         dy, edy, dx, edx, y, ey, x, ex, tmpw, tmph = pad(total_boxes.copy(), w, h)
    402         tempimg = np.zeros((48,48,3,numbox))
    403         for k in range(0,numbox):

~/repos/Face_Detection_Alignment/detect_face.py in pad(total_boxes, w, h)
    523 
    524     tmp = np.where(ex>w)
--> 525     edx[tmp] = np.expand_dims(-ex[tmp]+w+tmpw[tmp],1)
    526     ex[tmp] = w
    527 

ValueError: shape mismatch: value array of shape (0,1) could not be broadcast to indexing result of shape (0,)

I am trying to fix it but since I am not sure how this padding is implemented is kind of difficult.

I am using TF 1.3, Python 3.5

Thanks!

inaki-loomai avatar Feb 14 '19 12:02 inaki-loomai