update Actor6
This commit is contained in:
1 parent
dac314c9a5
commit
e9b2b238b2
35 files changed
+1226
-697
No files matched your search
@@ -0,0 +1,86 @@
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
|
||||
import os, sys
|
||||
sys.path.insert(0, os.getcwd())
|
||||
from common.logger import Logger
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# fid = "Bringing-Our-Workplace-Policies-into-the-21st-Century"
|
||||
# fid = "4R3A0071"
|
||||
fid = '4R3A0110'
|
||||
|
||||
path_root = Path("/ssdata1/lsen/DATA/Actor6/processing")
|
||||
# path_save = Path("./data/Actor5/DECA_Actor5_mean_smile.npy")
|
||||
path_save = Path("./data/Actor6/DECA_Actor6_mean.npy")
|
||||
path_save.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
logger = Logger(path_save.parent, postfix="mean_coeff")
|
||||
|
||||
path_data = path_root.joinpath(fid)
|
||||
path_coeff = path_data.joinpath("DECA_coeff")
|
||||
vpath_coeff = sorted(path_coeff.glob("*.npy"), reverse=False)
|
||||
logger.info(f"Have {len(vpath_coeff)} frames")
|
||||
|
||||
feat_shape = []
|
||||
feat_tex = []
|
||||
feat_cam = []
|
||||
feat_exp = []
|
||||
feat_pos = []
|
||||
feat_light = []
|
||||
feat_detail = []
|
||||
|
||||
for i, ipath_coeff in enumerate(vpath_coeff):
|
||||
if i > 2000: break
|
||||
|
||||
data_coeff = np.load(ipath_coeff, allow_pickle=True).item()
|
||||
|
||||
feat_exp.append(data_coeff["exp"])
|
||||
feat_pos.append(data_coeff["pose"])
|
||||
feat_tex.append(data_coeff["tex"])
|
||||
feat_cam.append(data_coeff["cam"])
|
||||
feat_light.append(data_coeff["light"])
|
||||
feat_detail.append(data_coeff["detail"])
|
||||
feat_shape.append(data_coeff["shape"])
|
||||
|
||||
# save
|
||||
feat_exp = np.array(feat_exp) # (nframe_trim, 50)
|
||||
feat_pos = np.array(feat_pos) # (nframe_trim, 6)
|
||||
feat_tex = np.array(feat_tex) # (nframe_trim, 50)
|
||||
feat_cam = np.array(feat_cam) # (nframe_trim, 6)
|
||||
feat_light = np.array(feat_light) # (nframe_trim, 50)
|
||||
feat_detail = np.array(feat_detail) # (nframe_trim, 6)
|
||||
feat_shape = np.array(feat_shape) # (nframe_trim, 50)
|
||||
|
||||
mean_exp = feat_exp.mean(axis=0)
|
||||
mean_pos = feat_pos.mean(axis=0)
|
||||
mean_tex = feat_tex.mean(axis=0)
|
||||
mean_cam = feat_cam.mean(axis=0)
|
||||
mean_light = feat_light.mean(axis=0)
|
||||
mean_detail = feat_detail.mean(axis=0)
|
||||
mean_shape = feat_shape.mean(axis=0)
|
||||
|
||||
logger.info(f"feat_exp shape = {feat_exp.shape}, mean = {mean_exp.shape}, \n{mean_exp}")
|
||||
logger.info(f"mean_pos shape = {feat_pos.shape}, mean = {mean_pos.shape}, \n{mean_pos}")
|
||||
logger.info(f"mean_tex shape = {feat_tex.shape}, mean = {mean_tex.shape}, \n{mean_tex}")
|
||||
logger.info(f"mean_cam shape = {feat_cam.shape}, mean = {mean_cam.shape}, \n{mean_cam}")
|
||||
logger.info(f"mean_light shape = {feat_light.shape}, mean = {mean_light.shape}, \n{mean_light}")
|
||||
logger.info(f"mean_detail shape = {feat_detail.shape}, mean = {mean_detail.shape}, \n{mean_detail}")
|
||||
logger.info(f"mean_shape shape = {feat_shape.shape}, mean = {mean_shape.shape}, \n{mean_shape}")
|
||||
|
||||
# save
|
||||
mean_DECA = {
|
||||
"exp": mean_exp, # (50, )
|
||||
"pose": mean_pos, # (6, )
|
||||
"tex": mean_tex, # (50, )
|
||||
"cam": mean_cam, # (3, )
|
||||
"light": mean_light, # (9, 3)
|
||||
"detail": mean_detail,# (128, )
|
||||
"shape": mean_shape, # (100, )
|
||||
}
|
||||
|
||||
np.save(path_save, mean_DECA)
|
||||
logger.info("save to --> ", path_save)
|
||||
logger.info(f"mean deca = \n {mean_DECA}")
|
||||
Reference in new issue
Block a user