Exemplo n.º 1
0
def get_humans_from_dataset(dataset, path=None):
    videos_processed = {}
    outfile = osp.curdir() if path is None else path
    print('processing videos wait...')
    process_dataset(dataset, videos_processed, outfile)
    outfile = osp.join(outfile, 'positions.npz')
    np.savez(outfile, **videos_processed)
    print('the file is saved in ', outfile)
Exemplo n.º 2
0
def change_player_list():
    player_list_path = join(curdir(), 'data', 'player_lists')
    list_choices = [
        f for f in listdir(player_list_path)
        if isfile(join(player_list_path, f))
    ]
    for i in range(len(list_choices)):
        print('{:3}- {}'.format(i + 1,
                                list_choices[i][:-4].replace('_',
                                                             ' ').title()))
    choice = san.sanitize_int("Choose the player list you would like to use: ",
                              1, len(list_choices))
    return list_choices[choice - 1][:-4]
Exemplo n.º 3
0
def _default_output_directory(data_source, default_output_dirname):
    source_dir = path.dirname(data_source)
    default_dir = path.join(source_dir, default_output_dirname)
    if not path.isdir(default_dir):
        try:
            mkdir(default_dir)
        except OSError:
            print(
                'could not create default directory {}. Using current directory instead'
                .format(default_dir))
            default_dir = path.curdir()

    return default_dir
Exemplo n.º 4
0
def get_humans_from_dataset(dataset, path=None):
    from tf_pose.estimator import TfPoseEstimator
    from tf_pose.networks import get_graph_path
    e = TfPoseEstimator(get_graph_path('cmu'), target_size=(432, 368))
    videos_processed = {}
    outfile = osp.curdir() if path is None else path
    print('processing videos wait...')
    for video in dataset:
        video_name = video[1]['class']+'_' + \
            video[1]['consultant']+'_'+video[1]['repetition']
        try:
            videos_processed[video_name] = process_video(video[0], e)
        except InferenceError as ie:
            videos_processed[video_name] = ie.args
            error_handle(ie.args, outfile, video_name)
    outfile = osp.join(outfile, 'dataset_humans.npz')
    np.savez(outfile, **videos_processed)
    print('the file is saved in ', outfile)