fix bug when no face detected

This commit is contained in:
David Chatel
2024-03-10 18:37:36 +01:00
parent e1f558a8aa
commit a7eb43f89a
-1
View File
@@ -94,7 +94,6 @@ class Face:
def detect_faces(img, threshold):
dets = Models.yolo((img[None] / 255).permute(0,3,1,2), threshold)
boxes = (dets.boxes.xyxy.reshape(-1,2,2)).reshape(-1,4)
a,b,c,d = [int(x) for x in boxes[0]]
faces = []
for (a,b,c,d), box in zip(boxes.type(torch.int).cpu().numpy(), dets.boxes):
cx, cy = (a+c)/2, (b+d)/2