sczhou/CodeFormer

Detection Error! CodeFormer Detects 3 Faces in a Single-Face Image, Generates a Ridiculous Result. How to Fix?

TechVillain opened this issue · 0 comments

CodeFormer is not able to detect the correct number of faces, and therefore causing errors.

Detection Error

Original image has a perfect background (non-face area), as you can see, the red clothes are sharp and clear, and nothing needs to be fixed. However, the face area is blurry in low resolution, needs to be restored by CodeFormer.

So I go ahead and run CodeFormer, with "--face_upsample" argument, so the face can be upsampled by the built-in Real-ESRGAN_x2 model.

Here is the problem: The default "Resnet50_Final" model inside CodeFormer detects 3 faces, not 1 face, and therefore restores the same face 3 times, and then combine the 3 restored faces together. The end result is very bad, especially on the eyes and nose.

I tried to use argument "--dectection_model dlib" to switch the detection model to dlib, and then switched to mobile0.25 and the two YOLOv5 models, none of which is working. The models either detect 0 faces or more than 1 faces.

Is there a way to force Resnet50 model to detect only one face and then stop, without continuing to detect additional faces?

Can someone please download my picture and run CodeFormer on it to see if there is a solution to fix this face detection problem?