This commit is contained in:
2023-03-06 09:55:48 +00:00
parent dfdf8d408e
commit 0b518e7f0e
46 changed files with 3392 additions and 160 deletions
+23 -12
View File
@@ -23,7 +23,7 @@ import numpy as np
import trimesh as tm
import plotly.express as ex
import plotly.graph_objects as go
from custom_utils.custom_utils import _maskFaces
from custom_utils.custom_utils import _maskFaces, save_stl
from custom_utils.smpl import SMPL
from plotly.subplots import make_subplots
from scipy.spatial.transform import Rotation as R
@@ -215,8 +215,8 @@ if __name__ == '__main__':
errors_cape_m = get_cape_errors('CAPE/results/CAPE-affineconv_nz18_pose24_clotype8_male/errors.npy', frames_m)
errors_cape_m = dict(reversed(sorted(errors_cape_m.items(), key=lambda item: item[1])))
errors_f = get_errors('temp/error_abl_2_pyr_64_128_256_512_cape_f.txt')
errors_m = get_errors('temp/error_abl_2_pyr_64_128_256_512_cape_m.txt')
errors_f = get_errors('temp/archive/error_abl_2_pyr_64_128_256_512_cape_f.txt')
errors_m = get_errors('temp/archive/error_abl_2_pyr_64_128_256_512_cape_m.txt')
folder_pyr_f = '/home/workspace/data/results/cape/abl_2_pyr_64_128_256_512_cape_f'
folder_pyr_m = '/home/workspace/data/results/cape/abl_2_pyr_64_128_256_512_cape_m'
@@ -238,9 +238,10 @@ if __name__ == '__main__':
_, faces = _maskFaces(np.zeros((3638, 3)), np.load('custom_utils/smpl_faces_orig.npy'), cape_mask)
faces = faces.astype(np.int32)
colors = np.ones((3627, 3), np.int8) * 230
gender = 'male'
gender = 'female'
if gender == 'male':
folder_cape = folder_m
@@ -262,11 +263,18 @@ if __name__ == '__main__':
all_errors_1 = []
all_errors_2 = []
# for key in tqdm.tqdm(errors_cape.keys()):
count = 0
while True:
key = random.choice(list(errors_cape.keys()))
for key in tqdm.tqdm(errors_cape.keys()):
# count = 0
# while True:
if os.path.exists(f'temp/cape_stl/{key}_gt.stl'):
continue
# key = random.choice(list(errors_cape.keys()))
cape = read_obj(os.path.join(folder_cape, '{:0>4d}.obj'.format(frames_to_i[key])))[clothing_verts_idx, :] - J0[np.newaxis, :]
split = key.split('_')
file = '_'.join(split[:-1]) + '.' + split[-1] + '.npy'
pose_shape_path = os.path.join(pose_folder, file)
if not os.path.exists(pose_shape_path):
continue
cape = add_global_orientation(cape, key, pose_folder, inverse=True)
if not os.path.exists(os.path.join(folder, key + '_posed.npy')):
continue
@@ -284,10 +292,13 @@ if __name__ == '__main__':
# print(np.mean(all_errors_1))
# print(np.mean(all_errors_2))
fig = plot_fixed_all(gt, cape, ours, errors_cape[key], errors[key], faces, colors)
fig.write_image('temp/cape/' + key + '.png')
# fig = plot_fixed_all(gt, cape, ours, errors_cape[key], errors[key], faces, colors)
# fig.write_image('temp/cape_2/' + key + '.png')
save_stl(f'temp/cape_stl/{key}_gt.stl', gt, faces)
save_stl(f'temp/cape_stl/{key}_cape.stl', cape, faces)
save_stl(f'temp/cape_stl/{key}_ours.stl', ours, faces)
print(count)
count += 1
# print(count)
# count += 1
print()