From 50930f71eadbe2a592e577e77773b156d79b3437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grzy=C5=9Bka?= Date: Tue, 8 Oct 2024 14:53:18 +0200 Subject: [PATCH] Added --disable-progress-output --- README.md | 2 ++ deface/deface.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e83ef0b..416c71c 100644 --- a/README.md +++ b/README.md @@ -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} diff --git a/deface/deface.py b/deface/deface.py index 9bbf54e..d6cbb65 100644 --- a/deface/deface.py +++ b/deface/deface.py @@ -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: @@ -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() @@ -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.') @@ -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) @@ -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(