def load_dataset(args):
    path = args.dataset
    keep_groups = args.keep_groups

    print('Loading data set "%s" ...' % path)
    print('  features: %s' % args.features)
    print('  type: %s' % args.motion_type)
    X, y, target_names, groups, _ = load_manifest(
        path,
        args.motion_type,
        feature_names=args.features,
        use_cache=not args.disable_cache)
    assert len(X) == len(y)
    if not keep_groups:
        groups = None

    if not args.disable_shuffle:
        if args.permutation is not None:
            permutation = np.load(open(args.permutation))
            X, y = [X[i] for i in permutation], y[permutation, :]
        else:
            X, y, groups, permutation = shuffle(X, y, groups=groups)
        print('Shuffling all data with permutation (keep_groups=%s):\n%s' %
              (keep_groups, permutation))
        if args.output_dir is not None:
            permutation_path = os.path.join(args.output_dir, 'permutation.npy')
            np.save(permutation_path, permutation)
            print('Saved permutation to file "%s"' % permutation_path)
    return Dataset(X, y, target_names, groups)
示例#2
0
def load_dataset(args):
    path = args.dataset
    keep_groups = args.keep_groups

    print('Loading data set "%s" ...' % path)
    print('  features: %s' % args.features)
    print('  type: %s' % args.motion_type)
    X, y, target_names, groups, _ = load_manifest(path, args.motion_type, feature_names=args.features, use_cache=not args.disable_cache)
    assert len(X) == len(y)
    if not keep_groups:
        groups = None

    if not args.disable_shuffle:
        if args.permutation is not None:
            permutation = np.load(open(args.permutation))
            X, y = [X[i] for i in permutation], y[permutation, :]
        else:
            X, y, groups, permutation = shuffle(X, y, groups=groups)
        print('Shuffling all data with permutation (keep_groups=%s):\n%s' % (keep_groups, permutation))
        if args.output_dir is not None:
            permutation_path = os.path.join(args.output_dir, 'permutation.npy')
            np.save(permutation_path, permutation)
            print('Saved permutation to file "%s"' % permutation_path)
    return Dataset(X, y, target_names, groups)
def load_dataset(path, motion_type, feature_names, args):
    print('Loading data set "%s" ...' % path)
    X, y, target_names, groups, lengths = load_manifest(path, motion_type, feature_names=feature_names,
                                                        use_cache=not args.disable_cache, normalize=args.normalize)
    assert len(X) == len(y)
    return Dataset(X, y, target_names, groups, lengths)