Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
1b787411
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1b787411
编写于
8月 08, 2017
作者:
X
Xinghai Sun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update noise and impulse augmentor according to code review.
上级
01226191
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
49 addition
and
26 deletion
+49
-26
conf/augmentation.config
conf/augmentation.config
+8
-0
conf/augmentation.config.example
conf/augmentation.config.example
+15
-3
data_utils/augmentor/augmentation.py
data_utils/augmentor/augmentation.py
+1
-1
data_utils/augmentor/impulse_response.py
data_utils/augmentor/impulse_response.py
+8
-7
data_utils/augmentor/noise_perturb.py
data_utils/augmentor/noise_perturb.py
+6
-5
datasets/run_all.sh
datasets/run_all.sh
+0
-9
datasets/run_noise.sh
datasets/run_noise.sh
+10
-0
train.py
train.py
+1
-1
未找到文件。
conf/augmentation.config
0 → 100644
浏览文件 @
1b787411
[
{
"type"
:
"shift"
,
"params"
: {
"min_shift_ms"
: -
5
,
"max_shift_ms"
:
5
},
"prob"
:
1
.
0
}
]
augmentation.config
→
conf/augmentation.config.example
浏览文件 @
1b787411
...
@@ -3,14 +3,19 @@
...
@@ -3,14 +3,19 @@
"type": "noise",
"type": "noise",
"params": {"min_snr_dB": 40,
"params": {"min_snr_dB": 40,
"max_snr_dB": 50,
"max_snr_dB": 50,
"noise_manifest"
:
"datasets/manifest.noise"
},
"noise_manifest_path": "datasets/manifest.noise"},
"prob"
:
0
.
0
"prob": 0.6
},
{
"type": "impulse",
"params": {"impulse_manifest_path": "datasets/manifest.impulse"},
"prob": 0.5
},
},
{
{
"type": "speed",
"type": "speed",
"params": {"min_speed_rate": 0.95,
"params": {"min_speed_rate": 0.95,
"max_speed_rate": 1.05},
"max_speed_rate": 1.05},
"prob"
:
0
.
0
"prob": 0.
5
},
},
{
{
"type": "shift",
"type": "shift",
...
@@ -24,4 +29,11 @@
...
@@ -24,4 +29,11 @@
"max_gain_dBFS": 10},
"max_gain_dBFS": 10},
"prob": 0.0
"prob": 0.0
},
},
{
"type": "bayesian_normal",
"params": {"target_db": -20,
"prior_db": -20,
"prior_samples": 100},
"prob": 0.0
}
]
]
data_utils/augmentor/augmentation.py
浏览文件 @
1b787411
...
@@ -30,7 +30,7 @@ class AugmentationPipeline(object):
...
@@ -30,7 +30,7 @@ class AugmentationPipeline(object):
"type": "noise",
"type": "noise",
"params": {"min_snr_dB": 10,
"params": {"min_snr_dB": 10,
"max_snr_dB": 20,
"max_snr_dB": 20,
"noise_manifest": "datasets/manifest.noise"},
"noise_manifest
_path
": "datasets/manifest.noise"},
"prob": 0.0
"prob": 0.0
},
},
{
{
...
...
data_utils/augmentor/impulse_response.py
浏览文件 @
1b787411
...
@@ -13,13 +13,14 @@ class ImpulseResponseAugmentor(AugmentorBase):
...
@@ -13,13 +13,14 @@ class ImpulseResponseAugmentor(AugmentorBase):
:param rng: Random generator object.
:param rng: Random generator object.
:type rng: random.Random
:type rng: random.Random
:param impulse_manifest: Manifest path for impulse audio data.
:param impulse_manifest
_path
: Manifest path for impulse audio data.
:type impulse_manifest: basestring
:type impulse_manifest
_path
: basestring
"""
"""
def
__init__
(
self
,
rng
,
impulse_manifest
):
def
__init__
(
self
,
rng
,
impulse_manifest
_path
):
self
.
_rng
=
rng
self
.
_rng
=
rng
self
.
_manifest
=
utils
.
read_manifest
(
manifest_path
=
impulse_manifest
)
self
.
_impulse_manifest
=
utils
.
read_manifest
(
manifest_path
=
impulse_manifest_path
)
def
transform_audio
(
self
,
audio_segment
):
def
transform_audio
(
self
,
audio_segment
):
"""Add impulse response effect.
"""Add impulse response effect.
...
@@ -29,6 +30,6 @@ class ImpulseResponseAugmentor(AugmentorBase):
...
@@ -29,6 +30,6 @@ class ImpulseResponseAugmentor(AugmentorBase):
:param audio_segment: Audio segment to add effects to.
:param audio_segment: Audio segment to add effects to.
:type audio_segment: AudioSegmenet|SpeechSegment
:type audio_segment: AudioSegmenet|SpeechSegment
"""
"""
noise_json
=
self
.
_rng
.
sample
(
self
.
_manifest
,
1
)[
0
]
impulse_json
=
self
.
_rng
.
sample
(
self
.
_impulse
_manifest
,
1
)[
0
]
noise_segment
=
AudioSegment
.
from_file
(
noi
se_json
[
'audio_filepath'
])
impulse_segment
=
AudioSegment
.
from_file
(
impul
se_json
[
'audio_filepath'
])
audio_segment
.
convolve
(
noi
se_segment
,
allow_resample
=
True
)
audio_segment
.
convolve
(
impul
se_segment
,
allow_resample
=
True
)
data_utils/augmentor/noise_perturb.py
浏览文件 @
1b787411
...
@@ -17,15 +17,16 @@ class NoisePerturbAugmentor(AugmentorBase):
...
@@ -17,15 +17,16 @@ class NoisePerturbAugmentor(AugmentorBase):
:type min_snr_dB: float
:type min_snr_dB: float
:param max_snr_dB: Maximal signal noise ratio, in decibels.
:param max_snr_dB: Maximal signal noise ratio, in decibels.
:type max_snr_dB: float
:type max_snr_dB: float
:param noise_manifest: Manifest path for noise audio data.
:param noise_manifest
_path
: Manifest path for noise audio data.
:type noise_manifest: basestring
:type noise_manifest
_path
: basestring
"""
"""
def
__init__
(
self
,
rng
,
min_snr_dB
,
max_snr_dB
,
noise_manifest
):
def
__init__
(
self
,
rng
,
min_snr_dB
,
max_snr_dB
,
noise_manifest
_path
):
self
.
_min_snr_dB
=
min_snr_dB
self
.
_min_snr_dB
=
min_snr_dB
self
.
_max_snr_dB
=
max_snr_dB
self
.
_max_snr_dB
=
max_snr_dB
self
.
_rng
=
rng
self
.
_rng
=
rng
self
.
_manifest
=
utils
.
read_manifest
(
manifest_path
=
noise_manifest
)
self
.
_noise_manifest
=
utils
.
read_manifest
(
manifest_path
=
noise_manifest_path
)
def
transform_audio
(
self
,
audio_segment
):
def
transform_audio
(
self
,
audio_segment
):
"""Add background noise audio.
"""Add background noise audio.
...
@@ -35,7 +36,7 @@ class NoisePerturbAugmentor(AugmentorBase):
...
@@ -35,7 +36,7 @@ class NoisePerturbAugmentor(AugmentorBase):
:param audio_segment: Audio segment to add effects to.
:param audio_segment: Audio segment to add effects to.
:type audio_segment: AudioSegmenet|SpeechSegment
:type audio_segment: AudioSegmenet|SpeechSegment
"""
"""
noise_json
=
self
.
_rng
.
sample
(
self
.
_manifest
,
1
)[
0
]
noise_json
=
self
.
_rng
.
sample
(
self
.
_
noise_
manifest
,
1
)[
0
]
if
noise_json
[
'duration'
]
<
audio_segment
.
duration
:
if
noise_json
[
'duration'
]
<
audio_segment
.
duration
:
raise
RuntimeError
(
"The duration of sampled noise audio is smaller "
raise
RuntimeError
(
"The duration of sampled noise audio is smaller "
"than the audio segment to add effects to."
)
"than the audio segment to add effects to."
)
...
...
datasets/run_all.sh
浏览文件 @
1b787411
...
@@ -6,17 +6,8 @@ if [ $? -ne 0 ]; then
...
@@ -6,17 +6,8 @@ if [ $? -ne 0 ]; then
fi
fi
cd
-
cd
-
cd
noise
python chime3_background.py
if
[
$?
-ne
0
]
;
then
echo
"Prepare CHiME3 background noise failed. Terminated."
exit
1
fi
cd
-
cat
librispeech/manifest.train
*
|
shuf
>
manifest.train
cat
librispeech/manifest.train
*
|
shuf
>
manifest.train
cat
librispeech/manifest.dev-clean
>
manifest.dev
cat
librispeech/manifest.dev-clean
>
manifest.dev
cat
librispeech/manifest.test-clean
>
manifest.test
cat
librispeech/manifest.test-clean
>
manifest.test
cat
noise/manifest.
*
>
manifest.noise
echo
"All done."
echo
"All done."
datasets/run_noise.sh
0 → 100644
浏览文件 @
1b787411
cd
noise
python chime3_background.py
if
[
$?
-ne
0
]
;
then
echo
"Prepare CHiME3 background noise failed. Terminated."
exit
1
fi
cd
-
cat
noise/manifest.
*
>
manifest.noise
echo
"All done."
train.py
浏览文件 @
1b787411
...
@@ -123,7 +123,7 @@ parser.add_argument(
...
@@ -123,7 +123,7 @@ parser.add_argument(
help
=
"Directory for saving models. (default: %(default)s)"
)
help
=
"Directory for saving models. (default: %(default)s)"
)
parser
.
add_argument
(
parser
.
add_argument
(
"--augmentation_config"
,
"--augmentation_config"
,
default
=
open
(
'augmentation.config'
,
'r'
).
read
(),
default
=
open
(
'
conf/
augmentation.config'
,
'r'
).
read
(),
type
=
str
,
type
=
str
,
help
=
"Augmentation configuration in json-format. "
help
=
"Augmentation configuration in json-format. "
"(default: %(default)s)"
)
"(default: %(default)s)"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录