Skip to content

Commit

Permalink
Merge pull request #62 from michalgrzyska/master
Browse files Browse the repository at this point in the history
Added --disable-progress-output
  • Loading branch information
mdraw authored Oct 13, 2024
2 parents 1e6a87f + 50930f7 commit 09b670d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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

0 comments on commit 09b670d

Please sign in to comment.