# 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 交叉编译器: ```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 | | | AX630C | | 下载并整理到 `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)