add Tensorboard + meanMetrics for training, actor3 processing

This commit is contained in:
Sen Liang committed 2022-04-03 00:28:50 +08:00
1 parent 33e5cb7584
commit ad93886668
36 files changed
+351 -214

No files matched your search

+6 -45
View File
@@ -5,8 +5,10 @@ from pathlib import Path
if __name__ == "__main__":
# fid = "Bringing-Our-Workplace-Policies-into-the-21st-Century"
fid = "AA7A9571"
path_root = Path("/yrfs/lsen/DATA/Actor2/processing")
fid = "BU6A9965"
path_root = Path("/mfs/lsen/DATA/Actor3/processing")
path_save = Path("./data/Actor3/DECA_Actor3_mean.npy")
path_save.parent.mkdir(parents=True, exist_ok=True)
path_data = path_root.joinpath(fid)
@@ -22,7 +24,8 @@ if __name__ == "__main__":
feat_light = []
feat_detail = []
for ipath_coeff in vpath_coeff:
for i, ipath_coeff in enumerate(vpath_coeff):
if i > 1000: break
data_coeff = np.load(ipath_coeff, allow_pickle=True).item()
@@ -70,48 +73,6 @@ if __name__ == "__main__":
"shape": mean_shape, # (100, )
}
path_save = "./data/Actor2/DECA_Actor2_mean.npy"
np.save(path_save, mean_DECA)
print("save to --> ", path_save)
print(f"mean deca = \n {mean_DECA}")
# Have 21499 frames
# 'cam': array([ 9.8221273e+00, -9.2755520e-04, 2.8869644e-02], dtype=float32),
# 'pose': array([ 0.04063781, -0.00623041, -0.01067916,
# 0.11206006, 0.00411261, 0.02320058], dtype=float32),
# 'exp': array([-0.6491158 , -0.0998203 , 0.10486019, 0.37043977, -0.29840025,
# -0.41017675, 0.327057 , 0.04885808, -0.06325228, 0.4434316 ,
# 0.05493879, 0.66853815, -0.10403663, 0.01440001, 0.25900015,
# -0.46350944, -0.41076973, -0.10278799, -0.08775225, 0.51222765,
# 0.10053314, -0.26408502, 0.11820181, -0.05676581, 0.02643572,
# 0.16058844, -0.11792275, 0.12630136, -0.23953533, -0.10915831,
# -0.16660552, 0.00958887, 0.2679962 , -0.26946628, 0.19901456,
# -0.09804437, -0.03807065, -0.12970755, 0.01078465, 0.19384004,
# -0.06548703, -0.03329738, 0.11319494, -0.02613433, 0.02363422,
# 0.02380173, -0.11122038, 0.13734889, 0.1255798 , 0.13813666],
# dtype=float32),
# 'shape': array([ 0.00951388, -0.22505675, -0.53953266, -0.4397285 , 0.37905172,
# 0.11540896, -0.36891365, -0.218832 , -0.3684414 , 0.24644622,
# 0.6223965 , -0.16298303, -0.35899413, -0.11834836, -0.04909257,
# -0.13188031, 0.35037243, -0.10429271, 0.25443867, -0.18088193,
# 0.16413063, 0.20566346, 0.0501059 , -0.19294368, -0.00809607,
# -0.08120474, -0.07019995, 0.01174292, 0.33962983, 0.04500978,
# -0.25193816, -0.2265279 , 0.14124256, 0.21158281, -0.09555811,
# 0.14076404, 0.04877019, 0.03229018, -0.00235608, -0.08356833,
# 0.09741616, 0.2644469 , 0.13229795, -0.14537199, -0.2314888 ,
# -0.48501098, -0.13492987, -0.13772976, -0.18299519, -0.11046503,
# 0.04127223, -0.4613573 , -0.06382176, 0.08914807, 0.08793663,
# 0.11848436, 0.03956904, 0.04172374, -0.04793308, 0.30301905,
# -0.06345342, 0.04190513, 0.13665007, -0.03253645, 0.08728135,
# 0.06684338, 0.02282041, 0.00583193, -0.11710295, -0.06365721,
# -0.00492529, -0.14196472, 0.03584495, -0.00815303, -0.00147824,
# 0.2087406 , -0.11037645, -0.04405028, -0.129121 , 0.03147175,
# -0.03467533, -0.00330734, 0.13060835, -0.02846657, 0.05666886,
# -0.07806987, -0.17371002, 0.05375125, -0.04018219, 0.08453278,
# -0.05303599, -0.11419729, -0.16071273, -0.00130347, -0.1172006 ,
# -0.06073425, -0.03826162, -0.0587554 , -0.06399846, -0.14208533],
# dtype=float32)}
@@ -91,7 +91,6 @@ if __name__ == '__main__':
nframes = len(list(video.iter_frames()))
# get audio
audio_sub = video.audio
if audio_sub is None:
@@ -18,14 +18,14 @@ def main(args):
# device = args.device
device = "cuda:2"
device = "cuda:7"
# run DECA
deca_cfg.model.use_tex = args.useTex
deca = DECA(config = deca_cfg, device=device)
# path_data = Path("/yrfs/lsen/DATA/TestData/processing")
path_data = Path("/yrfs/lsen/DATA/Actor2/processing")
path_data = Path("/mfs/lsen/DATA/Actor3/processing")
v_dir_videos = sorted(path_data.glob("*"), reverse=False)
print(f"Have {len(v_dir_videos)} dir files")
@@ -75,10 +75,10 @@ def main(args):
print(f"Have finised before, nkpt2d={nkpt2d} nframes = {nframes}")
continue
datatest = ObamaData(ipath_frame, iscrop=args.iscrop, face_detector=args.detector, device=device)
dataloader = DataLoader(datatest, batch_size=128, shuffle=False, drop_last=False)
for i, ibatch_data in enumerate(dataloader):
batch_names = ibatch_data["names"]
batch_image = ibatch_data["image"].to(device)
+3 -4
View File
@@ -7,11 +7,10 @@ from pathlib import Path
if __name__ == "__main__":
path_data = Path("/yrfs/lsen/DATA/Actor2/processing")
path_data = Path("/mfs/lsen/DATA/Actor3/processing")
v_dir_videos = sorted(path_data.glob("*"))
print(f"Have {len(v_dir_videos)} dir files")
# for each video
duration_frame, duration_coeff = 0, 0
for ipath_data in v_dir_videos:
@@ -51,11 +50,11 @@ if __name__ == "__main__":
if len(vframe_frame) != nframes:
print(f"\n ERROR: nframe_real ={len(vframe_frame)} / nframe_info ={nframes}")
# continue
continue
if len(vframe_coeff)+1 < nframes:
print(f"\n ERROR: nframe_coeff ={len(vframe_coeff)} / nframe_info ={nframes}")
# continue
continue
if ipath_save_exp.exists() and ipath_save_pos.exists():
print(f"ipath_save_exp have already save > {ipath_save_exp}")
@@ -29,8 +29,8 @@ def landmark_resample_fps(y, source_fps = 30, target_fps=25):
if __name__ == "__main__":
path_data = Path("/yrfs/lsen/DATA/Actor2/processing")
path_save = Path('data/Actor2/Actor2-raw-7h') # processing
path_data = Path("/mfs/lsen/DATA/Actor3/processing")
path_save = Path('data/Actor2/Actor3-raw-1h') # processing
path_save.mkdir(parents=True, exist_ok=True)
v_dir_videos = sorted(path_data.glob("*/audio/feat_DECA_exp_trim.npy"))
@@ -40,17 +40,17 @@ if __name__ == "__main__":
vids = set([ipath.stem for ipath in v_dir_videos])
# print(f"vids total= {vids}")
vid_test = set(["AA7A9568", "AA7A9577"])
# vid_valid = set(["AA7A9569", "AA7A9578"])
vid_train = set(['AA7A9570', 'AA7A9571', 'AA7A9572', 'AA7A9573', 'AA7A9574', 'AA7A9575', 'AA7A9576', 'AA7A9579',
'AA7A9580', 'AA7A9582', 'AA7A9583', 'AA7A9584', 'AA7A9585', 'AA7A9600', 'AA7A9601', 'AA7A9602',
'AA7A9603', 'AA7A9604', 'AA7A9605', 'AA7A9606', 'AA7A9607', 'AA7A9608', 'AA7A9609', 'AA7A9610',
'AA7A9611', 'AA7A9612', 'AA7A9613', 'AA7A9614', 'AA7A9615', 'AA7A9616', 'AA7A9617', 'AA7A9618',
'AA7A9619', 'AA7A9620', 'AA7A9621', 'AA7A9622', 'AA7A9623', 'AA7A9625', 'AA7A9626', 'AA7A9627',
'AA7A9628'])
vid_test = set(["BU6A9965"])
vid_valid = set(["BU6A9965"])
# vid_train = set(['AA7A9570', 'AA7A9571', 'AA7A9572', 'AA7A9573', 'AA7A9574', 'AA7A9575', 'AA7A9576', 'AA7A9579',
# 'AA7A9580', 'AA7A9582', 'AA7A9583', 'AA7A9584', 'AA7A9585', 'AA7A9600', 'AA7A9601', 'AA7A9602',
# 'AA7A9603', 'AA7A9604', 'AA7A9605', 'AA7A9606', 'AA7A9607', 'AA7A9608', 'AA7A9609', 'AA7A9610',
# 'AA7A9611', 'AA7A9612', 'AA7A9613', 'AA7A9614', 'AA7A9615', 'AA7A9616', 'AA7A9617', 'AA7A9618',
# 'AA7A9619', 'AA7A9620', 'AA7A9621', 'AA7A9622', 'AA7A9623', 'AA7A9625', 'AA7A9626', 'AA7A9627',
# 'AA7A9628'])
# vid_train = vids - vid_test - vid_valid
vid_valid = vids - vid_test - vid_train
vid_train = vids - vid_test - vid_valid
# vid_valid = vids - vid_test - vid_train
# vids = set(["2021-P09", "2021-P14", "2021-P22"])
# vid_test = set(["2021-P09" ])