diff --git a/torchvision/datasets/video_utils.py b/torchvision/datasets/video_utils.py index b638c569a87..b5c19d07088 100644 --- a/torchvision/datasets/video_utils.py +++ b/torchvision/datasets/video_utils.py @@ -64,13 +64,15 @@ class VideoClips(object): frame_rate (int, optional): if specified, it will resample the video so that it has `frame_rate`, and then the clips will be defined on the resampled video + num_workers (int): how many subprocesses to use for data loading. + 0 means that the data will be loaded in the main process. (default: 0) """ def __init__(self, video_paths, clip_length_in_frames=16, frames_between_clips=1, - frame_rate=None, _precomputed_metadata=None, num_workers=1, - _backend="pyav"): + frame_rate=None, _precomputed_metadata=None, num_workers=0, _backend="pyav"): self.video_paths = video_paths self.num_workers = num_workers self._backend = _backend + if _precomputed_metadata is None: self._compute_frame_pts() else: