Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions torchvision/datasets/video_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ class VideoClips(object):
on the resampled video
"""
def __init__(self, video_paths, clip_length_in_frames=16, frames_between_clips=1,
frame_rate=None, _precomputed_metadata=None):
frame_rate=None, _precomputed_metadata=None, num_workers=1):
self.video_paths = video_paths
self.num_workers = num_workers
if _precomputed_metadata is None:
self._compute_frame_pts()
else:
Expand All @@ -77,7 +78,7 @@ def __getitem__(self, idx):
dl = torch.utils.data.DataLoader(
DS(self.video_paths),
batch_size=16,
num_workers=torch.get_num_threads(),
num_workers=self.num_workers,
collate_fn=lambda x: x)

with tqdm(total=len(dl)) as pbar:
Expand Down