README.md 3.49 KB
Newer Older
shihm's avatar
shihm committed
1
2
## FSMN语音端点检测-中文-通用-16k
## 论文
shihm's avatar
uodata  
shihm committed
3
https://arxiv.org/abs/1803.05030
shihm's avatar
shihm committed
4
5
6
7
8
9
10
11
12

## 模型简介
FSMN-Monophone VAD是达摩院语音团队提出的高效语音端点检测模型,用于检测输入音频中有效语音的起止时间点信息,并将检测出来的有效音频片段输入识别引擎进行识别,减少无效语音带来的识别错误。
<div align=center>
    <img src=".fig/struct.png" alt="VAD模型结构"  width="500" />
</div>
SMN-Monophone VAD模型结构如上图所示:模型结构层面,FSMN模型结构建模时可考虑上下文信息,训练和推理速度快,且时延可控;同时根据VAD模型size以及低时延的要求,对FSMN的网络结构、右看帧数进行了适配。在建模单元层面,speech信息比较丰富,仅用单类来表征学习能力有限,我们将单一speech类升级为Monophone。建模单元细分,可以避免参数平均,抽象学习能力增强,区分性更好。

### Highlight
shihm's avatar
shihm committed
13
14
15
16
17
- 16k中文通用VAD模型:可用于检测长语音片段中有效语音的起止时间点。
  - 基于[Paraformer-large长音频模型](https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch/summary)场景的使用
  - 基于[FunASR框架](https://github.com/alibaba-damo-academy/FunASR),可进行ASR,VAD,[中文标点](https://www.modelscope.cn/models/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/summary)的自由组合
  - 基于音频数据的有效语音片段起止时间点检测

shihm's avatar
shihm committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## 环境依赖
| 软件 | 版本 |
| :------: | :------: |
|     DTK      |  25.04.2  |
|    python    |  3.10.12  |
| transformers |  4.57.1  |
|    torch     | 2.5.1+das.opt1.dtk25042 |
|     vllm     | 0.9.2+das.opt1.dtk25042 |

推荐使用镜像:image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.5.1-ubuntu22.04-dtk25.04.2-py3.10

- 挂载地址`-v`根据实际模型修改

```bash
docker run -it \
    --shm-size 200g \
    --network=host \
    --name FSMN-Monophone \
    --privileged \
    --device=/dev/kfd 
    --device=/dev/dri \
    --device=/dev/mkfd \
    --group-add video \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    -u root \
    -v /opt/hyhal/:/opt/hyhal/:ro \
    -v /path/your_code_data/:/path/your_code_data/ \
    image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.5.1-ubuntu22.04-dtk25.04.2-py3.10 bash

```    
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。

关于本项目DCU显卡所需的特殊深度学习库开从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,其它包参考requirements.txt安装:
```bash
pip install -u funasr
source fastpt –E
```
shihm's avatar
shihm committed
56
57


shihm's avatar
shihm committed
58
59
60
61
62
## 数据集
`暂无`
## 训练
`暂无`
## 推理
shihm's avatar
shihm committed
63

shihm's avatar
shihm committed
64
65
66
67
### 基于FunASR进行推理
```bash
funasr ++model=paraformer-zh ++input=/example/vad_example.wav
```
shihm's avatar
shihm committed
68

shihm's avatar
shihm committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
### python示例
```bash
from funasr import AutoModel
# paraformer-zh is a multi-functional asr model
# use vad, punc, spk or not as you need
model = AutoModel(model="paraformer-zh", model_revision="v2.0.4",
                  vad_model="fsmn-vad", vad_model_revision="v2.0.4",
                  punc_model="ct-punc-c", punc_model_revision="v2.0.4",
                  # spk_model="cam++", spk_model_revision="v2.0.2",
                  )
res = model.generate(input=f"{model.model_path}/example/vad_example.wav", 
            batch_size_s=300, 
            hotword='魔搭')
print(res)
```


## 效果展示

<div align=center>
    <img src="./example/ex.png"/>
</div>

## 精度


shihm's avatar
shihm committed
95
96