Skip to content

Commit 3caf3bf

Browse files
authored
Merge pull request ototadana#82 from ototadana/chore/improve-ui
improve UI
2 parents c15a614 + 3f40822 commit 3caf3bf

File tree

4 files changed

+142
-153
lines changed

4 files changed

+142
-153
lines changed

README.md

+64-81
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,28 @@ This software improves facial images in these features:
2121

2222

2323
## Usage
24-
1. Click "Face Editor" and check "Enabled".
24+
1. Click "Face Editor" and check **"Enabled"**.
2525
![Check Enabled](./images/usage-01.png)
2626
2. Then enter the prompts as usual and click the "Generate" button to modify the faces in the generated images.
2727
![Result](./images/usage-02.png)
2828
3. If you are not satisfied with the results, adjust the [parameters](#parameters) and rerun. see [Tips](#tips).
2929

3030

3131
## Tips
32-
### Recommended settings
33-
Please try the following settings first:
34-
35-
- Set the **"Mask size"** to `0`.
36-
- Check **"Apply inside mask only"**
37-
- Set the **"Mask blur"** to `12`.
38-
- Set the **"Denoising strength for the entire image"** to `0`.
39-
40-
![Recommended settings](./images/tips-01.png)
41-
4232
### Contour discomfort
4333
If you feel uncomfortable with the facial contours, try increasing the **"Mask size"** value. This discomfort often occurs when the face is not facing straight ahead.
4434

4535

4636
![Mask size](./images/tips-02.jpg)
4737

38+
---
4839
### When multiple faces are close together
4940
When multiple faces are close together, one face may collapse under the influence of the other.
5041
In such cases, enable **"Use minimal area for face selection"**.
5142

5243
![Use minimal area for face selection](./images/tips-04.png)
5344

45+
---
5446
### Change facial expression
5547
Use **"Prompt for face"** option if you want to change the facial expression.
5648

@@ -68,7 +60,7 @@ Faces can be individually directed with prompts separated by `||` (two vertical
6860
- If you write the string `@@`, the normal prompts (written at the top of the screen) will be expanded at that position.
6961
- If you are using the [Wildcards Extension](https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards), you can use the `__name__` syntax and the text file in the directory of the wildcards extension as well as the normal prompts.
7062

71-
63+
---
7264
### Fixing images that already exist
7365
If you wish to modify the face of an already existing image instead of creating a new one, follow these steps:
7466

@@ -86,95 +78,59 @@ If you wish to modify the face of an already existing image instead of creating
8678
![screen-shot](./images/screen-shot.jpg)
8779
2. Click **Generate** button.
8880

81+
---
8982
## How it works
9083
This script performs the following steps:
9184

9285
### Step 0
9386
First, image(s) are generated as usual according to prompts and other settings. This script acts as a post-processor for those images.
9487

95-
### Step 1
88+
### Step 1. Face Detection
9689
Detects faces on the image.
9790
![step-1](./images/step-1.jpg)
9891

99-
### Step 2
92+
### Step 2. Crop and Resize the Faces
10093
Crop the detected face image and resize it to 512x512.
10194
![step-2](./images/step-2.jpg)
10295

103-
### Step 3
96+
### Step 3. Recreate the Faces
10497
Run **img2img** with the image to create a new face image.
10598
![step-3](./images/step-3.jpg)
10699

107-
### Step 4
100+
### Step 4. Paste the Faces
108101
Resize the new face image and paste it at the original image location.
109102
![step-4](./images/step-4.jpg)
110103

111-
### Step 5
104+
### Step 5. Blend the entire image
112105
To remove the borders generated when pasting the image, mask all but the face and run **inpaint**.
113106
![step-5](./images/step-5.jpg)
114107

115108
### Completed
116109
![step-6](./images/step-6.jpg)
117110

118111
## Parameters
119-
### Maximum number of faces to detect (1-20)
120-
Use this parameter when you want to reduce the number of faces to be detected.
121-
If more faces are found than the number set here, the smaller faces will be ignored.
122-
123-
This is the parameter for [step-1](#step-1).
124-
125-
### Face detection confidence (0.7-1.0)
126-
Confidence threshold for face detection. Set a lower value if you want to detect more faces.
127-
128-
This is the parameter for [step-1](#step-1).
129-
130-
### Face margin (1.0-2.0)
131-
Specify the size of the margin for face cropping by magnification.
132-
133-
If other parameters are exactly the same but this value is different, the atmosphere of the new face created will be different.
134-
135-
![face margin](./images/face-margin.jpg)
136-
137-
This is the parameter for [step-2](#step-2).
138-
139-
### Use minimal area for face selection
112+
### Basic Options
113+
##### Use minimal area for face selection (for multiple faces)
140114
When pasting the generated image to its original location, the rectangle of the detected face area is used. If this option is not enabled, the generated image itself is pasted. In other words, enabling this option applies a smaller face image, while disabling it applies a larger face image.
141115

142-
This is the parameter for [step-4](#step-4).
143-
144-
### Size of the face when recreating
145-
Specifies one side of the image size when creating a face image. Normally, there should be no need to change this from the default value (512), but you may see interesting changes if you do.
146-
147-
This is the parameter for [step-3](#step-3).
148-
149-
### Ignore faces larger than specified size
150-
Ignore if the size of the detected face is larger than the size specified in "Size of the face when recreating".
116+
##### Save original image
117+
Specify whether to save the image before modification.
151118

152-
This is the parameter for [step-1](#step-1).
119+
##### Show intermediate steps
120+
Specifies whether to display images of detected faces and masks.
153121

154-
For more information, please see: [here](https://github.com/ototadana/sd-face-editor/issues/65).
122+
If the generated image is unnatural, enabling it may reveal the cause.
155123

156-
### Prompt for face
124+
##### Prompt for face
157125
Prompt for generating a new face.
158126
If this parameter is not specified, the prompt entered at the top of the screen is used.
159127

160-
This is the parameter for [step-3](#step-3).
161-
162-
### Denoising strength for face images (0.1-0.8)
163-
Denoising strength for generating a new face.
164-
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.
128+
For more information, please see: [here](#change-facial-expression).
165129

166-
**strength: 0.4**
167-
![strength 0.4](./images/deno-4.jpg)
168130

169-
**strength: 0.6**
170-
![strength 0.6](./images/deno-6.jpg)
171-
172-
**strength: 0.8**
173-
![strength 0.8](./images/deno-8.jpg)
174131

175-
This is the parameter for [step-3](#step-3).
176132

177-
### Mask size (0-64)
133+
##### Mask size (0-64)
178134
Size of the mask area when inpainting to blend the new face with the whole image.
179135

180136
**size: 0**
@@ -186,33 +142,60 @@ Size of the mask area when inpainting to blend the new face with the whole image
186142
**size: 20**
187143
![mask size 20](./images/mask-20.jpg)
188144

189-
This is the parameter for [step-5](#step-5).
190-
191-
### Mask blur (0-64)
145+
##### Mask blur (0-64)
192146
Size of the blur area when inpainting to blend the new face with the whole image.
193147

194-
This is the parameter for [step-5](#step-5).
195148

196-
### Denoising strength for the entire image (0.0-1.0)
197-
Denoising strength when inpainting to blend the new face with the whole image.
198-
If the border lines are too prominent, increase this value.
149+
---
150+
### Advanced Options
151+
#### Step 1. Face Detection
152+
##### Maximum number of faces to detect (1-20)
153+
Use this parameter when you want to reduce the number of faces to be detected.
154+
If more faces are found than the number set here, the smaller faces will be ignored.
199155

200-
This is the parameter for [step-5](#step-5).
156+
##### Face detection confidence (0.7-1.0)
157+
Confidence threshold for face detection. Set a lower value if you want to detect more faces.
201158

202-
### Apply inside mask only
203-
Paste an image cut out in the shape of a face instead of a square image.
159+
#### Step 2. Crop and Resize the Faces
160+
##### Face margin (1.0-2.0)
161+
Specify the size of the margin for face cropping by magnification.
162+
163+
If other parameters are exactly the same but this value is different, the atmosphere of the new face created will be different.
204164

205-
This is the parameter for [step-4](#step-4).
165+
![face margin](./images/face-margin.jpg)
206166

207-
For more information, please see: [here](https://github.com/ototadana/sd-face-editor/issues/33).
167+
##### Size of the face when recreating
168+
Specifies one side of the image size when creating a face image. Normally, there should be no need to change this from the default value (512), but you may see interesting changes if you do.
208169

209-
### Save original image
210-
Specify whether to save the image before modification.
170+
##### Ignore faces larger than specified size
171+
Ignore if the size of the detected face is larger than the size specified in "Size of the face when recreating".
211172

212-
For more information, please see: [here](https://github.com/ototadana/sd-face-editor/issues/7#issuecomment-1505091410).
173+
For more information, please see: [here](https://github.com/ototadana/sd-face-editor/issues/65).
213174

214-
### Show intermediate steps
215-
Specifies whether to display images of detected faces and masks.
175+
#### Step 3. Recreate the Faces
176+
##### Denoising strength for face images (0.1-0.8)
177+
Denoising strength for generating a new face.
178+
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.
179+
180+
**strength: 0.4**
181+
![strength 0.4](./images/deno-4.jpg)
182+
183+
**strength: 0.6**
184+
![strength 0.6](./images/deno-6.jpg)
185+
186+
**strength: 0.8**
187+
![strength 0.8](./images/deno-8.jpg)
188+
189+
#### Step 4. Paste the Faces
190+
##### Apply inside mask only
191+
Paste an image cut out in the shape of a face instead of a square image.
192+
193+
For more information, please see: [here](https://github.com/ototadana/sd-face-editor/issues/33).
194+
195+
#### Step 5. Blend the entire image
196+
##### Denoising strength for the entire image (0.0-1.0)
197+
Denoising strength when inpainting to blend the new face with the whole image.
198+
If the border lines are too prominent, increase this value.
216199

217200

218201
## API

images/tips-06.png

-8.65 KB
Loading

images/usage-01.png

13.7 KB
Loading

0 commit comments

Comments
 (0)