Skip to content

esp32s3平台287k参数量的dstcn模型,推理做不到实时 (AIS-2062) #252

@yushanyong

Description

@yushanyong

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

希望能指明方向:基于什么样的技术路线集成自定义的唤醒模型到esp32s3上

Actual behavior (suspected bug)

项目需要在esp32s3上跑自定义的唤醒模型,当前是基于dstcn来实现的,尝试了两版模型:
V1:
参数:287k (num_layers: 4, kernel_size: 8, hidden_dim: 256)
特征: mfcc, dim: 40, width: 25, shift: 10
V2:
参数:59k (num_layers: 3, kernel_size: 6, hidden_dim: 128)
特征: mfcc, dim: 40, width: 25, shift: 15

最开始尝试int8量化(基于esp-ppq),V1每帧推理耗时44ms左右,V2每帧推理耗时8.5ms左右,V1模型完全不可以,V2可以达到实时,但是59k参数量+int8量化,模型实际效果接近不可用。所以这里第一个问题是:int8量化我尝试很多配置、校准数据和不同模块的量化策略,最终量化误差都很大(V1,V2都是),以至于不可用,所以量化这步是否有什么问题。(脚本、模型和数据在附件)
后又尝试int16量化,误差可接受,但每帧推理耗时相对增加了30%左右,同时调整V2模型的shift到15ms,勉强可以实时,但是V2模型的参数量卓识有些小,效果很难调。但是我看esp-sr中的WN9模型的.data也将近有300k呢,并且模型的实时性和效果都不错,所有第二个问题是:esp-sr跟esp-dl相比是否做了一些硬件适配的推理加速(因为看到有esp-nn)?esp-dl是否也可以支持推理加速?还是说我的模型选型有问题,咱们WN9又是怎么样的模型和怎样的参数量呢

以上是自定义唤醒模型的遇到的瓶颈,希望能予以解答和指明方向。
感谢!

quant_source.zip

Error logs or terminal output

Steps to reproduce the behavior

.

Project release version

master分支

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

esp32s3

Shell

ZSH

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions