blob: 3a128a0225fd8be4d0c7fdc1a9e78b9a069ab924 [file] [log] [blame]
giolekvaedbaf322020-05-05 18:17:37 +04001from facenet_pytorch import MTCNN
2from PIL import Image
3
4
5def detect_faces(img_file):
6 mtcnn = MTCNN(keep_all=True)
7 ret = []
8 with Image.open(img_file) as img:
9 for box in mtcnn.detect(img)[0]:
10 ret.append((box[0], box[1], box[2], box[3]))
11 return ret