add audio2mesh_ar
This commit is contained in:
1 parent
ded9b27f71
commit
e0f24982d1
46 files changed
+3917
-325
No files matched your search
+10
-68
@@ -32,6 +32,8 @@ def parese_args():
|
||||
return args
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parese_args()
|
||||
path_config = Path(args.opt)
|
||||
@@ -44,8 +46,14 @@ if __name__ == "__main__":
|
||||
|
||||
# path_audio = Path("/yrfs/lsen/DATA/LuoXData/processing2/2021-P09/audio/audio_trim_60_120s.wav")
|
||||
|
||||
path_audio = Path("/yrfs/lsen/DATA/Obama/processing/Bringing-Our-Workplace-Policies-into-the-21st-Century/audio/audio_trim_120s.wav")
|
||||
path_audio = Path("/yrfs/lsen/DATA/Actor2/processing/AA7A9568/audio/audio_trim_120s.wav")
|
||||
|
||||
# path_audio = Path("./data/test/cut_NVP.wav")
|
||||
# path_audio = Path("./data/test/cut_LSP.wav")
|
||||
# path_audio = Path("/yrfs/cf/data/render/obama_train.wav")
|
||||
# path_audio = Path("/yrfs/lsen/DATA/Obama/processing/Bringing-Our-Workplace-Policies-into-the-21st-Century/audio/audio_trim_120s.wav")
|
||||
# path_audio = Path("/yrfs/lsen/DATA/Obama/processing/Celebrating-Independence-Day/audio/audio_trim_60_120s.wav")
|
||||
|
||||
# path_audio = Path("/yrfs/lsen/DATA/LuoXData/processing2/2021-P09/audio/audio_trim_120s.wav")
|
||||
# path_audio = Path("/yrfs/lsen/DATA/LuoXData/processing2/2021-P22/audio/audio_trim.wav")
|
||||
|
||||
@@ -69,14 +77,7 @@ if __name__ == "__main__":
|
||||
if sample_rate != 16000:
|
||||
resampler = torchaudio.transforms.Resample(sample_rate, 16_000)
|
||||
audio_raw = resampler(audio_raw).squeeze().numpy()
|
||||
print(f"audio_raw shape = {audio_raw.shape}, sr = {16000}, duration = {(len(audio_raw)/16000)}")
|
||||
|
||||
|
||||
# clip
|
||||
# if len(audio_raw) > 16000 * 120:
|
||||
# audio_raw = audio_raw[:16000*120]
|
||||
|
||||
# audio_raw_numpy = audio_raw.numpy()
|
||||
print(f"resampling: audio_raw shape = {audio_raw.shape}, sr = {16000}, duration = {(len(audio_raw)/16000)}")
|
||||
|
||||
# load wav2Vec model
|
||||
print("load Wav2Vec2Model ...")
|
||||
@@ -114,62 +115,3 @@ if __name__ == "__main__":
|
||||
|
||||
model.infer(cond, path_audio, \
|
||||
f"{path_audio.stem}_infer_{Path(opt.MODEL.path_checkpoint).stem}_epoch_{opt.MODEL.load_epoch:03d}")
|
||||
|
||||
# # # Add for WaveFlow
|
||||
# # # model.netG.module = model.netG.module.remove_weightnorm(model.netG.module)
|
||||
# # # for i, batch_input in enumerate(test_loader):
|
||||
|
||||
# # motion = batch_input['data'].float().to(device) # (nbatch, nsteps=60, dim_motion=136)
|
||||
# # speech = batch_input['cond'].float().to(device) # (nbatch, nsteps=173, dim_condit=80)
|
||||
# # motion = motion.permute(0, 2, 1) # (nbatch, 136, 60)
|
||||
# # speech = speech.permute(0, 2, 1) # (nbatch, 80, 173)
|
||||
# # B = motion.size(0)
|
||||
# # motion_gt = motion.permute(0,2,1)[0:1, :, :]
|
||||
|
||||
# # # generate k samples
|
||||
# # motion_pt = []
|
||||
# # for j in range(3):
|
||||
# # data_pt = model.testing(batch_input, cur_epoch=opt.MODEL.load_epoch, save_animation=False) # B x nsteps x 136
|
||||
# # data_pt = data_pt[0:1, :, :]
|
||||
# # motion_pt.append(data_pt)
|
||||
|
||||
# # # save
|
||||
# # print("data_pt shape = ", data_pt.shape)
|
||||
# # np.save(f"data/ldmk_pdt_align30_{j}.npy", data_pt.cpu().numpy()[0])
|
||||
|
||||
|
||||
# # motion_pt = torch.cat(motion_pt, dim=0) # 8 x nsteps x 136
|
||||
# # nsteps = min(motion_gt.size(1), motion_pt.size(1))
|
||||
# # total_motion = torch.cat([motion_gt[:, :nsteps, :], motion_pt[:, :nsteps, :]], dim=0)
|
||||
# # print(f"total motion shape = {total_motion.shape}")
|
||||
|
||||
|
||||
|
||||
|
||||
# # path_save=Path(opt.OUTPUT_DIR).joinpath(f'sampled_{opt.MODEL.load_epoch:05d}.mp4')
|
||||
# # save_animation_grid(total_motion, path_save=path_save, path_audio=path_audio, ncol=2, w=256, h=256, dpi=100)
|
||||
# # # animation_with_audio(path_save, path_audio)
|
||||
|
||||
|
||||
|
||||
# # print(f"SVAE -> {opt.OUTPUT_DIR}")
|
||||
# # # break
|
||||
|
||||
|
||||
# # # # infer
|
||||
# # # epoch_beg = 400
|
||||
# # # epoch_end = 580
|
||||
# # # for epoch in range(epoch_end, epoch_beg, -50):
|
||||
# # # print(f"Testing the epoch{epoch}/{epoch_end}")
|
||||
|
||||
# # # opt.MODEL.load_epoch = epoch # set load epoch
|
||||
# # # model.setup(opt) # load model
|
||||
|
||||
# # # for i, ibatch_data in enumerate(test_loader):
|
||||
# # # model.testing(ibatch_data, cur_epoch=epoch, cur_batch=i)
|
||||
# # # model.testing(ibatch_data, cur_epoch=epoch, cur_batch=(i*100+1))
|
||||
# # # model.testing(ibatch_data, cur_epoch=epoch, cur_batch=(i*1000+1))
|
||||
# # # break
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user