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

Hair cut off, some part of the image is blurred #406

Open
LecterXIV opened this issue Oct 15, 2024 · 1 comment
Open

Hair cut off, some part of the image is blurred #406

LecterXIV opened this issue Oct 15, 2024 · 1 comment

Comments

@LecterXIV
Copy link

Trying the Codeformer Whole Image Enhancement and getting amazing results but having some slight issue.
It masks/crop the image into 512x512 everything inside will be restored. the face, including some of the hairs,
however, everything outside of that 512x512x mask/cropped is blurred.
Any help will be greatly appreciated.
Thanks!
Screenshot_1

@mikecokina
Copy link

@LecterXIV I faced the same issue in the face swap library. The explanation lies in the underlying processes that handle the cropped face part of the image, usually provided via the FaceRestoreHelper from facexlib. This tool detects the face, crops it out, and aligns it based on landmarks. Obviously, it also includes hair within the bounding box. After that, CodeFormer restores the entire image within the bounding box, including the hair, and everything is reconstructed in reverse order.

I made some changes in my library to replace only the facial parts, excluding the hair. Initially, I worked on a version that included hair, but it turned out to be quite tricky due to the inconsistent hair length and the way CodeFormer operates. You can find an example in the README on how to use it here: reactor-lib

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

2 participants