TencentARC / GFPGAN

GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration.
Other
35.08k stars 5.81k forks source link

Hair cut off #359

Open CommanderLake opened 1 year ago

CommanderLake commented 1 year ago

I'm using 1.4 with amazing results but where it crops the faces it cuts off half of the hair and there's a plainly visible line where sharp turns to blurry, can i make it expand the face crop to include the hair?

CommanderLake commented 1 year ago

Capture

Loacoon1 commented 11 months ago

I have the same problem... I believe that everyone does. Couldn't figure out a way to solve this. It should either include all the hair or none. The way it actually is the photos are mostly unusable sadly. Sadly this project seems pretty much abandoned...

Luzifr commented 11 months ago

I found that also other image enhancer + upscaler AI webpages have similar problems, like https://replicate.com/tencentarc/gfpgan. Probably they all use same/similar models. But the border between sharp and blurry hair is not so clear on other models, it seems. Strange thing here is, that the line is always slanted, never exactly horizontal. I wonder why. Too sad this model has this flaw, it's the only image enhancer which has this great nearly freely adjustable upscaling functionality! And i need that really often.

sutte commented 3 months ago

This problem is caused by facexlib, the algorithm of mask blur is not well. So we can replace it with facelib(from codeformer). We need to replace 2 files : facexlib/utils/face_restoration_helper.py, misc.py. Then the problem will be solved

johnbilnn commented 2 months ago

Can you be more specific please? I'd really appreciate it

sutte commented 1 month ago

You can download facelib from https://github.com/sczhou/CodeFormer, then replace 2 files: face_restoration_helper.py and misc.py, 2 files are in the following path: %Your Python Path%/Lib/site-packages/facexlib/utils