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
https://github.com/ZhaoJ9014/face.evoLVe.PyTorch/blob/master/align/detector.py#L24
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