Skip to content

Commit

Permalink
Fix bounding box reprojection
Browse files Browse the repository at this point in the history
  • Loading branch information
SthPhoenix committed Feb 18, 2020
1 parent a034e7b commit 483333f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/api/face_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ def do_flip(data):

def reproject_bb(dets, scale):
for i, bb in enumerate(dets):
if dets.shape[0] != 5:
dets[i] = bb / scale
else:
dets[i] = bb
dets[i][0:4] = bb[0:4] / scale
return dets

def reproject_points(dets, scale):
for i, bb in enumerate(dets):
dets[i] = bb / scale
return dets


def resize(img,max_size=640):
try:
Expand Down Expand Up @@ -165,7 +167,7 @@ def get_all_faces_bulk(self, imgs,max_size=640):
if e is not None:
bounding_boxes, points = e
bounding_boxes = reproject_bb(bounding_boxes, imgs_res[:, 1][idx])
points = reproject_bb(points, imgs_res[:, 1][idx])
points = reproject_points(points, imgs_res[:, 1][idx])

for i in range(bounding_boxes.shape[0]):
bbox = bounding_boxes[i, 0:4]
Expand Down

0 comments on commit 483333f

Please sign in to comment.