add actor7Data
This commit is contained in:
1 parent
922a98e36b
commit
a4c53e3265
22 files changed
+1802
-50
No files matched your search
@@ -141,7 +141,7 @@ def processing_one_folder(ipath_frame, ipath_ldmks, ipath_fcrop, ipath_tfrom, ip
|
||||
if __name__ == "__main__":
|
||||
|
||||
actor = "Actor5"
|
||||
sub_folder = "processing" # smile, processing, processing2
|
||||
sub_folder = "smile" # smile, processing, processing2
|
||||
|
||||
# logger
|
||||
logger = Logger(f"./data/{actor}", postfix=f"crop-transform-{sub_folder}")
|
||||
@@ -163,8 +163,7 @@ if __name__ == "__main__":
|
||||
logger.info(f"processing {i}/{len(vpath_videos)} -> {ipath_item} ... ")
|
||||
|
||||
# if iname not in ["4R3A0069"]: continue
|
||||
if iname not in ["4R3A0068", "4R3A0066", "4R3A0065"]: continue
|
||||
|
||||
# if iname not in ["4R3A0068", "4R3A0066", "4R3A0065"]: continue
|
||||
|
||||
# if iname not in IDs: continue
|
||||
ipath_ldmks = ipath_item.joinpath("landmarks_FAN")
|
||||
@@ -200,9 +199,6 @@ if __name__ == "__main__":
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,28 +4,24 @@ from pathlib2 import Path
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
path_data = Path("/ssdata1/lsen/DATA/Actor5/processing")
|
||||
path_data = Path("/ssdata1/lsen/DATA/Actor6/processing")
|
||||
vpath_videos = sorted(path_data.glob("*"), reverse=False)
|
||||
print(f"Have {len(vpath_videos)} dir files")
|
||||
|
||||
clear_folders = ["frames_crop_parse_512", "frames_crop_parse_skin_512", "frames_crop_parse_vis_512", "DECA_kpt2d", "DECA_coeff", "DECA_kpt3d"]
|
||||
# clear_folders = ["frames_crop_parse_512", "frames_crop_parse_skin_512", "frames_crop_parse_vis_512", "DECA_coeff"]
|
||||
|
||||
# IDs = ["2-23min"]
|
||||
# for each word
|
||||
for i, ipath_item in enumerate(vpath_videos):
|
||||
iname = ipath_item.stem
|
||||
print(f"processing {i}/{len(vpath_videos)} -> {ipath_item} ... ")
|
||||
|
||||
# if iname not in IDs: continue
|
||||
ipath_fcrop = ipath_item.joinpath("frames_crop")
|
||||
ipath_tfrom = ipath_item.joinpath("frames_crop_tform")
|
||||
|
||||
for kfolder in clear_folders:
|
||||
# if iname not in IDs: continue
|
||||
ipath_fcrop = ipath_item.joinpath(kfolder)
|
||||
|
||||
if ipath_fcrop.exists():
|
||||
cmd = f"rm -rf {str(ipath_fcrop)}"
|
||||
print("RUN: ", cmd)
|
||||
os.system(cmd)
|
||||
|
||||
if ipath_tfrom.exists():
|
||||
cmd = f"rm -rf {str(ipath_tfrom)}"
|
||||
print("RUN: ", cmd)
|
||||
os.system(cmd)
|
||||
if ipath_fcrop.exists():
|
||||
cmd = f"rm -rf {str(ipath_fcrop)}"
|
||||
print("RUN: ", cmd)
|
||||
os.system(cmd)
|
||||
@@ -17,13 +17,13 @@ from decalib.utils.config import cfg as deca_cfg
|
||||
def main(args):
|
||||
|
||||
# device = args.device
|
||||
device = "cuda:3"
|
||||
device = "cuda:8"
|
||||
# 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("/ssdata1/lsen/DATA/Actor5/processing")
|
||||
path_data = Path("/ssdata1/lsen/DATA/Actor5/smile")
|
||||
|
||||
v_dir_videos = sorted(path_data.glob("*"), reverse=False)
|
||||
print(f"Have {len(v_dir_videos)} dir files")
|
||||
@@ -68,10 +68,10 @@ def main(args):
|
||||
continue
|
||||
|
||||
# check if finish
|
||||
nkpt2d = len(list(ipath_coeff.glob("*.npy")))
|
||||
if nkpt2d + 10 > nframes:
|
||||
print(f"Have finised before, nkpt2d={nkpt2d} nframes = {nframes}")
|
||||
continue
|
||||
# nkpt2d = len(list(ipath_coeff.glob("*.npy")))
|
||||
# if nkpt2d + 10 > nframes:
|
||||
# print(f"Have finised before, nkpt2d={nkpt2d} nframes = {nframes}")
|
||||
# continue
|
||||
|
||||
|
||||
datatest = ObamaData(ipath_frame, iscrop=args.iscrop, face_detector=args.detector, device=device)
|
||||
|
||||
@@ -3,6 +3,7 @@ from loguru import logger
|
||||
import numpy as np
|
||||
from pathlib2 import Path
|
||||
import torchaudio
|
||||
from scipy.signal import savgol_filter
|
||||
|
||||
import os, sys
|
||||
sys.path.insert(0, os.getcwd())
|
||||
@@ -12,7 +13,7 @@ from common.logger import Logger
|
||||
if __name__ == "__main__":
|
||||
|
||||
actor= "Actor5"
|
||||
sub_folder = "processing" # processing, smile, body
|
||||
sub_folder = "smile" # processing, smile, body
|
||||
|
||||
path_data = Path(f"/ssdata1/lsen/DATA/{actor}/{sub_folder}")
|
||||
path_save = Path(f'data/{actor}/data-render-{sub_folder}-1h')
|
||||
@@ -63,11 +64,13 @@ if __name__ == "__main__":
|
||||
logger.info(f"\n\n processing the {i}-th video {vid} ... ")
|
||||
|
||||
ipath_info = ipath_data.joinpath("video/info.json")
|
||||
# ipath_coeff = ipath_data.joinpath("DECA_coeff") # DECA coeff of shape/exp/light
|
||||
ipath_coeff = ipath_data.joinpath("deca_coeff_512") # DECA coeff of shape/exp/light
|
||||
ipath_frame = ipath_data.joinpath("frames_crop_512") # cropped image 512x512
|
||||
ipath_ldmks = ipath_data.joinpath("frames_crop_ldmks_512") # cropped landmarks within 512x512
|
||||
ipath_parse = ipath_data.joinpath("frames_crop_parse_skin_512") # cropped mask
|
||||
# ipath_coeff = ipath_data.joinpath("DECA_coeff") # DECA coeff of shape/exp/light
|
||||
ipath_coeff = ipath_data.joinpath("deca_coeff_512") # DECA coeff of shape/exp/light
|
||||
ipath_frame = ipath_data.joinpath("frames_crop_512") # cropped image 512x512
|
||||
ipath_ldmks = ipath_data.joinpath("frames_crop_ldmks_512") # cropped landmarks within 512x512
|
||||
ipath_parse = ipath_data.joinpath("frames_crop_mask_512") # cropped mask
|
||||
|
||||
# ipath_parse = ipath_data.joinpath("frames_crop_parse_skin_512") # cropped mask
|
||||
|
||||
# check info existing
|
||||
if not ipath_info.exists():
|
||||
@@ -101,6 +104,22 @@ if __name__ == "__main__":
|
||||
ipath_feat_coeff = ipath_data.joinpath("audio/feat_deca_coeff_512p.npy")
|
||||
data_coeff = np.load(ipath_feat_coeff) # (nframe, 236)
|
||||
data_coeff = data_coeff.astype(np.float16) # convert float16
|
||||
|
||||
# load landmark
|
||||
feat_ldmk = []
|
||||
for k in range(num_ldmks):
|
||||
kpath_ldmk = ipath_ldmks.joinpath(f"frame-{k:06d}.txt")
|
||||
if not kpath_ldmk.exists():
|
||||
logger.info(f"\n ERROR: landmark path NOT FOUND! -> {kpath_ldmk}")
|
||||
break
|
||||
|
||||
kpt = np.loadtxt(kpath_ldmk) # (68, 2)
|
||||
assert kpt.shape[0] == 68, f"the kpt shape ={kpt.shape}, --> {kpath_ldmk}"
|
||||
feat_ldmk.append(kpt)
|
||||
|
||||
# smooth landmark it
|
||||
feat_ldmk = np.array(feat_ldmk) # (N, 68, 2)
|
||||
feat_ldmk = savgol_filter(feat_ldmk, window_length=5, polyorder=3, axis=0, mode='nearest')
|
||||
|
||||
|
||||
if vid in vid_train:
|
||||
@@ -112,7 +131,8 @@ if __name__ == "__main__":
|
||||
"sr": 16000,
|
||||
"nframe": nframes,
|
||||
"path_data": str(ipath_data),
|
||||
"data_coeff": data_coeff
|
||||
"data_coeff": data_coeff,
|
||||
"data_ldmks": feat_ldmk
|
||||
}
|
||||
|
||||
if vid in vid_valid:
|
||||
@@ -124,7 +144,8 @@ if __name__ == "__main__":
|
||||
"sr": 16000,
|
||||
"nframe": nframes,
|
||||
"path_data": str(ipath_data),
|
||||
"data_coeff": data_coeff
|
||||
"data_coeff": data_coeff,
|
||||
"data_ldmks": feat_ldmk
|
||||
}
|
||||
|
||||
if vid in vid_test:
|
||||
@@ -136,9 +157,11 @@ if __name__ == "__main__":
|
||||
"sr": 16000,
|
||||
"nframe": nframes,
|
||||
"path_data": str(ipath_data),
|
||||
"data_coeff": data_coeff
|
||||
"data_coeff": data_coeff,
|
||||
"data_ldmks": feat_ldmk
|
||||
}
|
||||
|
||||
|
||||
logger.info(f"Total frames: data_train ({durations_train/60:.2f} min) ({durations_train/3600:.2f} h) , ids = ({len(data_train)})")
|
||||
logger.info(f"Total frames: data_valid ({durations_valid/60:.2f} min) ({durations_valid/3600:.2f} h) , ids = ({len(data_valid)})")
|
||||
logger.info(f"Total frames: data_test ({durations_test/60:.2f} min) ({durations_test/3600:.2f} h) , ids = ({len(data_test)})")
|
||||
|
||||
Reference in new issue
Block a user