Skip to content

Commit 735b748

Browse files
ekosmanfmassa
authored andcommitted
Video clips workers (#1369)
* Expose num_workers in VideoClips * add documentation for num_workers in VideoClips * add documentation for num_workers in VideoClips * add documentation for num_workers in VideoClips
1 parent f60df2d commit 735b748

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

torchvision/datasets/video_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ class VideoClips(object):
6464
frame_rate (int, optional): if specified, it will resample the video
6565
so that it has `frame_rate`, and then the clips will be defined
6666
on the resampled video
67+
num_workers (int): how many subprocesses to use for data loading.
68+
0 means that the data will be loaded in the main process. (default: 0)
6769
"""
6870
def __init__(self, video_paths, clip_length_in_frames=16, frames_between_clips=1,
69-
frame_rate=None, _precomputed_metadata=None, num_workers=1,
70-
_backend="pyav"):
71+
frame_rate=None, _precomputed_metadata=None, num_workers=0, _backend="pyav"):
7172
self.video_paths = video_paths
7273
self.num_workers = num_workers
7374
self._backend = _backend
75+
7476
if _precomputed_metadata is None:
7577
self._compute_frame_pts()
7678
else:

0 commit comments

Comments
 (0)