Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index mismatch hazard in dataset_preprocessing/ffhq/crop_images_in_the_wild.py #105

Open
three-bee opened this issue Aug 16, 2023 · 0 comments

Comments

@three-bee
Copy link

There is no assertion for len(img_files)==len(lm_files). If unsatisfied ( len(lm_files)<len(img_files), i.e. the face reconstruction backbone could not find landmarks for all given images ) this will eventually cause a hazard in the loop beginning on line 36, causing a continuous mismatch between images and their landmark files:

lm_dir = os.path.join(args.indir, "detections")
img_files = sorted([x for x in os.listdir(args.indir) if x.lower().endswith(".png") or x.lower().endswith(".jpg")])
lm_files = sorted([x for x in os.listdir(lm_dir) if x.endswith(".txt")])
lm3d_std = load_lm3d("Deep3DFaceRecon_pytorch/BFM/")
out_dir = os.path.join(args.indir, "crop")
if not os.path.exists(out_dir):
os.makedirs(out_dir, exist_ok=True)
for img_file, lm_file in zip(img_files, lm_files):
img_path = os.path.join(args.indir, img_file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant