update Actor6

This commit is contained in:
liangsen committed 2022-05-27 16:23:49 +08:00
1 parent dac314c9a5
commit e9b2b238b2
35 files changed
+1226 -697

No files matched your search

+12
View File
@@ -8,6 +8,7 @@ from scipy.signal import savgol_filter
# common
from common.resampling import resample_by_nsteps
from audiomentations import Compose, AddGaussianNoise, TimeStretch, PitchShift, Shift
class MotionLiveDataset(Dataset):
@@ -42,6 +43,10 @@ class MotionLiveDataset(Dataset):
f'''nsteps_frame={self.nsteps_frame}\t'''
f'''nsteps_segmt={self.nsteps_segmt} ''')
self.audio_augment = Compose([
AddGaussianNoise(min_amplitude=0.001, max_amplitude=0.015, p=0.2),
PitchShift(min_semitones=-4, max_semitones=4, p=0.2),
])
def __len__(self):
@@ -72,6 +77,7 @@ class MotionLiveDataset(Dataset):
nframe = data_motion.shape[0]
nsegmt = data_speech.shape[0]
if self.phase == "train" and self.opt.DATASET.shifting_speed and random.random() < 0.3:
speed = random.sample({0.5, 0.7, 0.8, 0.9, 1.1, 1.2, 1.3, 1.4, 1.5},1)[0]
@@ -109,6 +115,12 @@ class MotionLiveDataset(Dataset):
assert data_motion.shape[0] == self.nsteps_frame, f"data_motion shape={data_motion.shape}, vid={vid}"
# audio augment
data_speech = self.audio_augment(samples=data_speech, sample_rate=self.sr )
# print(f"after augment data speech = {data_speech.shape}, before nsegmt = {nsegmt}, nframe={nframe}")
# assert data_speech.shape[0] == (end_segmt-beg_segmt), f"after augment data speech {data_speech.shape} should = {end_segmt-beg_segmt}"
# 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')