[论文解读] Tiny Transformers for Environmental Sound Classification at the Edge
该论文提出了一种高度高效、基于 BERT 的 Transformer 模型,用于在边缘设备上进行环境声音分类,采用梅尔频谱图和自监督预训练。在 Office Sounds 数据集上进行训练,该模型仅使用 6,642 个参数,即比同类卷积神经网络(CNN)小 99.85%,同时实现了最先进水平的准确率,并可在移动设备和微控制器平台上实现实时推理。
With the growth of the Internet of Things and the rise of Big Data, data processing and machine learning applications are being moved to cheap and low size, weight, and power (SWaP) devices at the edge, often in the form of mobile phones, embedded systems, or microcontrollers. The field of Cyber-Physical Measurements and Signature Intelligence (MASINT) makes use of these devices to analyze and exploit data in ways not otherwise possible, which results in increased data quality, increased security, and decreased bandwidth. However, methods to train and deploy models at the edge are limited, and models with sufficient accuracy are often too large for the edge device. Therefore, there is a clear need for techniques to create efficient AI/ML at the edge. This work presents training techniques for audio models in the field of environmental sound classification at the edge. Specifically, we design and train Transformers to classify office sounds in audio clips. Results show that a BERT-based Transformer, trained on Mel spectrograms, can outperform a CNN using 99.85% fewer parameters. To achieve this result, we first tested several audio feature extraction techniques designed for Transformers, using ESC-50 for evaluation, along with various augmentations. Our final model outperforms the state-of-the-art MFCC-based CNN on the office sounds dataset, using just over 6,000 parameters -- small enough to run on a microcontroller.
研究动机与目标
- 解决在资源受限、功耗低的边缘设备(受限于尺寸、重量和功耗,SWaP)上部署准确且高效的机器学习模型用于环境声音分类(ESC)的挑战。
- 通过设计一种紧凑且参数高效的模型,克服现有 CNN 和 Transformer 在 ESC 任务中的局限性,使其适用于微控制器和移动设备。
- 证明尽管在标准基准数据集(如 ESC-50)上表现不佳,小型微调后的 Transformer 模型仍可在特定 ESC 数据集(Office Sounds)上超越更大的 CNN 模型。
- 通过最小化模型大小和计算成本,实现设备端推理,并探索设备端微调的可行性。
提出的方法
- 使用自注意力机制和掩码预测目标,在音频片段的梅尔频谱图上对基于 BERT 的 Transformer 进行自监督预训练。
- 在 Office Sounds 数据集上使用标准交叉熵损失对预训练模型进行微调,以实现多分类任务。
- 采用时间偏移、噪声注入和频率掩蔽等数据增强技术,提升模型的鲁棒性和泛化能力。
- 应用动态量化技术以减小模型大小和推理延迟,从而实现在边缘设备(如三星 Galaxy S9)上的部署。
- 使用验证准确率和在移动设备及微控制器平台上的推理延迟等标准指标评估性能。
- 将模型性能与最先进的基于 MFCC 的 CNN 进行对比,以参数量、浮点运算次数(FLOPs)和推理时间作为关键效率指标。
实验结果
研究问题
- RQ1小型高效 Transformer 模型是否能在边缘设备上的环境声音分类任务中,实现优于大型 CNN 模型的准确率?
- RQ2模型大小和参数量如何影响移动设备和微控制器平台上的推理速度与能效?
- RQ3为何 Transformer 在 Office Sounds 数据集上表现优于 CNN,尽管其在更大、更复杂的 ESC-50 数据集上表现较差?
- RQ4量化和模型压缩技术在不损失准确率的前提下,能在多大程度上减少延迟和内存占用?
- RQ5考虑到其单次前向传播计算成本极低,此类微型模型是否具备在设备端进行微调的可行性?
主要发现
- 所提出的 6,642 个参数的 Transformer 模型在 Office Sounds 数据集上的验证准确率比 447 万个参数的 CNN 模型高出超过 2%。
- 与 CNN 相比,该模型的参数量减少了 99.85%,同时保持了更高的准确率,展现出显著的效率优势。
- 在三星 Galaxy S9 上,最小模型的推理延迟降低至 7ms,比 CNN 快 88%,比一个 100 万个参数的 Transformer 快 93%。
- 动态量化使推理延迟降低 21%,表明通过静态量化可进一步优化性能。
- 该模型在 5 秒音频片段上达到 95.2% 的准确率,但当输入缩短至 1 秒时性能显著下降,表明速度与准确率之间存在权衡。
- 该模型在 Office Sounds 数据集上的成功表现(每类样本超过 200 个)表明,更大且平衡的数据集可能对 Transformer 在 ESC 任务中的泛化能力至关重要。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。