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

Added --disable-progress-output #62

Merged
merged 1 commit into from
Oct 13, 2024
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ optional arguments:
--preview, -p Enable live preview GUI (can decrease performance).
--boxes Use boxes instead of ellipse masks.
--draw-scores Draw detection scores onto outputs.
--disable-progress-output
Disable video progress output to console.
--mask-scale M Scale factor for face masks, to make sure that masks
cover the complete face. Default: 1.3.
--replacewith {blur,solid,none,img,mosaic}
Expand Down
13 changes: 10 additions & 3 deletions deface/deface.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def video_detect(
replaceimg = None,
keep_audio: bool = False,
mosaicsize: int = 20,
disable_progress_output = False
):
try:
if 'fps' in ffmpeg_config:
Expand All @@ -141,9 +142,9 @@ def video_detect(
read_iter = reader.iter_data()
nframes = reader.count_frames()
if nested:
bar = tqdm.tqdm(dynamic_ncols=True, total=nframes, position=1, leave=True)
bar = tqdm.tqdm(dynamic_ncols=True, total=nframes, position=1, leave=True, disable=disable_progress_output)
else:
bar = tqdm.tqdm(dynamic_ncols=True, total=nframes)
bar = tqdm.tqdm(dynamic_ncols=True, total=nframes, disable=disable_progress_output)

if opath is not None:
_ffmpeg_config = ffmpeg_config.copy()
Expand Down Expand Up @@ -289,6 +290,9 @@ def parse_cli_args():
parser.add_argument(
'--draw-scores', default=False, action='store_true',
help='Draw detection scores onto outputs.')
parser.add_argument(
'--disable-progress-output', default=False, action='store_true',
help='Disable video progress output to console.')
parser.add_argument(
'--mask-scale', default=1.3, type=float, metavar='M',
help='Scale factor for face masks, to make sure that masks cover the complete face. Default: 1.3.')
Expand Down Expand Up @@ -366,6 +370,8 @@ def main():
mosaicsize = args.mosaicsize
keep_metadata = args.keep_metadata
replaceimg = None
disable_progress_output = args.disable_progress_output

if in_shape is not None:
w, h = in_shape.split('x')
in_shape = int(w), int(h)
Expand Down Expand Up @@ -410,7 +416,8 @@ def main():
keep_audio=keep_audio,
ffmpeg_config=ffmpeg_config,
replaceimg=replaceimg,
mosaicsize=mosaicsize
mosaicsize=mosaicsize,
disable_progress_output=disable_progress_output
)
elif filetype == 'image':
image_detect(
Expand Down
Loading