Face Editor for Stable Diffusion. It can be used to repair broken faces in images generated by Stable Diffusion.
This is a custom script of AUTOMATIC1111's Stable Diffusion Web UI.
Copy face_editor.py into scripts directory of stable-diffusion-webui and restart the web ui.
This script is used in the img2img tab of the web ui.
It is recommended that you use the same settings (prompt, sampling steps and method, seed, etc.) as for the original image. So, it is a good idea to start with the PNG Info tab.
- Click PNG Info tab.
- Upload the image to be edited.
- Click Send to img2img button.
- In the img2img tab, select Face Editor script.
- Set parameters.
- Click Generate button.
If you are not satisfied with the results, adjust the parameters and rerun.
This script performs the following steps:
Crop the detected face image and resize it to 512x512.
Run img2img with the image to create a new face image.
Resize the new face image and paste it at the original image location.
To remove the borders generated when pasting the image, mask all but the face and run inpaint.
Use this parameter when you want to reduce the number of faces to be detected. If more faces are found than the number set here, the smaller faces will be ignored.
This is the parameter for step-1.
Confidence threshold for face detection. Set a lower value if you want to detect more faces.
This is the parameter for step-1.
Specify the size of the margin for face cropping by magnification.
If other parameters are exactly the same but this value is different, the atmosphere of the new face created will be different.
This is the parameter for step-2.
Prompt for generating a new face. If this parameter is not specified, the prompt entered at the top of the screen is used.
This is the parameter for step-3.
Denoising strength for generating a new face. If the value is too small, facial collapse cannot be corrected, but if it is too large, it is difficult to blend with the entire image.
This is the parameter for step-3.
Size of the mask area when inpainting to blend the new face with the whole image.
This is the parameter for step-5.
Size of the blur area when inpainting to blend the new face with the whole image.
This is the parameter for step-5.
Denoising strength when inpainting to blend the new face with the whole image. If the border lines are too prominent, increase this value.
This is the parameter for step-5.
Specify whether to save the image before modification.
Specifies whether to display images of detected faces and masks.