def _loader(split): dataset = factory.dataset_from_config(config, False, split, debug) batch_sampler = factory.video_sampler_from_config( config, dataset.dir_tree, downstream=False, sequential=debug) return torch.utils.data.DataLoader( dataset, collate_fn=dataset.collate_fn, batch_sampler=batch_sampler, num_workers=4 if torch.cuda.is_available() and not debug else 0, pin_memory=torch.cuda.is_available() and not debug, )
def _loader(split): datasets = factory.dataset_from_config(config, True, split, debug) loaders = {} for action_class, dataset in datasets.items(): batch_sampler = factory.video_sampler_from_config( config, dataset.dir_tree, downstream=True, sequential=debug) loaders[action_class] = torch.utils.data.DataLoader( dataset, collate_fn=dataset.collate_fn, batch_sampler=batch_sampler, num_workers=4 if torch.cuda.is_available() and not debug else 0, pin_memory=torch.cuda.is_available() and not debug, ) return loaders