littlebot
Published on 2025-04-08 / 0 Visits
0

【源码】基于TensorFlow Lite Micro的语音识别系统

项目简介

本项目是基于TensorFlow Lite Micro框架的语音识别系统,可识别“yes”和“no”两个关键词。系统通过麦克风监听环境声音,检测到特定关键词时通过LED或屏幕显示反馈。它设计紧凑,适合如STM32F103等资源受限的嵌入式设备。

项目的主要特性和功能

  • 关键词识别:精准识别“yes”和“no”两个关键词。
  • 低资源消耗:仅占用约22KB的Flash存储和10KB的RAM,能在资源受限设备上运行。
  • 多平台支持:支持ARC、ESP32、STM32F746、NXP FRDM K66F、CEVA BX1/SP500等多种硬件平台。
  • 自定义模型训练:允许用户训练自己的语音识别模型。
  • 开发机测试:可在macOS和Linux开发机上运行和测试。

安装使用步骤

1. 环境准备

根据目标平台选择相应的开发环境: - ARC:安装ARC EM SDP或ARC VPX处理器相关的工具链。 - ESP32:安装ESP IDF工具链。 - STM32F746:安装ARM Mbed CLI工具链。 - NXP FRDM K66F:安装ARM Mbed CLI工具链。 - CEVA BX1/SP500:安装CEVA Toolbox。 - macOS/Linux开发机:确保系统已安装C语言编译器。

2. 生成项目

根据目标平台生成项目: - ARCbash make -f tensorflow/lite/micro/tools/make/Makefile TARGET=arc_emsdp ARC_TAGS=reduce_codesize OPTIMIZED_KERNEL_DIR=arc_mli generate_micro_speech_mock_make_project - ESP32bash make -f tensorflow/lite/micro/tools/make/Makefile TARGET=esp generate_micro_speech_esp_project - STM32F746bash make -f tensorflow/lite/micro/tools/make/Makefile TARGET=disco_f746ng OPTIMIZED_KERNEL_DIR=cmsis_nn generate_micro_speech_mbed_project - NXP FRDM K66Fbash make -f tensorflow/lite/micro/tools/make/Makefile TARGET=mbed TAGS="nxp_k66f" generate_micro_speech_mbed_project - CEVA BX1/SP500bash make -f tensorflow/lite/micro/tools/make/Makefile TARGET=ceva TARGET_ARCH=CEVA_BX1 generate_micro_speech_make_project - macOS/Linux开发机bash make -f tensorflow/lite/micro/tools/make/Makefile micro_speech

3. 编译和运行

根据生成的项目目录,使用相应的工具链进行编译和运行: - ARCbash cd tensorflow/lite/micro/tools/make/gen/arc_emsdp_arc_default/prj/micro_speech_mock/make make app make run - ESP32bash cd tensorflow/lite/micro/tools/make/gen/esp_xtensa-esp32/prj/micro_speech/esp-idf idf.py build idf.py --port /dev/ttyUSB0 flash monitor - STM32F746bash cd tensorflow/lite/micro/tools/make/gen/disco_f746ng_cortex-m4_default/prj/micro_speech/mbed mbed compile -m DISCO_F746NG -t GCC_ARM cp ./BUILD/DISCO_F746NG/GCC_ARM/mbed.bin /Volumes/DIS_F746NG/ - NXP FRDM K66Fbash cd tensorflow/lite/micro/tools/make/gen/mbed_cortex-m4/prj/micro_speech/mbed mbed compile -m K66F -t GCC_ARM --flash - CEVA BX1/SP500bash cd tensorflow/lite/micro/tools/make/gen/ceva_bx1/prj/micro_speech/make make - macOS/Linux开发机bash tensorflow/lite/micro/tools/make/gen/osx_x86_64/bin/micro_speech

4. 测试和验证

运行生成的可执行文件,进行语音识别测试,验证系统的功能和性能。通过麦克风输入“yes”和“no”,观察系统输出是否正确识别。

5. 自定义模型训练

如果需要训练自己的语音识别模型,请参考项目中的train/目录,按照提供的步骤进行模型训练。

下载地址

点击下载 【提取码: 4003】【解压密码: www.makuang.net】