Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
9b5f7f71
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
9 个月 前同步成功
通知
200
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9b5f7f71
编写于
4月 07, 2022
作者:
X
xiongxinlei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add part ecapa-tdnn note, test=doc
上级
83310b63
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
0 deletion
+50
-0
demos/speaker_verification/README.md
demos/speaker_verification/README.md
+2
-0
demos/speaker_verification/README_cn.md
demos/speaker_verification/README_cn.md
+2
-0
paddlespeech/vector/models/ecapa_tdnn.py
paddlespeech/vector/models/ecapa_tdnn.py
+46
-0
未找到文件。
demos/speaker_verification/README.md
浏览文件 @
9b5f7f71
...
...
@@ -117,6 +117,8 @@ wget -c https://paddlespeech.bj.bcebos.com/vector/audio/85236145389.wav
audio_file
=
'./123456789.wav'
,
device
=
paddle
.
get_device
())
print
(
'Test embedding Result:
\n
{}'
.
format
(
test_emb
))
# score range [0, 1]
score
=
vector_executor
.
get_embeddings_score
(
audio_emb
,
test_emb
)
print
(
f
"Eembeddings Score:
{
score
}
"
)
```
...
...
demos/speaker_verification/README_cn.md
浏览文件 @
9b5f7f71
...
...
@@ -115,6 +115,8 @@ wget -c https://paddlespeech.bj.bcebos.com/vector/audio/85236145389.wav
audio_file
=
'./123456789.wav'
,
device
=
paddle
.
get_device
())
print
(
'Test embedding Result:
\n
{}'
.
format
(
test_emb
))
# score range [0, 1]
score
=
vector_executor
.
get_embeddings_score
(
audio_emb
,
test_emb
)
print
(
f
"Eembeddings Score:
{
score
}
"
)
```
...
...
paddlespeech/vector/models/ecapa_tdnn.py
浏览文件 @
9b5f7f71
...
...
@@ -79,6 +79,20 @@ class Conv1d(nn.Layer):
bias_attr
=
bias
,
)
def
forward
(
self
,
x
):
"""Do conv1d forward
Args:
x (paddle.Tensor): [N, C, L] input data,
N is the batch,
C is the data dimension,
L is the time
Raises:
ValueError: only support the same padding type
Returns:
paddle.Tensor: the value of conv1d
"""
if
self
.
padding
==
"same"
:
x
=
self
.
_manage_padding
(
x
,
self
.
kernel_size
,
self
.
dilation
,
self
.
stride
)
...
...
@@ -88,6 +102,20 @@ class Conv1d(nn.Layer):
return
self
.
conv
(
x
)
def
_manage_padding
(
self
,
x
,
kernel_size
:
int
,
dilation
:
int
,
stride
:
int
):
"""Padding the input data
Args:
x (paddle.Tensor): [N, C, L] input data
N is the batch,
C is the data dimension,
L is the time
kernel_size (int): 1-d convolution kernel size
dilation (int): 1-d convolution dilation
stride (int): 1-d convolution stride
Returns:
paddle.Tensor: the padded input data
"""
L_in
=
x
.
shape
[
-
1
]
# Detecting input shape
padding
=
self
.
_get_padding_elem
(
L_in
,
stride
,
kernel_size
,
dilation
)
# Time padding
...
...
@@ -101,6 +129,17 @@ class Conv1d(nn.Layer):
stride
:
int
,
kernel_size
:
int
,
dilation
:
int
):
"""Calculate the padding value in same mode
Args:
L_in (int): the times of the input data,
stride (int): 1-d convolution stride
kernel_size (int): 1-d convolution kernel size
dilation (int): 1-d convolution stride
Returns:
int: return the padding value in same mode
"""
if
stride
>
1
:
n_steps
=
math
.
ceil
(((
L_in
-
kernel_size
*
dilation
)
/
stride
)
+
1
)
L_out
=
stride
*
(
n_steps
-
1
)
+
kernel_size
*
dilation
...
...
@@ -245,6 +284,13 @@ class SEBlock(nn.Layer):
class
AttentiveStatisticsPooling
(
nn
.
Layer
):
def
__init__
(
self
,
channels
,
attention_channels
=
128
,
global_context
=
True
):
"""Compute the speaker verification statistics
The detail info is section 3.1 in https://arxiv.org/pdf/1709.01507.pdf
Args:
channels (int): input data channel or data dimension
attention_channels (int, optional): attention dimension. Defaults to 128.
global_context (bool, optional): If use the global context information. Defaults to True.
"""
super
().
__init__
()
self
.
eps
=
1e-12
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录