-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# honk离线唤醒引擎在dingdang中的使用 | ||
## 1. 训练模型 | ||
### 1.1 数据格式 | ||
 训练数据格式应与Google数据指令集相同,即将文件夹以要识别的关键词命名,在文件夹内,每一个音频文件命名格式为“8位hash+\_nohash_.wav” | ||
### 1.2 训练方法 | ||
 设置训练数据路径,需要修改的文件为honk-master/utils/model.py,将该文件中default_config中data_folder修改为自己的文件夹。 | ||
 设置目标词,需要修改的文件为honk-master/utils/model.py,将该文件中default_config中wanted_words修改为自己要识别的关键词,格式为["关键词1","关键词2"]. | ||
 设置目标模型类型,加入参数--model 目标模型类型,可选的模型类型可以在utils/model.py文件中的ConfigType中查看。 | ||
 输出文件默认放置在honk-master/model文件夹下,命名为model.pt,若要自定义输出路径,则修改utils/train.py文件下main函数中output_file项 | ||
 训练CNN可以使用如下命令(使用默认的类型) | ||
`python -m utils.train --type [train|eval]` | ||
 训练RES模型推荐使用如下命令 | ||
`python -m utils.train --wanted_words yes no up down left right on off stop go --dev_every 1 --n_labels 12 --n_epochs 26 --weight_decay 0.00001 --lr 0.1 0.01 0.001 --schedule 3000 6000 --model res{8,15,26}[-narrow]` | ||
若要使用CUDA,请将utils/train.py下global_config中的no_cuda字段设置为False,并设置gpu_no为想要运行的gpu序号 | ||
## 2.使用模型 | ||
### 2.1设置config文件 | ||
 设置输入模型路径,修改model_path字段 | ||
 设置关键词,修改commands字段,要与训练模型时的关键词相同 | ||
 若使用的模型是pt后缀,则设置backend为pytorch,若使用的是onnx模型,则设置backend为caffe2 | ||
## 3.服务端运行 | ||
 在honk-master文件夹下使用命令`python3 .`,运行服务器端程序,默认端口为16888 | ||
若没有报错则服务器端正常运行 | ||
## 4.客户端运行 | ||
 由于honk引擎是植入在dingdang中的,要使用honk作为唤醒引擎时,需要设置.dingdang/profile文件下的stt_passive_engine为honk,再修改honk字段下的endpoint为运行服务端的机器ip地址 |