PKUWilliamYang commited on
Commit
4a0d568
1 Parent(s): b98a8ac

add w+ encoder

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -96,8 +96,13 @@ def main():
96
  - Drop an image containing a near-frontal face to the **Input Image**.
97
  - If there are multiple faces in the image, hit the Edit button in the upper right corner and crop the input image beforehand.
98
  - Hit the **Preprocess** button.
 
99
  - The final result will be based on this **Reconstructed Face**. So, if the reconstructed image is not satisfactory, you may want to change the input image.
100
  ''')
 
 
 
 
101
  with gr.Row():
102
  with gr.Column():
103
  with gr.Row():
@@ -154,6 +159,7 @@ def main():
154
 
155
  - Adjust **Structure Weight** and **Color Weight**.
156
  - These are weights for the style image, so the larger the value, the closer the resulting image will be to the style image.
 
157
  - Hit the **Generate** button.
158
  ''')
159
  with gr.Row():
@@ -191,10 +197,10 @@ def main():
191
  gr.Markdown(FOOTER)
192
 
193
  preprocess_button.click(fn=model.detect_and_align_face,
194
- inputs=input_image,
195
  outputs=aligned_face)
196
  aligned_face.change(fn=model.reconstruct_face,
197
- inputs=aligned_face,
198
  outputs=[
199
  reconstructed_face,
200
  instyle,
 
96
  - Drop an image containing a near-frontal face to the **Input Image**.
97
  - If there are multiple faces in the image, hit the Edit button in the upper right corner and crop the input image beforehand.
98
  - Hit the **Preprocess** button.
99
+ - Choose the encoder version. Default is Z+ encoder which has better stylization performance. W+ encoder better reconstructs the input image to preserve more details.
100
  - The final result will be based on this **Reconstructed Face**. So, if the reconstructed image is not satisfactory, you may want to change the input image.
101
  ''')
102
+ with gr.Row():
103
+ encoder_type = gr.Radio(choices=['Z+ encoder (better stylization)', 'W+ encoder (better reconstruction)'],
104
+ value='Z+ encoder (better stylization)',
105
+ label='Encoder Type')
106
  with gr.Row():
107
  with gr.Column():
108
  with gr.Row():
 
159
 
160
  - Adjust **Structure Weight** and **Color Weight**.
161
  - These are weights for the style image, so the larger the value, the closer the resulting image will be to the style image.
162
+ - Tips: For W+ encoder, better way of (Structure Only) is to uncheck (Structure Only) and set Color weight to 0.
163
  - Hit the **Generate** button.
164
  ''')
165
  with gr.Row():
 
197
  gr.Markdown(FOOTER)
198
 
199
  preprocess_button.click(fn=model.detect_and_align_face,
200
+ inputs=[input_image],
201
  outputs=aligned_face)
202
  aligned_face.change(fn=model.reconstruct_face,
203
+ inputs=[aligned_face, encoder_type],
204
  outputs=[
205
  reconstructed_face,
206
  instyle,