Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
8522b829
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看板
提交
8522b829
编写于
5月 06, 2022
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format
上级
5d5266ab
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
62 addition
and
30 deletion
+62
-30
demos/streaming_asr_server/README.md
demos/streaming_asr_server/README.md
+1
-1
demos/streaming_asr_server/README_cn.md
demos/streaming_asr_server/README_cn.md
+1
-1
paddlespeech/cli/vector/infer.py
paddlespeech/cli/vector/infer.py
+3
-1
paddlespeech/server/README_cn.md
paddlespeech/server/README_cn.md
+1
-1
paddlespeech/server/engine/vector/__init__.py
paddlespeech/server/engine/vector/__init__.py
+13
-0
paddlespeech/server/engine/vector/python/__init__.py
paddlespeech/server/engine/vector/python/__init__.py
+13
-0
paddlespeech/server/engine/vector/python/vector_engine.py
paddlespeech/server/engine/vector/python/vector_engine.py
+1
-1
speechx/examples/ds2_ol/decoder/recognizer_test_main.cc
speechx/examples/ds2_ol/decoder/recognizer_test_main.cc
+1
-1
speechx/speechx/decoder/param.h
speechx/speechx/decoder/param.h
+13
-12
speechx/speechx/frontend/audio/fbank.cc
speechx/speechx/frontend/audio/fbank.cc
+7
-4
speechx/speechx/frontend/audio/feature_pipeline.cc
speechx/speechx/frontend/audio/feature_pipeline.cc
+5
-5
speechx/speechx/frontend/audio/feature_pipeline.h
speechx/speechx/frontend/audio/feature_pipeline.h
+3
-3
未找到文件。
demos/streaming_asr_server/README.md
浏览文件 @
8522b829
...
@@ -630,4 +630,4 @@ bash server.sh
...
@@ -630,4 +630,4 @@ bash server.sh
[2022-05-02 18:29:26,566] [ INFO] - asr websocket client finished : 我认为跑步最重要的就是给我带来了身体健康。
[2022-05-02 18:29:26,566] [ INFO] - asr websocket client finished : 我认为跑步最重要的就是给我带来了身体健康。
```
```
\ No newline at end of file
demos/streaming_asr_server/README_cn.md
浏览文件 @
8522b829
...
@@ -638,4 +638,4 @@ bash server.sh
...
@@ -638,4 +638,4 @@ bash server.sh
[2022-05-02 18:29:26,566] [ INFO] - asr websocket client finished : 我认为跑步最重要的就是给我带来了身体健康。
[2022-05-02 18:29:26,566] [ INFO] - asr websocket client finished : 我认为跑步最重要的就是给我带来了身体健康。
```
```
\ No newline at end of file
paddlespeech/cli/vector/infer.py
浏览文件 @
8522b829
...
@@ -437,7 +437,9 @@ class VectorExecutor(BaseExecutor):
...
@@ -437,7 +437,9 @@ class VectorExecutor(BaseExecutor):
if
self
.
sample_rate
!=
16000
and
self
.
sample_rate
!=
8000
:
if
self
.
sample_rate
!=
16000
and
self
.
sample_rate
!=
8000
:
logger
.
error
(
logger
.
error
(
"invalid sample rate, please input --sr 8000 or --sr 16000"
)
"invalid sample rate, please input --sr 8000 or --sr 16000"
)
logger
.
error
(
f
"The model sample rate:
{
self
.
sample_rate
}
, the external sample rate is:
{
sample_rate
}
"
)
logger
.
error
(
f
"The model sample rate:
{
self
.
sample_rate
}
, the external sample rate is:
{
sample_rate
}
"
)
return
False
return
False
if
isinstance
(
audio_file
,
(
str
,
os
.
PathLike
)):
if
isinstance
(
audio_file
,
(
str
,
os
.
PathLike
)):
...
...
paddlespeech/server/README_cn.md
浏览文件 @
8522b829
...
@@ -82,4 +82,4 @@ paddlespeech_client vector --task spk --server_ip 127.0.0.1 --port 8090 --input
...
@@ -82,4 +82,4 @@ paddlespeech_client vector --task spk --server_ip 127.0.0.1 --port 8090 --input
```
```
paddlespeech_client vector --task score --server_ip 127.0.0.1 --port 8090 --enroll 123456789.wav --test 85236145389.wav
paddlespeech_client vector --task score --server_ip 127.0.0.1 --port 8090 --enroll 123456789.wav --test 85236145389.wav
```
```
\ No newline at end of file
paddlespeech/server/engine/vector/__init__.py
浏览文件 @
8522b829
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
paddlespeech/server/engine/vector/python/__init__.py
浏览文件 @
8522b829
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
paddlespeech/server/engine/vector/python/vector_engine.py
浏览文件 @
8522b829
...
@@ -16,9 +16,9 @@ from collections import OrderedDict
...
@@ -16,9 +16,9 @@ from collections import OrderedDict
import
numpy
as
np
import
numpy
as
np
import
paddle
import
paddle
from
paddleaudio.backends
import
load
as
load_audio
from
paddleaudio.backends
import
load
as
load_audio
from
paddleaudio.compliance.librosa
import
melspectrogram
from
paddleaudio.compliance.librosa
import
melspectrogram
from
paddlespeech.cli.log
import
logger
from
paddlespeech.cli.log
import
logger
from
paddlespeech.cli.vector.infer
import
VectorExecutor
from
paddlespeech.cli.vector.infer
import
VectorExecutor
from
paddlespeech.server.engine.base_engine
import
BaseEngine
from
paddlespeech.server.engine.base_engine
import
BaseEngine
...
...
speechx/examples/ds2_ol/decoder/recognizer_test_main.cc
浏览文件 @
8522b829
...
@@ -31,7 +31,7 @@ int main(int argc, char* argv[]) {
...
@@ -31,7 +31,7 @@ int main(int argc, char* argv[]) {
kaldi
::
SequentialTableReader
<
kaldi
::
WaveHolder
>
wav_reader
(
kaldi
::
SequentialTableReader
<
kaldi
::
WaveHolder
>
wav_reader
(
FLAGS_wav_rspecifier
);
FLAGS_wav_rspecifier
);
kaldi
::
TokenWriter
result_writer
(
FLAGS_result_wspecifier
);
kaldi
::
TokenWriter
result_writer
(
FLAGS_result_wspecifier
);
int
sample_rate
=
FLAGS_sample_rate
;
int
sample_rate
=
FLAGS_sample_rate
;
float
streaming_chunk
=
FLAGS_streaming_chunk
;
float
streaming_chunk
=
FLAGS_streaming_chunk
;
int
chunk_sample_size
=
streaming_chunk
*
sample_rate
;
int
chunk_sample_size
=
streaming_chunk
*
sample_rate
;
...
...
speechx/speechx/decoder/param.h
浏览文件 @
8522b829
...
@@ -21,7 +21,8 @@
...
@@ -21,7 +21,8 @@
// feature
// feature
DEFINE_bool
(
use_fbank
,
false
,
"False for fbank; or linear feature"
);
DEFINE_bool
(
use_fbank
,
false
,
"False for fbank; or linear feature"
);
// DEFINE_bool(to_float32, true, "audio convert to pcm32. True for linear feature, or fbank");
// DEFINE_bool(to_float32, true, "audio convert to pcm32. True for linear
// feature, or fbank");
DEFINE_int32
(
num_bins
,
161
,
"num bins of mel"
);
DEFINE_int32
(
num_bins
,
161
,
"num bins of mel"
);
DEFINE_string
(
cmvn_file
,
""
,
"read cmvn"
);
DEFINE_string
(
cmvn_file
,
""
,
"read cmvn"
);
DEFINE_double
(
streaming_chunk
,
0.1
,
"streaming feature chunk size"
);
DEFINE_double
(
streaming_chunk
,
0.1
,
"streaming feature chunk size"
);
...
@@ -67,18 +68,18 @@ FeaturePipelineOptions InitFeaturePipelineOptions() {
...
@@ -67,18 +68,18 @@ FeaturePipelineOptions InitFeaturePipelineOptions() {
frame_opts
.
frame_shift_ms
=
10
;
frame_opts
.
frame_shift_ms
=
10
;
opts
.
use_fbank
=
FLAGS_use_fbank
;
opts
.
use_fbank
=
FLAGS_use_fbank
;
if
(
opts
.
use_fbank
)
{
if
(
opts
.
use_fbank
)
{
opts
.
to_float32
=
false
;
opts
.
to_float32
=
false
;
frame_opts
.
window_type
=
"povey"
;
frame_opts
.
window_type
=
"povey"
;
frame_opts
.
frame_length_ms
=
25
;
frame_opts
.
frame_length_ms
=
25
;
opts
.
fbank_opts
.
fbank_opts
.
mel_opts
.
num_bins
=
FLAGS_num_bins
;
opts
.
fbank_opts
.
fbank_opts
.
mel_opts
.
num_bins
=
FLAGS_num_bins
;
opts
.
fbank_opts
.
fbank_opts
.
frame_opts
=
frame_opts
;
opts
.
fbank_opts
.
fbank_opts
.
frame_opts
=
frame_opts
;
}
else
{
}
else
{
opts
.
to_float32
=
true
;
opts
.
to_float32
=
true
;
frame_opts
.
remove_dc_offset
=
false
;
frame_opts
.
remove_dc_offset
=
false
;
frame_opts
.
frame_length_ms
=
20
;
frame_opts
.
frame_length_ms
=
20
;
frame_opts
.
window_type
=
"hanning"
;
frame_opts
.
window_type
=
"hanning"
;
frame_opts
.
preemph_coeff
=
0.0
;
frame_opts
.
preemph_coeff
=
0.0
;
opts
.
linear_spectrogram_opts
.
frame_opts
=
frame_opts
;
opts
.
linear_spectrogram_opts
.
frame_opts
=
frame_opts
;
}
}
opts
.
feature_cache_opts
.
frame_chunk_size
=
FLAGS_receptive_field_length
;
opts
.
feature_cache_opts
.
frame_chunk_size
=
FLAGS_receptive_field_length
;
opts
.
feature_cache_opts
.
frame_chunk_stride
=
FLAGS_downsampling_rate
;
opts
.
feature_cache_opts
.
frame_chunk_stride
=
FLAGS_downsampling_rate
;
...
...
speechx/speechx/frontend/audio/fbank.cc
浏览文件 @
8522b829
...
@@ -102,13 +102,16 @@ bool Fbank::Compute(const Vector<BaseFloat>& waves, Vector<BaseFloat>* feats) {
...
@@ -102,13 +102,16 @@ bool Fbank::Compute(const Vector<BaseFloat>& waves, Vector<BaseFloat>* feats) {
// note: this online feature-extraction code does not support VTLN.
// note: this online feature-extraction code does not support VTLN.
RealFft
(
&
window
,
true
);
RealFft
(
&
window
,
true
);
kaldi
::
ComputePowerSpectrum
(
&
window
);
kaldi
::
ComputePowerSpectrum
(
&
window
);
const
kaldi
::
MelBanks
&
mel_bank
=
*
(
computer_
.
GetMelBanks
(
1.0
));
const
kaldi
::
MelBanks
&
mel_bank
=
*
(
computer_
.
GetMelBanks
(
1.0
));
SubVector
<
BaseFloat
>
power_spectrum
(
window
,
0
,
window
.
Dim
()
/
2
+
1
);
SubVector
<
BaseFloat
>
power_spectrum
(
window
,
0
,
window
.
Dim
()
/
2
+
1
);
if
(
!
opts_
.
fbank_opts
.
use_power
)
{
if
(
!
opts_
.
fbank_opts
.
use_power
)
{
power_spectrum
.
ApplyPow
(
0.5
);
power_spectrum
.
ApplyPow
(
0.5
);
}
}
int32
mel_offset
=
((
opts_
.
fbank_opts
.
use_energy
&&
!
opts_
.
fbank_opts
.
htk_compat
)
?
1
:
0
);
int32
mel_offset
=
SubVector
<
BaseFloat
>
mel_energies
(
this_feature
,
mel_offset
,
opts_
.
fbank_opts
.
mel_opts
.
num_bins
);
((
opts_
.
fbank_opts
.
use_energy
&&
!
opts_
.
fbank_opts
.
htk_compat
)
?
1
:
0
);
SubVector
<
BaseFloat
>
mel_energies
(
this_feature
,
mel_offset
,
opts_
.
fbank_opts
.
mel_opts
.
num_bins
);
mel_bank
.
Compute
(
power_spectrum
,
&
mel_energies
);
mel_bank
.
Compute
(
power_spectrum
,
&
mel_energies
);
mel_energies
.
ApplyFloor
(
1e-07
);
mel_energies
.
ApplyFloor
(
1e-07
);
mel_energies
.
ApplyLog
();
mel_energies
.
ApplyLog
();
...
...
speechx/speechx/frontend/audio/feature_pipeline.cc
浏览文件 @
8522b829
...
@@ -23,13 +23,13 @@ FeaturePipeline::FeaturePipeline(const FeaturePipelineOptions& opts) {
...
@@ -23,13 +23,13 @@ FeaturePipeline::FeaturePipeline(const FeaturePipelineOptions& opts) {
new
ppspeech
::
AudioCache
(
1000
*
kint16max
,
opts
.
to_float32
));
new
ppspeech
::
AudioCache
(
1000
*
kint16max
,
opts
.
to_float32
));
unique_ptr
<
FrontendInterface
>
base_feature
;
unique_ptr
<
FrontendInterface
>
base_feature
;
if
(
opts
.
use_fbank
)
{
if
(
opts
.
use_fbank
)
{
base_feature
.
reset
(
new
ppspeech
::
Fbank
(
opts
.
fbank_opts
,
base_feature
.
reset
(
std
::
move
(
data_source
)));
new
ppspeech
::
Fbank
(
opts
.
fbank_opts
,
std
::
move
(
data_source
)));
}
else
{
}
else
{
base_feature
.
reset
(
new
ppspeech
::
LinearSpectrogram
(
opts
.
linear_spectrogram_opts
,
base_feature
.
reset
(
new
ppspeech
::
LinearSpectrogram
(
std
::
move
(
data_source
)));
opts
.
linear_spectrogram_opts
,
std
::
move
(
data_source
)));
}
}
unique_ptr
<
FrontendInterface
>
cmvn
(
unique_ptr
<
FrontendInterface
>
cmvn
(
...
...
speechx/speechx/frontend/audio/feature_pipeline.h
浏览文件 @
8522b829
...
@@ -18,24 +18,24 @@
...
@@ -18,24 +18,24 @@
#include "frontend/audio/audio_cache.h"
#include "frontend/audio/audio_cache.h"
#include "frontend/audio/data_cache.h"
#include "frontend/audio/data_cache.h"
#include "frontend/audio/fbank.h"
#include "frontend/audio/feature_cache.h"
#include "frontend/audio/feature_cache.h"
#include "frontend/audio/frontend_itf.h"
#include "frontend/audio/frontend_itf.h"
#include "frontend/audio/linear_spectrogram.h"
#include "frontend/audio/linear_spectrogram.h"
#include "frontend/audio/fbank.h"
#include "frontend/audio/normalizer.h"
#include "frontend/audio/normalizer.h"
namespace
ppspeech
{
namespace
ppspeech
{
struct
FeaturePipelineOptions
{
struct
FeaturePipelineOptions
{
std
::
string
cmvn_file
;
std
::
string
cmvn_file
;
bool
to_float32
;
// true, only for linear feature
bool
to_float32
;
// true, only for linear feature
bool
use_fbank
;
bool
use_fbank
;
LinearSpectrogramOptions
linear_spectrogram_opts
;
LinearSpectrogramOptions
linear_spectrogram_opts
;
FbankOptions
fbank_opts
;
FbankOptions
fbank_opts
;
FeatureCacheOptions
feature_cache_opts
;
FeatureCacheOptions
feature_cache_opts
;
FeaturePipelineOptions
()
FeaturePipelineOptions
()
:
cmvn_file
(
""
),
:
cmvn_file
(
""
),
to_float32
(
false
),
// true, only for linear feature
to_float32
(
false
),
// true, only for linear feature
use_fbank
(
true
),
use_fbank
(
true
),
linear_spectrogram_opts
(),
linear_spectrogram_opts
(),
fbank_opts
(),
fbank_opts
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录