Update dataset.py

This commit is contained in:
aufr33 2021-07-08 14:42:46 +03:00 committed by GitHub
parent 41c34e71f8
commit 66a693dcdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,12 @@ def augment(X, y, reduction_rate, reduction_mask, mixup_rate, mixup_alpha, mp):
X[idx] = X[idx].mean(axis=0, keepdims=True)
y[idx] = y[idx].mean(axis=0, keepdims=True)
if np.random.uniform() < 0.02:
# delay / echo
d = np.random.randint(1, 10, size=2)
v = X[idx] - y[idx]
X[idx, 0, :, d[0]:] += v[0, :, :-d[0]] * random.uniform(0.1, 0.3)
X[idx, 1, :, d[1]:] += v[1, :, :-d[1]] * random.uniform(0.1, 0.3)
if np.random.uniform() < 0.02:
# inst
X[idx] = y[idx]