Skip to content

Commit

Permalink
fixed masks being saved even with no detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kex0 committed Mar 8, 2023
1 parent e65f9d0 commit 4b77d12
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/batch_face_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ def generateImages(p, facecfg, path, searchSubdir, viewResults, divider, howSpli
mask = ImageOps.invert(mask)
finishedImages.append(mask)

if saveMask:
if saveMask and skip != 1:
custom_save_image(p, mask, pathToSave, forced_filename, suffix, info)
elif saveMask and skip == 1 and saveNoFace:
custom_save_image(p, mask, pathToSave, forced_filename, suffix, info)

# If face was not found but user wants to save images without face
Expand Down Expand Up @@ -531,7 +533,9 @@ def generateImages(p, facecfg, path, searchSubdir, viewResults, divider, howSpli
mask = ImageOps.invert(mask)
finishedImages.append(mask)

if saveMask:
if saveMask and skip != 1:
custom_save_image(p, mask, pathToSave, forced_filename, suffix, info)
elif saveMask and skip == 1 and saveNoFace:
custom_save_image(p, mask, pathToSave, forced_filename, suffix, info)


Expand Down Expand Up @@ -818,7 +822,7 @@ def switchInvertMask(invertMask: bool):
gr.HTML("<p style=\"margin-top:0.10em;font-size:1.5em\">General:</p>")
htmlTip6 = gr.HTML("<p>Activate 'Show results in WebUI' checkbox to see results in the WebUI at the end (not recommended when processing a large number of images)</p>",visible=False)
with gr.Row():
viewResults = gr.Checkbox(value=False, label="Show results in WebUI")
viewResults = gr.Checkbox(value=True, label="Show results in WebUI")
showTips = gr.Checkbox(value=False, label="Show tips")

# Face detect internals
Expand Down

0 comments on commit 4b77d12

Please sign in to comment.