Exemplo n.º 1
0
def get_test_set(opt, spatial_transform, temporal_transform, target_transform):
    assert opt.dataset in ['jester', 'egogesture', 'nv', 'sc', 'ems']
    assert opt.test_subset in ['val', 'test']

    if opt.test_subset == 'val':
        subset = 'validation'
    else:
        subset = 'testing'

    if opt.dataset == 'ems':
        test_data = EMS(opt.video_path,
                        opt.annotation_path,
                        subset,
                        opt.n_val_samples,
                        spatial_transform,
                        temporal_transform,
                        target_transform,
                        modality=opt.modality,
                        sample_duration=opt.sample_duration)
    elif opt.dataset == 'sc':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           opt.n_val_samples,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           modality=opt.modality,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           opt.n_val_samples,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           modality=opt.modality,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'egogesture':
        test_data = EgoGesture(opt.video_path,
                               opt.annotation_path,
                               subset,
                               opt.n_val_samples,
                               spatial_transform,
                               temporal_transform,
                               target_transform,
                               modality=opt.modality,
                               sample_duration=opt.sample_duration)
    elif opt.dataset == 'nv':
        test_data = NV(opt.video_path,
                       opt.annotation_path,
                       'validation',
                       spatial_transform=spatial_transform,
                       temporal_transform=temporal_transform,
                       target_transform=target_transform,
                       sample_duration=opt.sample_duration,
                       modality=opt.modality)
    return test_data
Exemplo n.º 2
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['jester', 'egogesture', 'nv']

    if opt.dataset == 'jester':
        validation_data = Jester(opt.video_path,
                                 opt.annotation_path,
                                 'validation',
                                 opt.n_val_samples,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 modality=opt.modality,
                                 sample_duration=opt.sample_duration)
    elif opt.dataset == 'egogesture':
        validation_data = EgoGesture(opt.video_path,
                                     opt.annotation_path,
                                     'validation',
                                     opt.n_val_samples,
                                     spatial_transform,
                                     temporal_transform,
                                     target_transform,
                                     modality=opt.modality,
                                     sample_duration=opt.sample_duration)
    elif opt.dataset == 'nv':
        validation_data = NV(opt.video_path,
                             opt.annotation_path,
                             'validation',
                             spatial_transform=spatial_transform,
                             temporal_transform=temporal_transform,
                             target_transform=target_transform,
                             sample_duration=opt.sample_duration,
                             modality=opt.modality)
    return validation_data
Exemplo n.º 3
0
def get_test_set(opt, spatial_transform, temporal_transform, target_transform):
    assert opt.dataset in ['kinetics', 'jester', 'ucf101', 'nvgesture']
    assert opt.test_subset in ['val', 'test']

    if opt.test_subset == 'val':
        subset = 'validation'
    else:
        subset = 'testing'

    if opt.dataset == 'jester':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'nvgesture':
        test_data = NV(opt.video_path,
                       opt.annotation_path,
                       subset,
                       0,
                       spatial_transform,
                       temporal_transform,
                       target_transform,
                       sample_duration=opt.sample_duration)
    else:
        raise ValueError("Given dataset not available")
    return test_data
Exemplo n.º 4
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['kinetics', 'jester', 'ucf101']

    if opt.dataset == 'kinetics':
        validation_data = Kinetics(opt.video_path,
                                   opt.annotation_path,
                                   'validation',
                                   opt.n_val_samples,
                                   spatial_transform,
                                   temporal_transform,
                                   target_transform,
                                   sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        validation_data = Jester(opt.video_path,
                                 opt.annotation_path,
                                 'validation',
                                 opt.n_val_samples,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        validation_data = UCF101(opt.video_path,
                                 opt.annotation_path,
                                 'validation',
                                 opt.n_val_samples,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 sample_duration=opt.sample_duration)
    return validation_data
Exemplo n.º 5
0
def get_training_set(opt, spatial_transform, temporal_transform,
                     target_transform):
    assert opt.dataset in ['kinetics', 'jester', 'ucf101']

    if opt.dataset == 'kinetics':
        training_data = Kinetics(opt.video_path,
                                 opt.annotation_path,
                                 'training',
                                 spatial_transform=spatial_transform,
                                 temporal_transform=temporal_transform,
                                 target_transform=target_transform,
                                 sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        training_data = Jester(opt.video_path,
                               opt.annotation_path,
                               'training',
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        training_data = UCF101(opt.video_path,
                               opt.annotation_path,
                               'training',
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration)
    return training_data
Exemplo n.º 6
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['KSL', 'jester', 'SLR', 'KETI']

    if opt.dataset == 'KSL':
        validation_data = KSL(opt.video_path,
                              opt.annotation_path,
                              'validation',
                              opt.n_val_samples,
                              spatial_transform,
                              temporal_transform,
                              target_transform,
                              sample_duration=opt.sample_duration)

    elif opt.dataset == 'jester':
        validation_data = Jester(opt.video_path,
                                 opt.annotation_path,
                                 'validation',
                                 opt.n_val_samples,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 sample_duration=opt.sample_duration)

    elif opt.dataset == 'KETI':
        validation_data = KETI(opt.video_path,
                               opt.annotation_path,
                               'validation',
                               opt.n_val_samples,
                               spatial_transform,
                               temporal_transform,
                               target_transform,
                               sample_duration=opt.sample_duration)

    return validation_data
Exemplo n.º 7
0
def get_test_set(opt, spatial_transform, temporal_transform, target_transform):
    assert opt.dataset in ['kinetics', 'activitynet', 'ucf101', 'hmdb51']
    assert opt.test_subset in ['val', 'test']

    if opt.test_subset == 'val':
        subset = 'val'
    elif opt.test_subset == 'test':
        subset = 'testing'
    if opt.dataset == 'kinetics':
        test_data = Kinetics(opt.video_path,
                             opt.annotation_path,
                             subset,
                             0,
                             spatial_transform,
                             temporal_transform,
                             target_transform,
                             sample_duration=opt.sample_duration)
    elif opt.dataset == 'activitynet':
        test_data = ActivityNet(opt.video_path,
                                opt.annotation_path,
                                subset,
                                True,
                                0,
                                spatial_transform,
                                temporal_transform,
                                target_transform,
                                sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        test_data = UCF101(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'hmdb51':
        test_data = HMDB51(opt.video_path,
                           opt.annotation_path,
                           subset,
                           -1,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           sample_duration=opt.sample_duration)

    return test_data
Exemplo n.º 8
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['kinetics', 'activitynet', 'ucf101', 'hmdb51', '20bn-jester']

    if opt.dataset == 'kinetics':
        validation_data = Kinetics(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform,
            temporal_transform,
            target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'activitynet':
        validation_data = ActivityNet(
            opt.video_path,
            opt.annotation_path,
            'validation',
            False,
            opt.n_val_samples,
            spatial_transform,
            temporal_transform,
            target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        validation_data = UCF101(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform,
            temporal_transform,
            target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'hmdb51':
        validation_data = HMDB51(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform,
            temporal_transform,
            target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == '20bn-jester':
        validation_data = Jester(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform,
            temporal_transform,
            target_transform,
            sample_duration=opt.sample_duration)
    return validation_data
Exemplo n.º 9
0
def get_training_set(opt, spatial_transform, temporal_transform,
                     target_transform):
    assert opt.dataset in [
        'kinetics', 'jester', 'ucf101', 'egogesture', 'nvgesture'
    ]

    if opt.train_validate:
        subset = ['training', 'validation']
    else:
        subset = 'training'

    if opt.dataset == 'kinetics':
        training_data = Kinetics(opt.video_path,
                                 opt.annotation_path,
                                 'training',
                                 spatial_transform=spatial_transform,
                                 temporal_transform=temporal_transform,
                                 target_transform=target_transform,
                                 sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        training_data = Jester(opt.video_path,
                               opt.annotation_path,
                               'training',
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        training_data = UCF101(opt.video_path,
                               opt.annotation_path,
                               'training',
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration)
    elif opt.dataset == 'egogesture':
        training_data = EgoGesture(opt.video_path,
                                   opt.annotation_path,
                                   subset,
                                   spatial_transform=spatial_transform,
                                   temporal_transform=temporal_transform,
                                   target_transform=target_transform,
                                   sample_duration=opt.sample_duration,
                                   modality=opt.modality)
    elif opt.dataset == 'nvgesture':
        training_data = NV(opt.video_path,
                           opt.annotation_path,
                           subset,
                           spatial_transform=spatial_transform,
                           temporal_transform=temporal_transform,
                           target_transform=target_transform,
                           sample_duration=opt.sample_duration,
                           modality=opt.modality)
    return training_data
Exemplo n.º 10
0
def get_training_set(opt, spatial_transform, temporal_transform,
                     target_transform):
    assert opt.dataset in ['kinetics', 'activitynet', 'ucf101', 'hmdb51', '20bn-jester']

    if opt.dataset == 'kinetics':
        training_data = Kinetics(
            opt.video_path,
            opt.annotation_path,
            'training',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == 'activitynet':
        training_data = ActivityNet(
            opt.video_path,
            opt.annotation_path,
            'training',
            False,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == 'ucf101':
        training_data = UCF101(
            opt.video_path,
            opt.annotation_path,
            'training',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == 'hmdb51':
        training_data = HMDB51(
            opt.video_path,
            opt.annotation_path,
            'training',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == '20bn-jester':
        training_data = Jester(
            opt.video_path,
            opt.annotation_path,
            'training',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            target_transform=target_transform)

    return training_data
Exemplo n.º 11
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['kinetics', 'jester', 'ucf101', 'nvgesture']

    if opt.dataset == 'jester':
        validation_data = Jester(opt.video_path,
                                 opt.annotation_path,
                                 'validation',
                                 opt.n_val_samples,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 sample_duration=opt.sample_duration)

    else:
        raise ValueError("Given dataset not available")
    return validation_data
Exemplo n.º 12
0
def get_test_set(opt, spatial_transform, temporal_transform, target_transform):
    assert opt.dataset in ['kinetics', 'jester', 'ucf101', 'dad']
    assert opt.test_subset in ['val', 'test']

    if opt.test_subset == 'val':
        subset = 'validation'
    elif opt.test_subset == 'test':
        subset = 'testing'
    if opt.dataset == 'kinetics':
        test_data = Kinetics(opt.video_path,
                             opt.annotation_path,
                             subset,
                             0,
                             spatial_transform,
                             temporal_transform,
                             target_transform,
                             sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'dad':
        test_data = Dad(opt.video_path,
                        opt.annotation_path,
                        subset,
                        0,
                        spatial_transform,
                        temporal_transform,
                        target_transform,
                        sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        test_data = UCF101(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           sample_duration=opt.sample_duration)
    return test_data
Exemplo n.º 13
0
def get_training_set(opt, spatial_transform, temporal_transform,
                     target_transform):
    assert opt.dataset in ['KSL', 'jester', 'SLR', 'KETI']

    if opt.dataset == 'KSL':
        training_data = KSL(opt.video_path,
                            opt.annotation_path,
                            'training',
                            spatial_transform=spatial_transform,
                            temporal_transform=temporal_transform,
                            target_transform=target_transform,
                            sample_duration=opt.sample_duration)

    elif opt.dataset == 'jester':
        training_data = Jester(opt.video_path,
                               opt.annotation_path,
                               'training',
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration)

    elif opt.dataset == 'SLR':
        training_data = SLR(opt.video_path,
                            opt.annotation_path,
                            'training',
                            spatial_transform=spatial_transform,
                            temporal_transform=temporal_transform,
                            target_transform=target_transform,
                            sample_duration=opt.sample_duration)
    elif opt.dataset == 'KETI':
        training_data = KETI(opt.video_path,
                             opt.annotation_path,
                             'training',
                             spatial_transform=spatial_transform,
                             temporal_transform=temporal_transform,
                             target_transform=target_transform,
                             sample_duration=opt.sample_duration)

    return training_data
Exemplo n.º 14
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['jester', 'SHGD']

    if opt.dataset == 'jester':
        validation_data = Jester(opt.video_path,
                                 opt.annotation_path,
                                 opt.val_list,
                                 opt.modality,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 sample_duration=opt.sample_duration)
    else:
        validation_data = SHGD(opt.video_path,
                               opt.annotation_path,
                               opt.val_list,
                               opt.modality,
                               spatial_transform,
                               temporal_transform,
                               target_transform,
                               sample_duration=opt.sample_duration)
    return validation_data
Exemplo n.º 15
0
def get_training_set(opt, spatial_transform, temporal_transform,
                     target_transform):
    assert opt.dataset in ['kinetics', 'jester', 'ucf101', 'nvgesture']

    if opt.dataset == 'jester':
        training_data = Jester(opt.video_path,
                               opt.annotation_path,
                               'training',
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration)
    elif opt.dataset == 'nvgesture':
        training_data = NV(opt.video_path,
                           opt.annotation_path,
                           'training',
                           n_samples_for_each_video=1,
                           spatial_transform=spatial_transform,
                           temporal_transform=temporal_transform,
                           target_transform=target_transform,
                           sample_duration=opt.sample_duration)
    else:
        raise ValueError("Given dataset not available")
    return training_data
Exemplo n.º 16
0
def get_training_set(opt, spatial_transform, temporal_transform,
                     target_transform):
    assert opt.dataset in ['jester', 'nv', 'ipn']

    if opt.train_validate:
        subset = ['training', 'validation']
    else:
        subset = 'training'
    if opt.dataset == 'jester':
        training_data = Jester(opt.video_path,
                               opt.annotation_path,
                               subset,
                               spatial_transform=spatial_transform,
                               temporal_transform=temporal_transform,
                               target_transform=target_transform,
                               sample_duration=opt.sample_duration,
                               modality=opt.modality)
    elif opt.dataset == 'egogesture':
        training_data = EgoGesture(opt.video_path,
                                   opt.annotation_path,
                                   subset,
                                   spatial_transform=spatial_transform,
                                   temporal_transform=temporal_transform,
                                   target_transform=target_transform,
                                   sample_duration=opt.sample_duration,
                                   modality=opt.modality)
    elif opt.dataset == 'nv':
        training_data = NV(opt.video_path,
                           opt.annotation_path,
                           subset,
                           spatial_transform=spatial_transform,
                           temporal_transform=temporal_transform,
                           target_transform=target_transform,
                           sample_duration=opt.sample_duration,
                           modality=opt.modality)
    elif opt.dataset == 'ipn':
        training_data = IPN(opt.video_path,
                            opt.annotation_path,
                            subset,
                            spatial_transform=spatial_transform,
                            temporal_transform=temporal_transform,
                            target_transform=target_transform,
                            sample_duration=opt.sample_duration,
                            modality=opt.modality)
    elif opt.dataset == 'denso':
        training_data = Denso(opt.video_path,
                              opt.annotation_path,
                              subset,
                              spatial_transform=spatial_transform,
                              temporal_transform=temporal_transform,
                              target_transform=target_transform,
                              sample_duration=opt.sample_duration,
                              modality=opt.modality,
                              no_subject_crop=opt.no_scrop)
    elif opt.dataset == 'AHG':
        training_data = AHG(opt.video_path,
                            opt.annotation_path,
                            subset,
                            spatial_transform=spatial_transform,
                            temporal_transform=temporal_transform,
                            target_transform=target_transform,
                            sample_duration=opt.sample_duration,
                            modality=opt.modality,
                            no_subject_crop=opt.no_scrop)
    return training_data
Exemplo n.º 17
0
def get_validation_set(opt, spatial_transform, temporal_transform,
                       target_transform):
    assert opt.dataset in ['jester', 'nv', 'ipn']

    if opt.dataset == 'jester':
        validation_data = Jester(opt.video_path,
                                 opt.annotation_path,
                                 'validation',
                                 opt.n_val_samples,
                                 spatial_transform,
                                 temporal_transform,
                                 target_transform,
                                 modality=opt.modality,
                                 sample_duration=opt.sample_duration)
    elif opt.dataset == 'egogesture':
        validation_data = EgoGesture(opt.video_path,
                                     opt.annotation_path,
                                     'validation',
                                     opt.n_val_samples,
                                     spatial_transform,
                                     temporal_transform,
                                     target_transform,
                                     modality=opt.modality,
                                     sample_duration=opt.sample_duration)
    elif opt.dataset == 'nv':
        validation_data = NV(opt.video_path,
                             opt.annotation_path,
                             'validation',
                             spatial_transform=spatial_transform,
                             temporal_transform=temporal_transform,
                             target_transform=target_transform,
                             sample_duration=opt.sample_duration,
                             modality=opt.modality)
    elif opt.dataset == 'ipn':
        validation_data = IPN(opt.video_path,
                              opt.annotation_path,
                              'validation',
                              spatial_transform=spatial_transform,
                              temporal_transform=temporal_transform,
                              target_transform=target_transform,
                              sample_duration=opt.sample_duration,
                              modality=opt.modality)
    elif opt.dataset == 'denso':
        validation_data = Denso(opt.video_path,
                                opt.annotation_path,
                                'validation',
                                true_valid=opt.true_valid,
                                spatial_transform=spatial_transform,
                                temporal_transform=temporal_transform,
                                target_transform=target_transform,
                                sample_duration=opt.sample_duration,
                                modality=opt.modality,
                                no_subject_crop=opt.no_scrop)
    elif opt.dataset == 'AHG':
        validation_data = AHG(opt.video_path,
                              opt.annotation_path,
                              'validation',
                              spatial_transform=spatial_transform,
                              temporal_transform=temporal_transform,
                              target_transform=target_transform,
                              sample_duration=opt.sample_duration,
                              modality=opt.modality,
                              no_subject_crop=opt.no_scrop)
    return validation_data
Exemplo n.º 18
0
def get_test_set(opt, spatial_transform, temporal_transform, target_transform):
    assert opt.dataset in ['jester', 'nv', 'ipn']
    assert opt.test_subset in ['val', 'test']

    if opt.test_subset == 'val':
        subset = 'validation'
    else:
        subset = 'testing'

    if opt.dataset == 'jester':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           opt.n_val_samples,
                           spatial_transform,
                           temporal_transform,
                           target_transform,
                           modality=opt.modality,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'egogesture':
        test_data = EgoGesture(opt.video_path,
                               opt.annotation_path,
                               subset,
                               opt.n_val_samples,
                               spatial_transform,
                               temporal_transform,
                               target_transform,
                               modality=opt.modality,
                               sample_duration=opt.sample_duration)
    elif opt.dataset == 'nv':
        test_data = NV(opt.video_path,
                       opt.annotation_path,
                       'validation',
                       spatial_transform=spatial_transform,
                       temporal_transform=temporal_transform,
                       target_transform=target_transform,
                       sample_duration=opt.sample_duration,
                       modality=opt.modality)
    elif opt.dataset == 'ipn':
        test_data = IPN(opt.video_path,
                        opt.annotation_path,
                        'validation',
                        spatial_transform=spatial_transform,
                        temporal_transform=temporal_transform,
                        target_transform=target_transform,
                        sample_duration=opt.sample_duration,
                        modality=opt.modality,
                        use_preprocessing=opt.use_preprocessing)
    elif opt.dataset == 'denso':
        test_data = Denso(opt.video_path,
                          opt.annotation_path,
                          subset,
                          true_valid=opt.true_valid,
                          spatial_transform=spatial_transform,
                          temporal_transform=temporal_transform,
                          target_transform=target_transform,
                          sample_duration=opt.sample_duration,
                          modality=opt.modality,
                          no_subject_crop=opt.no_scrop)
    elif opt.dataset == 'AHG':
        test_data = AHG(opt.video_path,
                        opt.annotation_path,
                        subset,
                        spatial_transform=spatial_transform,
                        temporal_transform=temporal_transform,
                        target_transform=target_transform,
                        sample_duration=opt.sample_duration,
                        modality=opt.modality,
                        no_subject_crop=opt.no_scrop)
    return test_data
Exemplo n.º 19
0
def get_test_set(opt,
                 spatial_transform,
                 temporal_transform,
                 target_transform,
                 spatio_temporal_transform=None):
    assert opt.dataset in [
        'kinetics',
        'activitynet',
        'ucf101',
        'hmdb51',
        'kth',
        'kth2',
        'sth',
        'sth_init',
        'gtea',
        'jester',
        'ucf50',
        'ucf50_color',
        'real',
    ]
    assert opt.test_subset in ['val', 'test']

    if opt.test_subset == 'val':
        subset = 'validation'
    elif opt.test_subset == 'test':
        subset = 'testing'
    if opt.dataset == 'kinetics':
        test_data = Kinetics(opt.video_path,
                             opt.annotation_path,
                             subset,
                             0,
                             spatial_transform,
                             temporal_transform,
                             target_transform,
                             sample_duration=opt.sample_duration)
    elif opt.dataset == 'activitynet':
        test_data = ActivityNet(opt.video_path,
                                opt.annotation_path,
                                subset,
                                True,
                                0,
                                spatial_transform,
                                temporal_transform,
                                target_transform,
                                sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        test_data = UCF101(opt.video_path,
                           opt.annotation_path,
                           subset,
                           10,
                           spatial_transform=spatial_transform,
                           temporal_transform=temporal_transform,
                           spatio_temporal_transform=spatio_temporal_transform,
                           target_transform=target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'hmdb51':
        test_data = HMDB51(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform=spatial_transform,
                           temporal_transform=temporal_transform,
                           spatio_temporal_transform=spatio_temporal_transform,
                           target_transform=target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'kth':
        test_data = KTH(opt.video_path,
                        opt.annotation_path,
                        subset,
                        0,
                        spatial_transform=spatial_transform,
                        temporal_transform=temporal_transform,
                        spatio_temporal_transform=spatio_temporal_transform,
                        target_transform=target_transform,
                        sample_duration=opt.sample_duration)
    elif opt.dataset == 'kth2':
        test_data = KTH2(opt.video_path,
                         opt.annotation_path,
                         subset,
                         0,
                         spatial_transform=spatial_transform,
                         temporal_transform=temporal_transform,
                         spatio_temporal_transform=spatio_temporal_transform,
                         target_transform=target_transform,
                         sample_duration=opt.sample_duration)
    elif opt.dataset == 'sth':
        test_data = Something2(
            opt.video_path,
            opt.annotation_path,
            subset,
            0,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'jester':
        test_data = Jester(opt.video_path,
                           opt.annotation_path,
                           subset,
                           0,
                           spatial_transform=spatial_transform,
                           temporal_transform=temporal_transform,
                           spatio_temporal_transform=spatio_temporal_transform,
                           target_transform=target_transform,
                           sample_duration=opt.sample_duration)
    elif opt.dataset == 'sth_init':
        test_data = Something2Init(
            opt.video_path,
            opt.annotation_path,
            subset,
            0,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'gtea':
        test_data = GTEA(opt.video_path,
                         opt.annotation_path,
                         subset,
                         0,
                         spatial_transform=spatial_transform,
                         temporal_transform=temporal_transform,
                         spatio_temporal_transform=spatio_temporal_transform,
                         target_transform=target_transform,
                         sample_duration=opt.sample_duration,
                         test_split=opt.test_split)
    elif opt.dataset == 'ucf50':
        test_data = UCF50(opt.video_path,
                          opt.annotation_path,
                          subset,
                          0,
                          spatial_transform=spatial_transform,
                          temporal_transform=temporal_transform,
                          spatio_temporal_transform=spatio_temporal_transform,
                          target_transform=target_transform,
                          sample_duration=opt.sample_duration,
                          test_split=opt.test_split)
    elif opt.dataset == 'ucf50_color':
        test_data = UCF50(opt.video_path,
                          opt.annotation_path,
                          subset,
                          0,
                          spatial_transform=spatial_transform,
                          temporal_transform=temporal_transform,
                          spatio_temporal_transform=spatio_temporal_transform,
                          target_transform=target_transform,
                          sample_duration=opt.sample_duration,
                          test_split=opt.test_split)
    elif opt.dataset == 'real':
        test_data = REAL(opt.video_path,
                         opt.annotation_path,
                         subset,
                         0,
                         spatial_transform=spatial_transform,
                         temporal_transform=temporal_transform,
                         spatio_temporal_transform=spatio_temporal_transform,
                         target_transform=target_transform,
                         sample_duration=opt.sample_duration)

    return test_data
Exemplo n.º 20
0
def get_validation_set(opt,
                       spatial_transform,
                       temporal_transform,
                       target_transform,
                       spatio_temporal_transform=None):
    assert opt.dataset in [
        'kinetics',
        'activitynet',
        'ucf101',
        'hmdb51',
        'kth',
        'kth2',
        'sth',
        'sth_init',
        'gtea',
        'jester',
        'ucf50',
        'ucf50_color',
    ]

    if opt.dataset == 'kinetics':
        validation_data = Kinetics(opt.video_path,
                                   opt.annotation_path,
                                   'validation',
                                   opt.n_val_samples,
                                   spatial_transform,
                                   temporal_transform,
                                   target_transform,
                                   sample_duration=opt.sample_duration)
    elif opt.dataset == 'activitynet':
        validation_data = ActivityNet(opt.video_path,
                                      opt.annotation_path,
                                      'validation',
                                      False,
                                      opt.n_val_samples,
                                      spatial_transform,
                                      temporal_transform,
                                      target_transform,
                                      sample_duration=opt.sample_duration)
    elif opt.dataset == 'ucf101':
        validation_data = UCF101(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'hmdb51':
        validation_data = HMDB51(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'kth':
        validation_data = KTH(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'kth2':
        validation_data = KTH2(
            opt.video_path,
            opt.annotation_path,
            'validation',
            opt.n_val_samples,
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            sample_duration=opt.sample_duration)
    elif opt.dataset == 'sth':
        validation_data = Something2(
            opt.video_path,
            opt.annotation_path,
            'validation',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == 'jester':
        validation_data = Jester(
            opt.video_path,
            opt.annotation_path,
            'validation',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == 'sth_init':
        validation_data = Something2Init(
            opt.video_path,
            opt.annotation_path,
            'validation',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform)
    elif opt.dataset == 'gtea':
        validation_data = GTEA(
            opt.video_path,
            opt.annotation_path,
            'validation',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            test_split=opt.test_split)
    elif opt.dataset == 'ucf50':
        validation_data = UCF50(
            opt.video_path,
            opt.annotation_path,
            'validation',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            test_split=opt.test_split)
    elif opt.dataset == 'ucf50_color':
        validation_data = UCF50(
            opt.video_path,
            opt.annotation_path,
            'validation',
            spatial_transform=spatial_transform,
            temporal_transform=temporal_transform,
            spatio_temporal_transform=spatio_temporal_transform,
            target_transform=target_transform,
            test_split=opt.test_split)
    return validation_data