Skip to content

Commit

Permalink
adding progress flag to draw_labels()
Browse files Browse the repository at this point in the history
  • Loading branch information
brimoor committed Jan 2, 2024
1 parent a34fd05 commit 23a0d1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions fiftyone/core/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -8188,6 +8188,7 @@ def draw_labels(
label_fields=None,
overwrite=False,
config=None,
progress=None,
**kwargs,
):
"""Renders annotated versions of the media in the collection with the
Expand Down Expand Up @@ -8217,6 +8218,9 @@ def draw_labels(
config (None): an optional
:class:`fiftyone.utils.annotations.DrawConfig` configuring how
to draw the labels
progress (None): whether to render a progress bar (True/False), use
the default value ``fiftyone.config.show_progress_bars``
(None), or a progress callback function to invoke instead
**kwargs: optional keyword arguments specifying parameters of the
default :class:`fiftyone.utils.annotations.DrawConfig` to
override
Expand Down Expand Up @@ -8244,6 +8248,7 @@ def draw_labels(
rel_dir=rel_dir,
label_fields=label_fields,
config=config,
progress=progress,
**kwargs,
)

Expand All @@ -8254,6 +8259,7 @@ def draw_labels(
rel_dir=rel_dir,
label_fields=label_fields,
config=config,
progress=progress,
**kwargs,
)

Expand Down
13 changes: 11 additions & 2 deletions fiftyone/utils/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,13 @@ def draw_labeled_image(


def draw_labeled_videos(
samples, output_dir, rel_dir=None, label_fields=None, config=None, **kwargs
samples,
output_dir,
rel_dir=None,
label_fields=None,
config=None,
progress=None,
**kwargs,
):
"""Renders annotated versions of the videos in the collection with the
specified label data overlaid to the given directory.
Expand All @@ -2429,6 +2435,9 @@ def draw_labeled_videos(
If omitted, all compatiable fields are rendered
config (None): an optional :class:`DrawConfig` configuring how to draw
the labels
progress (None): whether to render a progress bar (True/False), use the
default value ``fiftyone.config.show_progress_bars`` (None), or a
progress callback function to invoke instead
**kwargs: optional keyword arguments specifying parameters of the
default :class:`DrawConfig` to override
Expand All @@ -2448,7 +2457,7 @@ def draw_labeled_videos(
num_videos = len(samples)

outpaths = []
for idx, sample in enumerate(samples, 1):
for idx, sample in enumerate(samples.iter_samples(progress=progress), 1):
if is_clips:
logger.info("Drawing labels for clip %d/%d", idx, num_videos)
base, ext = os.path.splitext(sample.filepath)
Expand Down

0 comments on commit 23a0d1d

Please sign in to comment.