update
Browse files
examples/vm_sound_classification/run.sh
CHANGED
@@ -12,8 +12,8 @@ sh run.sh --stage 2 --stop_stage 2 --system_version windows --file_folder_name f
|
|
12 |
E:/Users/tianx/HuggingDatasets/vm_sound_classification/data/wav_finished/id-ID/wav_finished/*/*.wav" \
|
13 |
--label_plan 4
|
14 |
|
15 |
-
sh run.sh --stage
|
16 |
-
--filename_patterns "/data/tianxing/PycharmProjects/datasets/voicemail/*/wav_finished/*/*.wav" --label_plan
|
17 |
|
18 |
"
|
19 |
|
|
|
12 |
E:/Users/tianx/HuggingDatasets/vm_sound_classification/data/wav_finished/id-ID/wav_finished/*/*.wav" \
|
13 |
--label_plan 4
|
14 |
|
15 |
+
sh run.sh --stage 0 --stop_stage 5 --system_version centos --file_folder_name file_dir --final_model_name vm_sound_classification8-ch32 \
|
16 |
+
--filename_patterns "/data/tianxing/PycharmProjects/datasets/voicemail/*/wav_finished/*/*.wav" --label_plan 8
|
17 |
|
18 |
"
|
19 |
|
toolbox/torchaudio/augment/spec_augment.py
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
#!/usr/bin/python3
|
2 |
-
# -*- coding: utf-8 -*-
|
3 |
-
"""
|
4 |
-
https://github.com/wenet-e2e/wenet/blob/main/wenet/dataset/processor.py
|
5 |
-
"""
|
6 |
-
import random
|
7 |
-
from typing import List, Tuple
|
8 |
-
|
9 |
-
import torch
|
10 |
-
import torch.nn as nn
|
11 |
-
from torch.distributions import uniform
|
12 |
-
|
13 |
-
|
14 |
-
class SpecAugment(nn.Module):
|
15 |
-
def __init__(self,
|
16 |
-
aug_volume_factor_range: Tuple[float, float] = (0.5, 2.0),
|
17 |
-
):
|
18 |
-
super().__init__()
|
19 |
-
self.aug_volume_factor_range = aug_volume_factor_range
|
20 |
-
|
21 |
-
@staticmethod
|
22 |
-
def augment_volume(spec: torch.Tensor, factor_range: Tuple[float, float] = (0.5, 2.0)):
|
23 |
-
factor = uniform.Uniform(*factor_range)
|
24 |
-
factor = factor.sample()
|
25 |
-
spec_ = spec.clone().detach()
|
26 |
-
spec_ *= factor
|
27 |
-
return spec_
|
28 |
-
|
29 |
-
def forward(self, spec: torch.Tensor) -> torch.Tensor:
|
30 |
-
spec = self.augment_volume(spec, self.aug_volume_factor_range)
|
31 |
-
return spec
|
32 |
-
|
33 |
-
|
34 |
-
def main():
|
35 |
-
spec_augment = SpecAugment()
|
36 |
-
|
37 |
-
spec = torch.randn(size=(1, 10, 4))
|
38 |
-
print(spec)
|
39 |
-
|
40 |
-
spec_ = spec_augment.forward(spec)
|
41 |
-
print(spec_)
|
42 |
-
return
|
43 |
-
|
44 |
-
|
45 |
-
if __name__ == '__main__':
|
46 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|