コード例 #1
0
                       batch_size=mpii.get_length(VALID_MODE),
                       shuffle=False)
logger.debug('Pre-loading MPII validation data...')
[x_val], [p_val, afmat_val, head_val] = mpii_val[0]
"""Define a loader for PennAction test samples. """
penn_te = BatchLoader(penn_seq, ['frame'], ['pennaction'],
                      TEST_MODE,
                      batch_size=1,
                      shuffle=False)
"""Evaluate on 2D action recognition (PennAction)."""
s = eval_singleclip_generator(models[1], penn_te, logdir=logdir)
logger.debug('Best score on PennAction (single-clip): ')
logger.debug(str(s))

s = eval_multiclip_dataset(models[1],
                           penn_seq,
                           subsampling=pennaction_dataconf.fixed_subsampling,
                           logdir=logdir)
logger.debug('Best score on PennAction (multi-clip): ')
logger.debug(str(s))

# MPII EVALUATION
pose_pred = np.zeros_like(p_val)
mode = VALID_MODE
"""Evaluate on 2D pose estimation (MPII)."""
s, y_pred = eval_singleperson_pckh(models[0], x_val, p_val[:, :, 0:2],
                                   afmat_val, head_val)
logger.debug('Best score on MPII: ')
logger.debug(str(s))

pose_pred = get_pred_data(mpii, pose_pred=pose_pred, pred=y_pred, mode=mode)
コード例 #2
0
                                 num_joints,
                                 num_blocks,
                                 pose_dim=2,
                                 pose_net_version='v1',
                                 full_trainable=False)
"""Load pre-trained model."""
weights_path = get_file(weights_file,
                        TF_WEIGHTS_PATH,
                        md5_hash=md5_hash,
                        cache_subdir='models')
model.load_weights(weights_path)
"""Load PennAction dataset."""
penn_seq = PennAction('datasets/PennAction',
                      pennaction_dataconf,
                      poselayout=pa16j2d,
                      topology='sequences',
                      use_gt_bbox=use_bbox,
                      clip_size=num_frames)

penn_te = BatchLoader(penn_seq, ['frame'], ['pennaction'],
                      TEST_MODE,
                      batch_size=1,
                      shuffle=False)

printcn(OKGREEN, 'Evaluation on PennAction multi-clip using predicted bboxes')
eval_multiclip_dataset(
    model,
    penn_seq,
    bboxes_file='datasets/PennAction/penn_pred_bboxes_16f.json',
    logdir=logdir)
コード例 #3
0
                                 num_actions,
                                 input_shape,
                                 num_frames,
                                 num_joints,
                                 num_blocks,
                                 pose_dim=2,
                                 pose_net_version='v1',
                                 full_trainable=False)
"""Load pre-trained model."""
weights_path = get_file(weights_file,
                        TF_WEIGHTS_PATH,
                        md5_hash=md5_hash,
                        cache_subdir='models')
model.load_weights(weights_path)
"""Load PennAction dataset."""
penn_seq = PennAction('E:\Bachelorarbeit-SS20\datasets\PennAction',
                      pennaction_dataconf,
                      poselayout=pa16j2d,
                      topology='sequences',
                      use_gt_bbox=use_bbox,
                      clip_size=num_frames,
                      pred_bboxes_file='penn_pred_bboxes_16f.json')

penn_te = BatchLoader(penn_seq, ['frame'], ['pennaction'],
                      TEST_MODE,
                      batch_size=1,
                      shuffle=False)

printcn(OKGREEN, 'Evaluation on PennAction multi-clip using predicted bboxes')
eval_multiclip_dataset(model, penn_seq, subsampling=2, logdir=logdir)