Open hnudagger opened 2 years ago
@hnudagger This error is caused by the face detector failing to find a face in one of the frames. It might be a result of the video containing some extreme poses. You can try to solve it by replacing the face detector, by adding --use_fa to the command. However, in my experience, the generator also doesn't do well on poses where the alignment fails, So there's a good chance the results wouldn't look great.
As for the unclear message, I'll make sure to fix that and give a clearer error
I came across this issue and simply put compute_transform
within a try...except and passed on exception.
Reckon skipping some frames would cause any issues? I also noticed that sometimes it would skip a very identical frame due to not detecting a face, but would work just fine in the next frame.
@Infinitay Unfortunately I don't think that skipping frames with the current code would work. The editing script assumes that all frames are used, so it would cause a mismatch between the background and the face.
I would assume that the skipped frames are a result of a threshold, and that the next frame passes it closely.
I have not tried it myself, but it is possible to control that threshold, as shown here:
http://dlib.net/face_detector.py.html
Alternatively, using --use_fa
gives a better detection rate, without changes in code.
By the way, just to make sure, are the skipped frames forward facing? Or are they looking more to the sides/up/down?
By the way, just to make sure, are the skipped frames forward facing? Or are they looking more to the sides/up/down?
The face is tilted sideways looking down. However there are multiple frames like it and it detects a face just fine. Not too big of an issue. I am testing it out on a video that probably isn't the best for this as the subject isn't sitting still as in the examples.
@hnudagger This error is caused by the face detector failing to find a face in one of the frames. It might be a result of the video containing some extreme poses. You can try to solve it by replacing the face detector, by adding --use_fa to the command. However, in my experience, the generator also doesn't do well on poses where the alignment fails, So there's a good chance the results wouldn't look great.
Thanks. And I saw your new commit. If no face is in an image, it will raise Exception(f'Did not detect any faces in image: {filepath}')
.
How about this one? When no face in image, the code doesn't do anything but return the origin image. Does it work? Thank you.
File "./utils/alignment.py", line 111. The function "compute_transform" returns None if "lm is None". However, in line 53, and line 157, it need return "c, x, y". It will get NoneType object error.