Giter VIP home page Giter VIP logo

sd-face-editor's Introduction

Face Editor

Face Editor for Stable Diffusion. It can be used to repair broken faces in images generated by Stable Diffusion.

example

This is a custom script of AUTOMATIC1111's Stable Diffusion Web UI.

Setup

Copy face_editor.py into scripts directory of stable-diffusion-webui and restart the web ui.

Usage

This script is used in the img2img tab of the web ui.

1. Open the image to be edited in the img2img tab

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.

  1. Click PNG Info tab.
  2. Upload the image to be edited.
  3. Click Send to img2img button.

2. Open Face Editor and Generate

  1. In the img2img tab, select Face Editor script. screen-shot
  2. Set parameters.
  3. Click Generate button.

If you are not satisfied with the results, adjust the parameters and rerun.

How it works

This script performs the following steps:

Step 1

Detects faces on the image. step-1

Step 2

Crop the detected face image and resize it to 512x512. step-2

Step 3

Run img2img with the image to create a new face image. step-3

Step 4

Resize the new face image and paste it at the original image location. step-4

Step 5

To remove the borders generated when pasting the image, mask all but the face and run inpaint. step-5

Completed

step-6

Parameters

Maximum number of faces to detect (1-20)

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.

Face detection confidence (0.7-1.0)

Confidence threshold for face detection. Set a lower value if you want to detect more faces.

This is the parameter for step-1.

Face margin (1.0-2.0)

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.

face margin

This is the parameter for step-2.

Prompt for face

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 face images (0.1-0.8)

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.

strength: 0.4 strength 0.4

strength: 0.6 strength 0.6

strength: 0.8 strength 0.8

This is the parameter for step-3.

Mask size (0-64)

Size of the mask area when inpainting to blend the new face with the whole image.

size: 0 mask size 0

size: 10 mask size 10

size: 20 mask size 20

This is the parameter for step-5.

Mask blur (0-64)

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 for the entire image (0.0-1.0)

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.

Apply inside mask only

Paste an image cut out in the shape of a face instead of a square image. For more information, please see: here.

This is the parameter for step-4.

Save original image (txt2img only)

Specify whether to save the image before modification. For more information, please see: here.

Show intermediate steps (img2img only)

Specifies whether to display images of detected faces and masks.

sd-face-editor's People

Contributors

ototadana avatar betogaona7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.