|
''' |
|
LVD: different initial pose |
|
diversity: same initial pose |
|
''' |
|
import os |
|
import sys |
|
sys.path.append(os.getcwd()) |
|
|
|
from glob import glob |
|
|
|
from argparse import ArgumentParser |
|
import json |
|
|
|
from evaluation.util import * |
|
from evaluation.metrics import * |
|
from tqdm import tqdm |
|
|
|
parser = ArgumentParser() |
|
parser.add_argument('--speaker', required=True, type=str) |
|
parser.add_argument('--post_fix', nargs='+', default=['base'], type=str) |
|
args = parser.parse_args() |
|
|
|
speaker = args.speaker |
|
test_audios = sorted(glob('pose_dataset/videos/test_audios/%s/*.wav'%(speaker))) |
|
|
|
LVD_list = [] |
|
diversity_list = [] |
|
|
|
for aud in tqdm(test_audios): |
|
base_name = os.path.splitext(aud)[0] |
|
gt_path = get_full_path(aud, speaker, 'val') |
|
_, gt_poses, _ = get_gts(gt_path) |
|
gt_poses = gt_poses[np.newaxis,...] |
|
|
|
for post_fix in args.post_fix: |
|
pred_path = base_name + '_'+post_fix+'.json' |
|
pred_poses = np.array(json.load(open(pred_path))) |
|
|
|
pred_poses = cvt25(pred_poses, gt_poses) |
|
|
|
|
|
gt_valid_points = hand_points(gt_poses) |
|
pred_valid_points = hand_points(pred_poses) |
|
|
|
lvd = LVD(gt_valid_points, pred_valid_points) |
|
|
|
|
|
LVD_list.append(lvd) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lvd = np.mean(LVD_list) |
|
|
|
|
|
print('LVD:', lvd) |
|
|