update error calc
This commit is contained in:
+15
-15
@@ -13,13 +13,13 @@ parser.add_argument('-g', '--gpu', type=str)
|
||||
args = vars(parser.parse_args())
|
||||
|
||||
if args['debug']:
|
||||
from configs.iccvw.pyr_64_128_cape_f_2 import config
|
||||
from configs.iccvw.pyr_64_128_cape_f_2 import config_1
|
||||
else:
|
||||
config_module = importlib.import_module(args['config'])
|
||||
config = config_module.config
|
||||
config_1 = config_module.config
|
||||
|
||||
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = config_1['gpu']
|
||||
if args['debug']:
|
||||
os.environ["CUDA_LAUNCH_BLOCKING"] = '1'
|
||||
|
||||
@@ -66,10 +66,10 @@ def calculate():
|
||||
# fig.show()
|
||||
|
||||
pred = np.load(f'{out_folder}/{frame}.npz')['arr_0']
|
||||
gt = readPC2Frame(f'{config["test_dir"]}/mesh_posed_no_orient/{frame.id}_{frame.garment}.pc16', frame.frame_nr, True)
|
||||
gt = readPC2Frame(f'{config_1["test_dir"]}/mesh_posed_no_orient/{frame.id}_{frame.garment}.pc16', frame.frame_nr, True)
|
||||
# mask = np.load(f'{config["test_dir"]}/mesh_mask/{frame.id}_{frame.garment}.npy')
|
||||
|
||||
fix_data = np.load(f'{config["test_dir"]}/mesh_fixed/{frame.id}_{frame.garment}.npz')
|
||||
fix_data = np.load(f'{config_1["test_dir"]}/mesh_fixed/{frame.id}_{frame.garment}.npz')
|
||||
mask_convert = fix_data['mas_convert']
|
||||
new_mask = fix_data['mask']
|
||||
|
||||
@@ -113,8 +113,8 @@ def calculate_cape():
|
||||
|
||||
|
||||
pred = np.load(f'{out_folder}/{frame}.npz')['arr_0']
|
||||
gt = np.load(f'{config["test_dir"]}/mesh_unposed_no_shape/{frame.id}.{frame.frame_nr}.npz')['mesh_unposed_no_shape']
|
||||
pose_shape = np.load(f'{config["test_dir"]}/pose_shape/{frame.id}.{frame.frame_nr}.npy').astype(np.float32)
|
||||
gt = np.load(f'{config_1["test_dir"]}/mesh_unposed_no_shape/{frame.id}.{frame.frame_nr}.npz')['mesh_unposed_no_shape']
|
||||
pose_shape = np.load(f'{config_1["test_dir"]}/pose_shape/{frame.id}.{frame.frame_nr}.npy').astype(np.float32)
|
||||
pose, shape = pose_shape[:72], pose_shape[72:]
|
||||
gender = int(shape[10] >= 0.5)
|
||||
shape_offsets = torch.tensordot(torch.from_numpy(shape[:10][None, :]), smpl.shapedirs[gender], dims=[[1], [2]])[0,smpl.to_keep,:].numpy()
|
||||
@@ -139,7 +139,7 @@ def calculate_cape():
|
||||
with open(f'{results_folder}/errors/{name}.csv', 'w') as f:
|
||||
for frame, error in errors:
|
||||
split = str(frame).split('_')
|
||||
if not config['is_cape']:
|
||||
if not config_1['is_cape']:
|
||||
frame_str = ','.join(split)
|
||||
else:
|
||||
id = '_'.join(split[:-2])
|
||||
@@ -148,13 +148,13 @@ def calculate_cape():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
skirt_modifier = '_skirt' if config['is_skirt'] else ''
|
||||
skirt_modifier = '_skirt' if config_1['is_skirt'] else ''
|
||||
|
||||
name = config['name']
|
||||
name = config_1['name']
|
||||
|
||||
results_folder = '/data-local/127_2/results'
|
||||
if args['iteration'] == '':
|
||||
folders = [f for f in os.listdir(results_folder) if os.path.isdir(os.path.join(results_folder, f)) and f.startswith(config['name'])]
|
||||
folders = [f for f in os.listdir(results_folder) if os.path.isdir(os.path.join(results_folder, f)) and f.startswith(config_1['name'])]
|
||||
assert len(folders) == 1
|
||||
name = folders[0]
|
||||
else:
|
||||
@@ -163,13 +163,13 @@ if __name__ == '__main__':
|
||||
|
||||
os.makedirs(f'{results_folder}/errors', exist_ok=True)
|
||||
|
||||
if config['is_cape']:
|
||||
if config_1['is_cape']:
|
||||
from data.dataset_cape import read_frames
|
||||
frames = read_frames(config['test_dir'], shuffle=False, is_cape=True)
|
||||
frames = read_frames(config_1['test_dir'], shuffle=False, is_cape=True)
|
||||
calculate_cape()
|
||||
else:
|
||||
frames_file = config['test_frames']
|
||||
with open(os.path.join(config['test_dir'], frames_file), 'r') as f:
|
||||
frames_file = config_1['test_frames']
|
||||
with open(os.path.join(config_1['test_dir'], frames_file), 'r') as f:
|
||||
frames = f.readlines()
|
||||
frames = [Frame(frames.split()[0], int(frames.split()[1]), frames.split()[2]) for frames in frames]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user