merge
This commit is contained in:
commit
a3529ab815
14 files changed
+181
-66
No files matched your search
+75
-1
@@ -34,4 +34,78 @@ flame_mouth_idx = [
|
||||
3796, 3797, 3798, 3799, 3800, 3801, 3802, 3803, 3804, 3805,
|
||||
3806, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921, 3922,
|
||||
3923, 3924, 3925, 3926, 3927, 3928
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
flame_eye_idx = [
|
||||
337, 338, 807, 808, 809, 814, 815, 816, 821, 822,
|
||||
823, 824, 825, 826, 827, 828, 829, 841, 842, 848,
|
||||
864, 865, 877, 878, 879, 880, 881, 882, 883, 884,
|
||||
885, 896, 897, 898, 899, 902, 903, 904, 905, 906,
|
||||
907, 908, 909, 918, 919, 922, 923, 924, 926, 927,
|
||||
928, 929, 939, 943, 944, 945, 946, 947, 948, 949,
|
||||
950, 951, 952, 953, 954, 955, 958, 959, 960, 961,
|
||||
962, 963, 964, 965, 966, 967, 968, 969, 970, 971,
|
||||
972, 977, 978, 979, 980, 985, 986, 991, 992, 993,
|
||||
994, 995, 999, 1000, 1003, 1006, 1008, 1011, 1012, 1013,
|
||||
1014, 1015, 1019, 1020, 1021, 1022, 1023, 1033, 1034, 1043,
|
||||
1044, 1045, 1046, 1059, 1060, 1061, 1062, 1093, 1096, 1101,
|
||||
1108, 1113, 1114, 1115, 1125, 1126, 1132, 1134, 1135, 1142,
|
||||
1143, 1144, 1146, 1147, 1150, 1151, 1152, 1153, 1154, 1155,
|
||||
1161, 1162, 1163, 1164, 1168, 1169, 1170, 1175, 1176, 1181,
|
||||
1182, 1183, 1184, 1189, 1190, 1193, 1194, 1195, 1200, 1201,
|
||||
1202, 1216, 1217, 1218, 1224, 1225, 1226, 1227, 1230, 1232,
|
||||
1233, 1243, 1244, 1283, 1289, 1292, 1293, 1294, 1320, 1329,
|
||||
1331, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344,
|
||||
1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354,
|
||||
1355, 1356, 1357, 1358, 1361, 1362, 1363, 1364, 1365, 1366,
|
||||
1367, 1368, 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376,
|
||||
1377, 1378, 1383, 1384, 1385, 1387, 1388, 1389, 1390, 1391,
|
||||
1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405,
|
||||
1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419,
|
||||
1420, 1421, 1422, 1425, 1426, 1427, 1428, 1431, 1432, 1433,
|
||||
1434, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443,
|
||||
1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453,
|
||||
1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467,
|
||||
1468, 1469, 1474, 1475, 1476, 1477, 1478, 1752, 1755, 2043,
|
||||
2044, 2046, 2085, 2086, 2103, 2104, 2105, 2108, 2109, 2110,
|
||||
2111, 2112, 2113, 2114, 2118, 2119, 2122, 2123, 2125, 2126,
|
||||
2127, 2207, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271,
|
||||
2272, 2273, 2274, 2275, 2276, 2277, 2278, 2282, 2283, 2286,
|
||||
2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296,
|
||||
2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306,
|
||||
2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316,
|
||||
2317, 2318, 2319, 2321, 2322, 2323, 2324, 2325, 2326, 2327,
|
||||
2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335, 2336, 2337,
|
||||
2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347,
|
||||
2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357,
|
||||
2358, 2359, 2360, 2361, 2364, 2365, 2367, 2369, 2370, 2371,
|
||||
2372, 2373, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2384,
|
||||
2385, 2386, 2388, 2389, 2390, 2391, 2402, 2403, 2404, 2405,
|
||||
2406, 2407, 2408, 2411, 2412, 2416, 2417, 2418, 2419, 2420,
|
||||
2421, 2422, 2423, 2424, 2425, 2426, 2427, 2428, 2429, 2430,
|
||||
2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2440,
|
||||
2441, 2442, 2443, 2444, 2445, 2446, 2447, 2448, 2449, 2450,
|
||||
2451, 2453, 2454, 2455, 2456, 2461, 2465, 2466, 2471, 2473,
|
||||
2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494,
|
||||
2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504,
|
||||
2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514,
|
||||
2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524,
|
||||
2525, 2526, 2527, 2528, 2529, 2530, 2532, 2533, 2534, 2535,
|
||||
2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545,
|
||||
2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555,
|
||||
2556, 2557, 2558, 2559, 2562, 2563, 2564, 2565, 2566, 2567,
|
||||
2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577,
|
||||
2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587,
|
||||
2588, 2589, 2590, 2595, 2596, 2597, 2598, 2599, 2600, 2601,
|
||||
2602, 2603, 2604, 2605, 2606, 2611, 2612, 2613, 2614, 2615,
|
||||
3078, 3079, 3081, 3130, 3131, 3132, 3134, 3135, 3136, 3137,
|
||||
3138, 3139, 3140, 3141, 3145, 3146, 3148, 3149, 3150, 3151,
|
||||
3152, 3154, 3589, 3592, 3615, 3619, 3620, 3631, 3632, 3638,
|
||||
3645, 3674, 3675, 3682, 3686, 3687, 3688, 3689, 3690, 3692,
|
||||
3694, 3696, 3699, 3743, 3744, 3749, 3750, 3759, 3766, 3774,
|
||||
3775, 3776, 3777, 3779, 3780, 3781, 3784, 3787, 3809, 3812,
|
||||
3823, 3827, 3828, 3832, 3833, 3835, 3840, 3847, 3848, 3852,
|
||||
3853, 3854, 3855, 3856, 3857, 3858, 3859, 3860, 3861, 3881,
|
||||
3882, 3891, 3895, 3900, 3902, 3903, 3907, 3910,
|
||||
]
|
||||
@@ -417,7 +417,9 @@ class Audio2MeshModel(Base):
|
||||
loss_vel_geo2 = self.loss_func_wing(diff_pdt_geo, diff_tgt_geo, weight=self.vertices_weight)
|
||||
loss_dict["loss_vel_geo_w"] = loss_vel_geo2.mean().detach()
|
||||
# loss += loss_vel_geo.mean() * self.opt.LOSS.lambda_vel_geo
|
||||
loss += loss_vel_geo2.mean() * self.opt.LOSS.lambda_vel_geo
|
||||
|
||||
if self.opt.LOSS.lambda_vel_geo:
|
||||
loss += loss_vel_geo2.mean() * self.opt.LOSS.lambda_vel_geo
|
||||
# total loss
|
||||
loss_dict['loss_all'] = loss.detach()
|
||||
|
||||
|
||||
@@ -46,9 +46,15 @@ class Audio2MeshARModel(Base):
|
||||
self.netR, self.flame = define_netR(device=self.device)
|
||||
# self.netG.init_reconstruct_model(self.netR)
|
||||
|
||||
path_deca_mean = Path("./data/DECA_obama_mean.npy")
|
||||
path_deca_mean = self.opt.DATASET.path_mean_dict
|
||||
self.mean_dict = np.load(path_deca_mean, allow_pickle=True).item()
|
||||
self.template_verts = self.get_template_vertices()
|
||||
print(f"mean_dict keys = {self.mean_dict.keys()}")
|
||||
|
||||
if self.isTrain:
|
||||
self.template_verts = self.get_template_vertices()
|
||||
else:
|
||||
self.template_verts = self.get_template_vertices(self.mean_dict)
|
||||
|
||||
debug(opt, f"template_verts shape = {self.template_verts.shape}")
|
||||
debug(opt, f"mean_dict keys = {self.mean_dict.keys()}", verbose=True)
|
||||
|
||||
@@ -198,7 +204,6 @@ class Audio2MeshARModel(Base):
|
||||
batch_y_pdf = torch.zeros(B, nsteps, self.template_verts.shape[-2], 3) # B x nsteps x 5023 x 3
|
||||
ibatch_y_pre = self.template_verts.expand(B, -1, -1, -1) # B x 1 x 5023 x 3
|
||||
|
||||
|
||||
for istep in range(nsteps):
|
||||
|
||||
ibatch_x = x[:, istep:istep+1] # B x 1 x nwind x nc_condit
|
||||
@@ -230,7 +235,7 @@ class Audio2MeshARModel(Base):
|
||||
batch_y_pdf[:, 0] = self.template_verts[0] # init first GT as PT, (5023 x 3)
|
||||
|
||||
# ibatch_y_pre = self.y_tgt[:, 0:1] # B x 1 x 5023 x 3
|
||||
ibatch_y_pre = self.template_verts.expand(B, -1, -1, -1) # B x 1 x 5023 x 3
|
||||
ibatch_y_pre = self.template_verts.expand(B, -1, -1, -1) # B x 1 x 5023 x 3
|
||||
for istep in range(1, self.nsteps_align):
|
||||
|
||||
ibatch_x = self.x[:, istep:istep+1] # B x 1 x nwind x nc_condit
|
||||
@@ -251,14 +256,15 @@ class Audio2MeshARModel(Base):
|
||||
|
||||
def get_template_vertices(self, mean_dict=None):
|
||||
|
||||
if mean_dict is not None:
|
||||
pass
|
||||
batch_exp = torch.zeros(1, 50).to(self.device)
|
||||
batch_pos = torch.zeros(1, 6).to(self.device)
|
||||
|
||||
if mean_dict is not None:
|
||||
batch_shape = self.mean_dict["shape"].reshape(1, 100)
|
||||
batch_shape = torch.from_numpy(batch_shape).float().to(self.device)
|
||||
else:
|
||||
batch_shape = torch.zeros(1, 100).to(self.device)
|
||||
batch_exp = torch.zeros(1, 50).to(self.device)
|
||||
batch_pos = torch.zeros(1, 6).to(self.device)
|
||||
|
||||
|
||||
verts, _, _ = self.netR.get_vertices(batch_shape, batch_exp, batch_pos) # 1 x 5023 x 3
|
||||
verts = verts.unsqueeze(dim=0) # 1 x 1 x 5023 x 3
|
||||
print(f"template verts reshape = {verts.shape}")
|
||||
@@ -509,14 +515,10 @@ class Audio2MeshARModel(Base):
|
||||
# print(f"jstart_time={jstart_time}, jend_time={jend_time}")
|
||||
|
||||
|
||||
# save animation
|
||||
# print(f"testing v_render_pt = {len(v_render_pt)}, gt shape = {len(v_render_gt)}")
|
||||
# save_animation_with_gt2(v_render_pt, v_render_gt, ipath_save, fps=self.opt.DATASET.fps, path_audio=jpath_audio, start_time=jstart_time, end_time=jend_time)
|
||||
|
||||
# save animation
|
||||
print(f"testing v_render_pt = {len(v_render_pt)}, gt shape = {len(v_render_gt)}, fps={self.opt.DATASET.fps}")
|
||||
save_animation_with_gt2(v_render_pt, v_render_gt, ipath_save, fps=self.opt.DATASET.fps, path_audio=jpath_audio, start_time=jstart_time, end_time=jend_time)
|
||||
|
||||
# save_animation_with_gt2(v_render_pt, v_render_gt, ipath_save, fps=self.opt.DATASET.fps, path_audio=jpath_audio, start_time=jstart_time, end_time=jend_time)
|
||||
|
||||
#########################################
|
||||
def tensor2image(tensor):
|
||||
|
||||
Reference in new issue
Block a user