update Actor6
This commit is contained in:
1 parent
dac314c9a5
commit
e9b2b238b2
35 files changed
+1226
-697
No files matched your search
+19
-8
@@ -6,6 +6,8 @@ from pathlib import Path
|
||||
import torch.nn.functional as F
|
||||
from scipy.signal import savgol_filter
|
||||
|
||||
from scipy.io import wavfile
|
||||
|
||||
import torch
|
||||
import torchaudio
|
||||
|
||||
@@ -41,7 +43,8 @@ if __name__ == "__main__":
|
||||
path_config = Path(args.opt)
|
||||
postfix = opt.TRAIN.resume_suffix if opt.TRAIN.resume else None # if resume, resume to resume_suffix folder
|
||||
logger = Logger(opt.OUTPUT_DIR, path_config=path_config, postfix=postfix)
|
||||
device = torch.device(f'cuda:{opt.GPUS[0]}') # get device name: CPU or GPU
|
||||
|
||||
device = torch.device(f'cuda:6') # get device name: CPU or GPU
|
||||
|
||||
# logger.info(pprint.pformat(opt))
|
||||
opt.OUTPUT_DIR = logger.path_output
|
||||
@@ -56,8 +59,11 @@ if __name__ == "__main__":
|
||||
# fID = "BU6A9965"
|
||||
# ipath_data = Path(f"/mfs/lsen/DATA/Actor3/processing/{fID}/")
|
||||
|
||||
fID = "4R3A0071"
|
||||
ipath_data = Path(f"/ssdata1/lsen/DATA/Actor5/processing/{fID}/")
|
||||
fID = "4R3A0139"
|
||||
actor="Actor6"
|
||||
sub_folder = "processing2" # smile, processing, processing2
|
||||
|
||||
ipath_data = Path(f"/ssdata1/lsen/DATA/{actor}/{sub_folder}/{fID}/") # processing
|
||||
ipath_audio = ipath_data.joinpath("audio/audio_trim.wav")
|
||||
|
||||
# laod motion
|
||||
@@ -84,12 +90,12 @@ if __name__ == "__main__":
|
||||
|
||||
|
||||
# padding to
|
||||
len_align = (raw_speech.shape[0] // 16000 ) * 16000
|
||||
raw_speech = raw_speech[: len_align]
|
||||
print(f"after raw_speech shape = {raw_speech.shape}, sr = {sample_rate}, duration = {(len(raw_speech)/sample_rate)}")
|
||||
# len_align = (raw_speech.shape[0] // (16000 // 50) ) * (16000 // 50)
|
||||
# raw_speech = raw_speech[: len_align]
|
||||
# print(f"after raw_speech shape = {raw_speech.shape}, sr = {sample_rate}, duration = {(len(raw_speech)/sample_rate)}")
|
||||
|
||||
nwinds_beg = 60
|
||||
nwinds_end = 120
|
||||
nwinds_beg = 0
|
||||
nwinds_end = 60
|
||||
data_motion = torch.from_numpy(data_motion[np.newaxis, 50*nwinds_beg:50*nwinds_end, :]) # (1, 3000, 53)
|
||||
raw_speech = raw_speech[nwinds_beg *sample_rate : nwinds_end * sample_rate]
|
||||
|
||||
@@ -126,5 +132,10 @@ if __name__ == "__main__":
|
||||
model = create_model(opt, logger)
|
||||
model.setup(opt) # load model
|
||||
|
||||
|
||||
# save trim wav
|
||||
path_audio_pad_trim = Path(opt.OUTPUT_DIR).joinpath(f'{ipath_audio.stem}_input_pad_trim.wav')
|
||||
wavfile.write(str(path_audio_pad_trim), rate=16000, data=raw_speech)
|
||||
|
||||
suffix = f"{ipath_audio.stem}_infer_{Path(opt.MODEL.path_checkpoint).stem}_epoch_{opt.MODEL.load_epoch:03d}"
|
||||
model.infer_with_gt(cond, data_motion, raw_speech, suffix)
|
||||
Reference in new issue
Block a user