project/data.py
def train_data(bs):
    """Get data loader for trainning & validating, bs means batch_size."""

    train_ds = VideoSlowDataset(
        train_dataset_rootdir, VIDEO_SEQUENCE_LENGTH, get_transform(train=True))
    print(train_ds)

    # Split train_ds in train and valid set
    valid_len = int(0.2 * len(train_ds))
    indices = [i for i in range(len(train_ds) - valid_len, len(train_ds))]

    valid_ds = data.Subset(train_ds, indices)
    indices = [i for i in range(len(train_ds) - valid_len)]
    train_ds = data.Subset(train_ds, indices)

    # Define training and validation data loaders
    train_dl = data.DataLoader(
        train_ds, batch_size=bs, shuffle=True, num_workers=4)
    valid_dl = data.DataLoader(
        valid_ds, batch_size=bs, shuffle=False, num_workers=4)

    return train_dl, valid_dl
Get data loader for trainning & validating, bs means batch_size.
Get data loader for trainning & validating, bs means batch_size.
Get data loader for trainning & validating bs means batch_size .
def train_data(bs):
    train_ds = VideoSlowDataset(
        train_dataset_rootdir, VIDEO_SEQUENCE_LENGTH, get_transform(train=True))
    print(train_ds)
    valid_len = int(0.2 * len(train_ds))
    indices = [i for i in range(len(train_ds) - valid_len, len(train_ds))]
    valid_ds = data.Subset(train_ds, indices)
    indices = [i for i in range(len(train_ds) - valid_len)]
    train_ds = data.Subset(train_ds, indices)
    train_dl = data.DataLoader(
        train_ds, batch_size=bs, shuffle=True, num_workers=4)
    valid_dl = data.DataLoader(
        valid_ds, batch_size=bs, shuffle=False, num_workers=4)
    return train_dl, valid_dl
def train_data ( bs ) : train_ds = VideoSlowDataset ( train_dataset_rootdir , VIDEO_SEQUENCE_LENGTH , get_transform ( train = True ) ) print ( train_ds ) valid_len = int ( 0.2 * len ( train_ds ) ) indices = [ i for i in range ( len ( train_ds ) - valid_len , len ( train_ds ) ) ] valid_ds = data . Subset ( train_ds , indices ) indices = [ i for i in range ( len ( train_ds ) - valid_len ) ] train_ds = data . Subset ( train_ds , indices ) train_dl = data . DataLoader ( train_ds , batch_size = bs , shuffle = True , num_workers = 4 ) valid_dl = data . DataLoader ( valid_ds , batch_size = bs , shuffle = False , num_workers = 4 ) return train_dl , valid_dl
Get data loader for trainning & validating, bs means batch_size.
Get data loader for trainning & validating bs means batch_size .
"""Get data loader for trainning & validating, bs means batch_size.""" # Split train_ds in train and valid set # Define training and validation data loaders
bs