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