Skip to content

Commit

Permalink
Merge pull request #236 from 1adrianb/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
1adrianb authored Dec 16, 2020
2 parents 5ffd6d8 + 0bcf648 commit ebac679
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions face_alignment/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ def get_landmarks_from_batch(self, image_batch, detected_faces=None):
else:
pts, pts_img = pts.view(-1, 68, 2) * 4, pts_img.view(-1, 68, 2)
landmark_set.append(pts_img.numpy())

landmark_set = np.concatenate(landmark_set, axis=0)
if 0 != len(landmark_set):
landmark_set = np.concatenate(landmark_set, axis=0)
landmarks.append(landmark_set)
return landmarks

Expand Down
5 changes: 1 addition & 4 deletions face_alignment/detection/blazeface/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def detect(net, img, device):
preds = net.predict_on_image(img)

if 0 == len(preds):
return np.zeros((1, 1, 5))
return [[]]

shift = np.array([xshift, yshift] * 2)
scores = preds[:, -1:]
Expand Down Expand Up @@ -48,9 +48,6 @@ def batch_detect(net, img_batch, device):
locs = np.concatenate((pred[:, 1:2], pred[:, 0:1], pred[:, 3:4], pred[:, 2:3]), axis=1)
bboxlists.append(np.concatenate((locs * orig_size + shift, scores), axis=1))

if 0 == len(bboxlists):
bboxlists = np.zeros((1, 1, 5))

return bboxlists


Expand Down
7 changes: 0 additions & 7 deletions face_alignment/detection/sfd/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ def detect(net, img, device):
# Creates a batch of 1
img = img.reshape((1,) + img.shape)

if 'cuda' in device:
torch.backends.cudnn.benchmark = True

img = torch.from_numpy(img).float().to(device)

return batch_detect(net, img, device)
Expand Down Expand Up @@ -72,10 +69,6 @@ def batch_detect(net, img_batch, device):
bboxlists.append(bboxlist)

bboxlists = np.array(bboxlists)

if 0 == len(bboxlists):
bboxlists = np.zeros((1, 1, 5))

return bboxlists


Expand Down

0 comments on commit ebac679

Please sign in to comment.