File size: 2,738 Bytes
759d0dd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 56 57 58 59 60 61 62 63 64 65 66 67 68 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | # openWakeWord.AXERA
[openWakeWord](https://github.com/dscripka/openWakeWord) 语音唤醒 AXERA 推理 demo。
## 功能
- 支持 AX650 和 AX630C;
- 支持 Python 和 C++ 板端推理;
## 目录结构
```text
OpenWakeWord.AXERA/
├── models/
│ ├── 650/ # AX650 axmodel
│ └── 630C/ # AX630C axmodel
├── config/ # STFT/mel 权重
├── audio/openwakeword/
├── scripts/ # Python 推理代码
├── cpp/ # C++ 源码、编译和运行脚本
└── README.md
```
## Python
```bash
创建虚拟环境
conda create -n OpenWakeWord python=3.10
conda activate OpenWakeWord
安装 [pyaxengine](https://github.com/AXERA-TECH/pyaxengine/releases/latest):
pip install axengine-x.x.x-py3-none-any.whl
pip install -r requirements.txt
```
AX650:
```bash
python scripts/openwakeword_ax650.py
```
AX630C:
```bash
python scripts/openwakeword_ax630c.py
```
自定义音频目录、阈值和输出文件:
```bash
python scripts/openwakeword_ax630c.py \
--audio-dir audio/openwakeword \
--threshold 0.5 \
--output outputs/openwakeword_ax630c.json
```
## C++
### 编译环境
AX650 和 AX630C 共用 Arm GNU 9.2 AArch64 交叉编译器:
<https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz>
```bash
mkdir -p cpp/toolchains
wget -P cpp/toolchains \
https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
tar -xf cpp/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz \
-C cpp/toolchains
```
BSP SDK 下载地址:
| 平台 | BSP SDK |
| --- | --- |
| AX650 | <https://github.com/ZHEQIUSHUI/assets/releases/download/ax_3.6.2/msp_50_3.10.2.zip> |
| AX630C | <https://github.com/ZHEQIUSHUI/assets/releases/download/ax_3.6.2/msp_20e_3.0.0.zip> |
下载并整理到 `cpp/toolchains/`:
```bash
bash cpp/download_bsp.sh all
```
### 交叉编译
```bash
export TOOLCHAIN_ROOT="cpp/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu"
bash cpp/build_ax650.sh
bash cpp/build_ax630c.sh
```
编译结果:
```text
cpp/bin/openwakeword_ax650
cpp/bin/openwakeword_ax630c
```
### 板端批量测试
AX650:
```bash
THRESHOLD=0.5 bash cpp/run_batch_openwakeword_ax650.sh
```
AX630C:
```bash
THRESHOLD=0.5 bash cpp/run_batch_openwakeword_ax630c.sh
```
结果分别写入 `outputs/cpp_ax650_batch/` 和 `outputs/cpp_ax630c_batch/`。
详细 C++ 说明见 `cpp/README.md`。
## 参考
- [openWakeWord](https://github.com/dscripka/openWakeWord)
- [Pulsar2](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)
|