add audio2mesh model support
This commit is contained in:
1 parent
5eb304186a
commit
386df9a4ab
83 files changed
+9318
-1307
No files matched your search
@@ -18,18 +18,23 @@ class MotionLiveDataset(Dataset):
|
||||
"""
|
||||
super(MotionLiveDataset, self).__init__()
|
||||
|
||||
|
||||
self.opt = opt
|
||||
self.phase = phase
|
||||
path_data= Path(opt.DATASET.root).joinpath(f"data_{phase}.npz")
|
||||
|
||||
# for test
|
||||
# if phase == "valid":
|
||||
# path_data= Path(opt.DATASET.root).joinpath(f"data_train.npz")
|
||||
|
||||
# if phase == "test":
|
||||
# path_data= Path(opt.DATASET.root).joinpath(f"data_train.npz")
|
||||
|
||||
print(f"\n [{self.phase}] load data ... --> {path_data}")
|
||||
# dict vid: {"data_motion", # [nframe, 53]
|
||||
# "data_speech", # [duration * sample_rate, ] raw deepseep
|
||||
# "nframe", "fps", "sr"}
|
||||
self.annodb = np.load(path_data, allow_pickle=True)['data'].item()
|
||||
|
||||
|
||||
self.num_pid = len(self.annodb)
|
||||
self.pids = list(self.annodb.keys())
|
||||
|
||||
@@ -60,9 +65,9 @@ class MotionLiveDataset(Dataset):
|
||||
|
||||
def __len__(self):
|
||||
if self.phase == "train":
|
||||
return 20000
|
||||
return 20000 #40000
|
||||
elif self.phase == "valid":
|
||||
return 1000
|
||||
return 2000 #5000
|
||||
else:
|
||||
return 100
|
||||
|
||||
@@ -77,11 +82,20 @@ class MotionLiveDataset(Dataset):
|
||||
"""
|
||||
np.random.seed(int(idx + time.time()))
|
||||
vid = self.pids[idx % self.num_pid]
|
||||
|
||||
# # filter "2021-P29"
|
||||
# while vid == "2021-P29":
|
||||
# vid = self.pids[idx % self.num_pid]
|
||||
|
||||
# random select idx
|
||||
data = self.annodb[vid]
|
||||
data_motion = data["data_motion"] # (nframes, nc_motion)
|
||||
data_speech = data["data_speech"] # (nsegemts, )
|
||||
data_motion = data["data_motion"] # (nframes, nc_motion)
|
||||
data_speech = data["data_speech"] # (nsegemts, )
|
||||
# data_shape = data["data_shape"] # (nframes, nc_shape)
|
||||
|
||||
data_motion = data["data_motion"] # (nframes, nc_motion)
|
||||
data_speech = data["data_speech"] # (nsegemts, )
|
||||
# data_shape = data["data_shape"] # (nframes, nc_shape)
|
||||
|
||||
nframe = data_motion.shape[0]
|
||||
nsegmt = data_speech.shape[0]
|
||||
@@ -94,22 +108,27 @@ class MotionLiveDataset(Dataset):
|
||||
end_segmt = beg_segmt + self.nsteps_segmt
|
||||
# print(f"nframe-{self.nsteps_frame:04d} =[{beg_frame:04d},{end_frame:04d})\t nsegmet-{self.nsteps_segmt:04d}=[{beg_segmt:04d},{end_segmt:04d}), vid={vid}")
|
||||
|
||||
|
||||
data_motion = data_motion[beg_frame:end_frame, :] # (nteps, 53)
|
||||
data_speech = data_speech[beg_segmt:end_segmt] # (nsegmt_steps, )
|
||||
# data_shape = data_shape[beg_frame:end_frame, :] # (nsteps, 100)
|
||||
|
||||
|
||||
# filter, explore doc: ./notebook/explore_pose.ipynb
|
||||
if self.opt.DATASET.filter == "savgol":
|
||||
data_motion = savgol_filter(data_motion, window_length=5, polyorder=3, axis=0, mode='nearest')
|
||||
# data_shape = savgol_filter(data_shape, window_length=5, polyorder=3, axis=0, mode='nearest')
|
||||
|
||||
|
||||
result = {
|
||||
"data": data_motion, # (nsteps_frame, dim_motion)
|
||||
"cond": data_speech, # (nsteps_frame, dim_speech)
|
||||
# "shape": data_shape,
|
||||
"vid": vid,
|
||||
"nframe": nframe,
|
||||
"frame_interval": [beg_frame, end_frame],
|
||||
# "duration_interval": [beg_frame/nframe, end_frame/nframe]
|
||||
}
|
||||
|
||||
assert data_speech.shape[0] == self.nsteps_segmt, f"data_speech shape={data_speech.shape}, vid={vid}"
|
||||
|
||||
return result
|
||||
Reference in new issue
Block a user