ZhaoJ9014 / face.evoLVe

🔥🔥High-Performance Face Recognition Library on PaddlePaddle & PyTorch🔥🔥
MIT License
3.44k stars 760 forks source link

Performance Issue #35

Open tchaton opened 5 years ago

tchaton commented 5 years ago

https://github.com/ZhaoJ9014/face.evoLVe.PyTorch/blob/master/align/detector.py#L24

# LOAD MODELS
pnet = PNet()
rnet = RNet()
onet = ONet()
onet.eval()

Model are loaded on detect_faces.

So in face_align.py for subfolder in tqdm(os.listdir(source_root)): if not os.path.isdir(os.path.join(dest_root, subfolder)): os.mkdir(os.path.join(dest_root, subfolder)) for image_name in os.listdir(os.path.join(source_root, subfolder)): print("Processing\t{}".format(os.path.join(source_root, subfolder, image_name))) img = Image.open(os.path.join(source_root, subfolder, imagename)) try: # Handle exception , landmarks = detect_faces(img)

Models are going to be loaded every time. They should be put outside of the function