def get(cls, args): train_file = args.train_file val_file = args.val_file train_dataset = cls(args, args.data, 'train', train_file, args.cache, transform=transforms.Compose([ videotransforms.RandomCrop(args.input_size), videotransforms.RandomHorizontalFlip() ]), input_size=args.input_size) val_dataset = cls(args, args.valdata, 'val', val_file, args.cache, transform=transforms.Compose( [videotransforms.CenterCrop(args.input_size)]), input_size=args.input_size) valvideo_dataset = cls(args, args.valdata, 'val_video', val_file, args.cache, transform=transforms.Compose([ videotransforms.CenterCrop(args.input_size) ]), input_size=args.input_size) return train_dataset, val_dataset, valvideo_dataset
def get(cls, args, splits=('train', 'val', 'val_video')): train_file = args.train_file val_file = args.val_file if 'train' in splits: train_dataset = cls( args, args.data, 'train', train_file, args.cache, transform=transforms.Compose([ videotransforms.RandomCrop(args.input_size), videotransforms.RandomHorizontalFlip() ]), input_size=args.input_size) else: train_dataset = None if 'val' in splits: val_dataset = cls( args, args.data, 'val', val_file, args.cache, transform=transforms.Compose([ videotransforms.CenterCrop(args.input_size) ]), input_size=args.input_size) else: val_dataset = None if 'val_video' in splits: valvideo_dataset = cls( args, args.data, 'val_video', val_file, args.cache, transform=transforms.Compose([ videotransforms.CenterCrop(args.input_size) ]), input_size=args.input_size) else: valvideo_dataset = None return train_dataset, val_dataset, valvideo_dataset
def get(cls, args): if ';' in args.train_file: args = copy.deepcopy(args) vars(args).update({ 'train_file': args.train_file.split(';')[0], 'val_file': args.val_file.split(';')[0], 'data': args.data.split(';')[0] }) val_dataset = cls(args, args.data, 'val', args.val_file, args.cache, transform=transforms.Compose( [videotransforms.CenterCrop(args.input_size)]), input_size=args.input_size) val_loader = torch.utils.data.DataLoader( val_dataset, batch_size=args.video_batch_size, shuffle=False, num_workers=args.workers, pin_memory=True) return val_loader