Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
20dcd671
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
207
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,发现更多精彩内容 >>
未验证
提交
20dcd671
编写于
4月 23, 2022
作者:
H
Hui Zhang
提交者:
GitHub
4月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1760 from qingen/database-search
[vec] bug fix to adapt VUE
上级
ba812854
e8be8bf9
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
35 addition
and
21 deletion
+35
-21
demos/audio_searching/README.md
demos/audio_searching/README.md
+7
-7
demos/audio_searching/README_cn.md
demos/audio_searching/README_cn.md
+7
-7
demos/audio_searching/src/test_vpr_search.py
demos/audio_searching/src/test_vpr_search.py
+6
-2
demos/audio_searching/src/vpr_search.py
demos/audio_searching/src/vpr_search.py
+15
-5
未找到文件。
demos/audio_searching/README.md
浏览文件 @
20dcd671
...
...
@@ -167,8 +167,8 @@ Then to start the system server, and it provides HTTP backend services.
[2022-03-26 22:54:08,633] [ INFO] - embedding size: (192,)
Extracting feature from audio No. 2 , 20 audios in total
...
2022-03-26 22:54:15,892 | INFO |
main
.py | load_audios | 85 | Successfully loaded data, total count: 20
2022-03-26 22:54:15,908 | INFO |
main
.py | count_audio | 148 | Successfully count the number of data!
2022-03-26 22:54:15,892 | INFO |
audio_search
.py | load_audios | 85 | Successfully loaded data, total count: 20
2022-03-26 22:54:15,908 | INFO |
audio_search
.py | count_audio | 148 | Successfully count the number of data!
[2022-03-26 22:54:15,916] [ INFO] - checking the aduio file format......
[2022-03-26 22:54:15,916] [ INFO] - The sample rate is 16000
[2022-03-26 22:54:15,916] [ INFO] - The audio file format is right
...
...
@@ -183,12 +183,12 @@ Then to start the system server, and it provides HTTP backend services.
[2022-03-26 22:54:15,924] [ INFO] - feats shape:[1, 80, 53], lengths shape: [1]
[2022-03-26 22:54:16,051] [ INFO] - embedding size: (192,)
...
2022-03-26 22:54:16,086 | INFO |
main
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/test.wav, score 100.0
2022-03-26 22:54:16,087 | INFO |
main
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_chopping.wav, score 29.182177782058716
2022-03-26 22:54:16,087 | INFO |
main
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_cut_into_body.wav, score 22.73637056350708
2022-03-26 22:54:16,086 | INFO |
audio_search
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/test.wav, score 100.0
2022-03-26 22:54:16,087 | INFO |
audio_search
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_chopping.wav, score 29.182177782058716
2022-03-26 22:54:16,087 | INFO |
audio_search
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_cut_into_body.wav, score 22.73637056350708
...
2022-03-26 22:54:16,088 | INFO |
main
.py | search_local_audio | 136 | Successfully searched similar audio!
2022-03-26 22:54:17,164 | INFO |
main
.py | drop_tables | 160 | Successfully drop tables in Milvus and MySQL!
2022-03-26 22:54:16,088 | INFO |
audio_search
.py | search_local_audio | 136 | Successfully searched similar audio!
2022-03-26 22:54:17,164 | INFO |
audio_search
.py | drop_tables | 160 | Successfully drop tables in Milvus and MySQL!
```
-
GUI test (Optional)
...
...
demos/audio_searching/README_cn.md
浏览文件 @
20dcd671
...
...
@@ -169,8 +169,8 @@ ffce340b3790 minio/minio:RELEASE.2020-12-03T00-03-10Z "/usr/bin/docker-ent…"
[2022-03-26 22:54:08,633] [ INFO] - embedding size: (192,)
Extracting feature from audio No. 2 , 20 audios in total
...
2022-03-26 22:54:15,892 | INFO |
main
.py | load_audios | 85 | Successfully loaded data, total count: 20
2022-03-26 22:54:15,908 | INFO |
main
.py | count_audio | 148 | Successfully count the number of data!
2022-03-26 22:54:15,892 | INFO |
audio_search
.py | load_audios | 85 | Successfully loaded data, total count: 20
2022-03-26 22:54:15,908 | INFO |
audio_search
.py | count_audio | 148 | Successfully count the number of data!
[2022-03-26 22:54:15,916] [ INFO] - checking the aduio file format......
[2022-03-26 22:54:15,916] [ INFO] - The sample rate is 16000
[2022-03-26 22:54:15,916] [ INFO] - The audio file format is right
...
...
@@ -185,12 +185,12 @@ ffce340b3790 minio/minio:RELEASE.2020-12-03T00-03-10Z "/usr/bin/docker-ent…"
[2022-03-26 22:54:15,924] [ INFO] - feats shape:[1, 80, 53], lengths shape: [1]
[2022-03-26 22:54:16,051] [ INFO] - embedding size: (192,)
...
2022-03-26 22:54:16,086 | INFO |
main
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/test.wav, score 100.0
2022-03-26 22:54:16,087 | INFO |
main
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_chopping.wav, score 29.182177782058716
2022-03-26 22:54:16,087 | INFO |
main
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_cut_into_body.wav, score 22.73637056350708
2022-03-26 22:54:16,086 | INFO |
audio_search
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/test.wav, score 100.0
2022-03-26 22:54:16,087 | INFO |
audio_search
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_chopping.wav, score 29.182177782058716
2022-03-26 22:54:16,087 | INFO |
audio_search
.py | search_local_audio | 132 | search result http://testserver/data?audio_path=./example_audio/knife_cut_into_body.wav, score 22.73637056350708
...
2022-03-26 22:54:16,088 | INFO |
main
.py | search_local_audio | 136 | Successfully searched similar audio!
2022-03-26 22:54:17,164 | INFO |
main
.py | drop_tables | 160 | Successfully drop tables in Milvus and MySQL!
2022-03-26 22:54:16,088 | INFO |
audio_search
.py | search_local_audio | 136 | Successfully searched similar audio!
2022-03-26 22:54:17,164 | INFO |
audio_search
.py | drop_tables | 160 | Successfully drop tables in Milvus and MySQL!
```
-
前端测试(可选)
...
...
demos/audio_searching/src/test_vpr_search.py
浏览文件 @
20dcd671
...
...
@@ -73,7 +73,9 @@ def test_data(spk: str):
"""
Get the audio file by spk_id in MySQL
"""
response
=
client
.
get
(
"/vpr/data?spk_id="
+
spk
)
response
=
client
.
get
(
"/vpr/data"
,
json
=
{
"spk_id"
:
spk
},
)
assert
response
.
status_code
==
200
...
...
@@ -81,7 +83,9 @@ def test_del(spk: str):
"""
Delete the record in MySQL by spk_id
"""
response
=
client
.
post
(
"/vpr/del?spk_id="
+
spk
)
response
=
client
.
post
(
"/vpr/del"
,
json
=
{
"spk_id"
:
spk
},
)
assert
response
.
status_code
==
200
...
...
demos/audio_searching/src/vpr_search.py
浏览文件 @
20dcd671
...
...
@@ -17,8 +17,8 @@ import uvicorn
from
config
import
UPLOAD_PATH
from
fastapi
import
FastAPI
from
fastapi
import
File
from
fastapi
import
Form
from
fastapi
import
UploadFile
from
logs
import
LOGGER
from
mysql_helpers
import
MySQLHelper
from
operations.count
import
do_count_vpr
from
operations.count
import
do_get
...
...
@@ -31,6 +31,8 @@ from starlette.middleware.cors import CORSMiddleware
from
starlette.requests
import
Request
from
starlette.responses
import
FileResponse
from
logs
import
LOGGER
app
=
FastAPI
()
app
.
add_middleware
(
CORSMiddleware
,
...
...
@@ -49,10 +51,12 @@ if not os.path.exists(UPLOAD_PATH):
@
app
.
post
(
'/vpr/enroll'
)
async
def
vpr_enroll
(
table_name
:
str
=
None
,
spk_id
:
str
=
None
,
spk_id
:
str
=
Form
(...)
,
audio
:
UploadFile
=
File
(...)):
# Enroll the uploaded audio with spk-id into MySQL
try
:
if
not
spk_id
:
return
{
'status'
:
False
,
'msg'
:
"spk_id can not be None"
}
# Save the upload data to server.
content
=
await
audio
.
read
()
audio_path
=
os
.
path
.
join
(
UPLOAD_PATH
,
audio
.
filename
)
...
...
@@ -63,7 +67,7 @@ async def vpr_enroll(table_name: str=None,
return
{
'status'
:
True
,
'msg'
:
"Successfully enroll data!"
}
except
Exception
as
e
:
LOGGER
.
error
(
e
)
return
{
'status'
:
False
,
'msg'
:
e
}
,
400
return
{
'status'
:
False
,
'msg'
:
e
}
@
app
.
post
(
'/vpr/enroll/local'
)
...
...
@@ -128,9 +132,12 @@ async def vpr_recog_local(request: Request,
@
app
.
post
(
'/vpr/del'
)
async
def
vpr_del
(
table_name
:
str
=
None
,
spk_id
:
str
=
None
):
async
def
vpr_del
(
table_name
:
str
=
None
,
spk_id
:
dict
=
None
):
# Delete a record by spk_id in MySQL
try
:
spk_id
=
spk_id
[
'spk_id'
]
if
not
spk_id
:
return
{
'status'
:
False
,
'msg'
:
"spk_id can not be None"
}
do_delete
(
table_name
,
spk_id
,
MYSQL_CLI
)
LOGGER
.
info
(
"Successfully delete a record by spk_id in MySQL"
)
return
{
'status'
:
True
,
'msg'
:
"Successfully delete data!"
}
...
...
@@ -156,9 +163,12 @@ async def vpr_list(table_name: str=None):
@
app
.
get
(
'/vpr/data'
)
async
def
vpr_data
(
table_name
:
str
=
None
,
spk_id
:
str
=
None
,
):
spk_id
:
dict
=
None
,
):
# Get the audio file from path by spk_id in MySQL
try
:
spk_id
=
spk_id
[
'spk_id'
]
if
not
spk_id
:
return
{
'status'
:
False
,
'msg'
:
"spk_id can not be None"
}
audio_path
=
do_get
(
table_name
,
spk_id
,
MYSQL_CLI
)
LOGGER
.
info
(
f
"Successfully get audio path
{
audio_path
}
!"
)
return
FileResponse
(
audio_path
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录