You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+64-81
Original file line number
Diff line number
Diff line change
@@ -21,36 +21,28 @@ This software improves facial images in these features:
21
21
22
22
23
23
## Usage
24
-
1. Click "Face Editor" and check "Enabled".
24
+
1. Click "Face Editor" and check **"Enabled"**.
25
25

26
26
2. Then enter the prompts as usual and click the "Generate" button to modify the faces in the generated images.
27
27

28
28
3. If you are not satisfied with the results, adjust the [parameters](#parameters) and rerun. see [Tips](#tips).
29
29
30
30
31
31
## 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
-

41
-
42
32
### Contour discomfort
43
33
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.
44
34
45
35
46
36

47
37
38
+
---
48
39
### When multiple faces are close together
49
40
When multiple faces are close together, one face may collapse under the influence of the other.
50
41
In such cases, enable **"Use minimal area for face selection"**.
51
42
52
43

53
44
45
+
---
54
46
### Change facial expression
55
47
Use **"Prompt for face"** option if you want to change the facial expression.
56
48
@@ -68,7 +60,7 @@ Faces can be individually directed with prompts separated by `||` (two vertical
68
60
- If you write the string `@@`, the normal prompts (written at the top of the screen) will be expanded at that position.
69
61
- 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.
70
62
71
-
63
+
---
72
64
### Fixing images that already exist
73
65
If you wish to modify the face of an already existing image instead of creating a new one, follow these steps:
74
66
@@ -86,95 +78,59 @@ If you wish to modify the face of an already existing image instead of creating
86
78

87
79
2. Click **Generate** button.
88
80
81
+
---
89
82
## How it works
90
83
This script performs the following steps:
91
84
92
85
### Step 0
93
86
First, image(s) are generated as usual according to prompts and other settings. This script acts as a post-processor for those images.
94
87
95
-
### Step 1
88
+
### Step 1. Face Detection
96
89
Detects faces on the image.
97
90

98
91
99
-
### Step 2
92
+
### Step 2. Crop and Resize the Faces
100
93
Crop the detected face image and resize it to 512x512.
101
94

102
95
103
-
### Step 3
96
+
### Step 3. Recreate the Faces
104
97
Run **img2img** with the image to create a new face image.
105
98

106
99
107
-
### Step 4
100
+
### Step 4. Paste the Faces
108
101
Resize the new face image and paste it at the original image location.
109
102

110
103
111
-
### Step 5
104
+
### Step 5. Blend the entire image
112
105
To remove the borders generated when pasting the image, mask all but the face and run **inpaint**.
113
106

114
107
115
108
### Completed
116
109

117
110
118
111
## 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
-

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)
140
114
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.
141
115
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.
151
118
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.
153
121
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.
155
123
156
-
### Prompt for face
124
+
#####Prompt for face
157
125
Prompt for generating a new face.
158
126
If this parameter is not specified, the prompt entered at the top of the screen is used.
159
127
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).
165
129
166
-
**strength: 0.4**
167
-

168
130
169
-
**strength: 0.6**
170
-

171
-
172
-
**strength: 0.8**
173
-

174
131
175
-
This is the parameter for [step-3](#step-3).
176
132
177
-
### Mask size (0-64)
133
+
#####Mask size (0-64)
178
134
Size of the mask area when inpainting to blend the new face with the whole image.
179
135
180
136
**size: 0**
@@ -186,33 +142,60 @@ Size of the mask area when inpainting to blend the new face with the whole image
186
142
**size: 20**
187
143

188
144
189
-
This is the parameter for [step-5](#step-5).
190
-
191
-
### Mask blur (0-64)
145
+
##### Mask blur (0-64)
192
146
Size of the blur area when inpainting to blend the new face with the whole image.
193
147
194
-
This is the parameter for [step-5](#step-5).
195
148
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.
199
155
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.
201
158
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.
204
164
205
-
This is the parameter for [step-4](#step-4).
165
+

206
166
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.
208
169
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".
211
172
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).
213
174
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
+

182
+
183
+
**strength: 0.6**
184
+

185
+
186
+
**strength: 0.8**
187
+

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.
0 commit comments