EfficientAT mn10_as for RK3588: audio tagging, AudioSet's 527 classes

Compiled model (.rnpu) for the Rockchip RK3588 / RK3588S NPU, ready to load: no PyTorch, no ONNX export, no compiler run on your side. One fp16 graph for the own NPU stack of RCDL, a C++17 / Python library for vision and speech on these boards. RCDL's compiler built it from ONNX, and its runtime runs it by driving the board's rknpu kernel driver directly, so librknnrt and rknn-toolkit2 are not needed (how the stack works). It needs RCDL 0.3.1 or newer.

What is in a recording: speech, music, animals, alarms and the rest of AudioSet's 527 classes, each as an independent probability.

Upstream: EfficientAT, the mn10_as model trained on AudioSet.

Redistributable, including commercially. EfficientAT is MIT on the code and the weights. The class names in audioset_labels.csv are AudioSet's ontology, which is CC BY-SA 4.0. See Licence.

Files

file what it is size
efficientat_mn10_as_1000_fp16.rnpu [1,1,128,1000] log-mel (10 s at 32 kHz) → [1,527] sigmoid probabilities 9.8 MB
audioset_labels.csv AudioSet's class_labels_indices.csv: the 527 class names in index order < 0.1 MB

The front end is EfficientAT's own, rewritten in RCDL and run on the CPU: 16 kHz audio upsampled by 2 with a windowed sinc, pre-emphasis 0.97, a centred STFT (1024, Hann 800, hop 320), a Kaldi mel bank over 0–15 kHz, then (log(x + 1e-5) + 4.5) / 5. It is within 2.2e-5 of the original.

Measured on RK3588S and RK3588

RK3588S RK3588
an AISHELL-1 sentence → 527 probabilities 111 ms 109 ms
of which the model run 26.1 ms 25.5 ms
that speech Speech 0.81 the same
a 1 kHz tone Beep, bleep 0.86 the same
white noise Static 0.47 the same

RCDL 0.3.0 conda packages, RCDL's own NPU runtime, one NPU core, NPU driver 0.9.8; BSP kernel 6.1.118 on the RK3588S, 6.1.141 on the RK3588. The CPU governor was performance, with the process pinned to the four A76 cores. Under the boards' default schedutil, tasks that alternate NPU and CPU work measured up to about four times slower, with the same results.

On AISHELL-1 clip 1, the probabilities are the float model's to 0.002, with Speech first at 0.81.

Use it

On the board (linux-aarch64):

conda create -n rcdl -c https://mirrors.ruis.ai/conda -c conda-forge rcdl
conda activate rcdl
curl -LO https://huggingface.co/ruisv/rcdl-efficientat/resolve/main/efficientat_mn10_as_1000_fp16.rnpu
curl -LO https://huggingface.co/ruisv/rcdl-efficientat/resolve/main/audioset_labels.csv
import wave, numpy as np, rcdl

def read(path):                                      # 16 kHz mono PCM16
    with wave.open(path) as w:
        assert (w.getframerate(), w.getnchannels(), w.getsampwidth()) == (16000, 1, 2)
        return np.frombuffer(w.readframes(w.getnframes()), np.int16)

tagger = rcdl.AudioTagger.from_files("efficientat_mn10_as_1000_fp16.rnpu", "audioset_labels.csv")
for name in ("zh.wav", "en.wav"):
    tags = tagger.top(read(name), k=3)               # [(class name, probability)]
    print(f"{name}: " + ", ".join(f"{label} {p:.2f}" for label, p in tags))

What to know before deploying

The probabilities are independent. Each class has its own sigmoid, so several can be high at once and they do not sum to 1. tagger.probabilities(pcm) gives all 527; set a threshold per class you care about.

A call covers 10 s, and most of its time is the CPU front end. A shorter recording is padded with silence to 10 s; a longer one is tagged in 10 s windows 5 s apart, and each class keeps its highest probability.

16 kHz or 32 kHz mono. Pass sample_rate=32000 for 32 kHz audio; other rates are refused. The samples may be float in [-1, 1] or int16.

Licence

MIT, on the EfficientAT code and the mn10_as weights, which were trained on AudioSet. audioset_labels.csv is AudioSet's class_labels_indices.csv: its class names are AudioSet's ontology, under CC BY-SA 4.0, so passing the file on keeps that attribution and that licence.

RCDL itself is Apache-2.0 and is unrelated to these terms. It is a general-purpose runtime that loads any .rnpu or .rknn. The licences above apply to these weights and these files only.

The compiler flags of the build are in RCDL's scripts/fetch_models.sh, and its input contract in docs/MODELS.md.

中文说明

这是 EfficientAT mn10_as 面向瑞芯微 RK3588 / RK3588S NPU 的编译模型(.rnpu), 下载即可加载:不需要 PyTorch,不用导出 ONNX,也不用自己跑编译器。这一个 fp16 计算图是为 RCDL 的自研 NPU 栈编译的:RCDL 的编译器从 ONNX 生成它, RCDL 的运行时直接驱动板子上的 rknpu 内核驱动来执行,不需要 librknnrt,也不需要 rknn-toolkit2(自研栈介绍)。 需要 RCDL 0.3.1 或更新版本。

用来判断录音里有什么声音:语音、音乐、动物、警报等 AudioSet 的 527 类,每一类各给一个独立的 概率。上游是 EfficientAT 在 AudioSet 上训练的 mn10_as 模型。

可以再分发,包括商用。 EfficientAT 的代码和权重都是 MIT 许可。audioset_labels.csv 里的类名来自 AudioSet 的本体(ontology),许可为 CC BY-SA 4.0。

文件

文件 内容 大小
efficientat_mn10_as_1000_fp16.rnpu [1,1,128,1000] log-mel(32 kHz 下 10 s)→ [1,527] sigmoid 概率 9.8 MB
audioset_labels.csv AudioSet 的 class_labels_indices.csv:按序号排列的 527 个类名 < 0.1 MB

前端是 EfficientAT 自己的那一套,在 RCDL 里重写、由 CPU 运行:16 kHz 音频用加窗 sinc 上采样 两倍,预加重 0.97,中心对齐的 STFT(1024,Hann 800,hop 320),0–15 kHz 的 Kaldi mel 滤波器组, 再算 (log(x + 1e-5) + 4.5) / 5;与原版相差不超过 2.2e-5。

实测

  • 一句 AISHELL-1 普通话 → 527 个概率:RK3588S 上 111 ms(其中模型 26.1 ms),RK3588 上 109 ms(25.5 ms)。
  • 这段语音得到 Speech 0.81;1 kHz 纯音得到 Beep, bleep 0.86;白噪声得到 Static 0.47。两块板结果相同。
  • 测量条件:RCDL 0.3.0 的 conda 包,自研 NPU 运行时,单个 NPU 核,NPU 驱动 0.9.8; RK3588S 为 BSP 内核 6.1.118,RK3588 为 6.1.141。CPU 调频策略为 performance,进程绑在 四个 A76 核上;在板子默认的 schedutil 下,NPU 与 CPU 交替工作的任务最多会慢到约四倍, 结果不变。
  • 在 AISHELL-1 第 1 段音频上,各类概率与浮点模型相差不超过 0.002,排第一的是 Speech(0.81)。

用法

用法见上面的代码:装好 RCDL、下载模型和类名表,对 zh.wav 和 en.wav 各打印最可能的三类。

部署前须知

  • 各类概率相互独立。 每一类各有一个 sigmoid,几类可以同时很高,加起来也不等于 1。 tagger.probabilities(pcm) 返回全部 527 个,按关心的类别各自设阈值。
  • 一次调用覆盖 10 s,大部分时间花在 CPU 前端上。 不足 10 s 的录音补静音;更长的按 10 s 窗口、5 s 间隔逐窗打标签,每一类取各窗中的最高概率。
  • 16 kHz 或 32 kHz 单声道。 32 kHz 音频传 sample_rate=32000,其他采样率会被拒绝。采样 可以是 float([-1, 1])或 int16。

许可

EfficientAT 的代码和 mn10_as 权重为 MIT,模型在 AudioSet 上训练。audioset_labels.csv 是 AudioSet 的 class_labels_indices.csv,类名属于 AudioSet 的本体,许可为 CC BY-SA 4.0: 转发这个文件时要保留署名,并沿用同一许可。

RCDL 本身是 Apache-2.0,与上述条款无关。 它是通用运行时,能加载任何 .rnpu 或 .rknn;上述许可只适用于这些权重和这些文件。

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support