Skip to content

Commit

Permalink
add warning on improved mask and upscaling and make it disabled in se…
Browse files Browse the repository at this point in the history
…ttings by default
  • Loading branch information
glucauze committed Aug 6, 2023
1 parent db79243 commit e6592a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/faceswaplab_settings/faceswaplab_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def on_ui_settings() -> None:
shared.opts.add_option(
"faceswaplab_default_upscaled_swapper_improved_mask",
shared.OptionInfo(
True,
False,
"Default Use improved segmented mask (use pastenet to mask only the face) (requires restart)",
gr.Checkbox,
{"interactive": True},
Expand Down
5 changes: 5 additions & 0 deletions scripts/faceswaplab_swapping/upscaled_inswapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ def compute_diff(bgr_fake: CV2ImgU8, aimg: CV2ImgU8) -> CV2ImgU8:
)

if options.improved_mask:
if k == 1:
logger.warning(
"Please note that improved mask does not work well without upscaling. Set upscaling to Lanczos at least if you want speed and want to use improved mask."
)

logger.info("improved_mask")
mask = get_face_mask(aimg, bgr_fake)
bgr_fake = merge_images_with_mask(aimg, bgr_fake, mask)
Expand Down

0 comments on commit e6592a1

Please sign in to comment.