Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add warning on improved mask and upscaling and make it disabled in settings by default #35

Merged
merged 1 commit into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading