Downloads · 30 days
0
audiomagic/yamnet-onnx
yamnet-onnx is a audio classification model from audiomagic. Use it for the audio classification task on the model card, and read the license before you ship it in a product. It is set up for onnx. The card lists the license as apache-2.0.
An ONNX export of Google's YAMNet, an audio event classifier trained on AudioSet. It predicts 521 audio event classes and also exposes a 1024-dimensional embedding that is well suited to transfer learning on small, cu…
Downloads · 30 days
0
Access
Public
Updated Aug 4, 2026
Repo size
16.1 MB
Likes
0
Public
Click a slice to open those files.
.onnx16.1 MB · 100%
From the Hugging Face model README
An ONNX export of Google's YAMNet, an audio event classifier trained on AudioSet. It predicts 521 audio event classes and also exposes a 1024-dimensional embedding that is well suited to transfer learning on small, custom sound datasets.
This repository exists so that Audio Magic's "Detect Sounds" tool can fetch the model from a host we control. It is a straight format conversion — no weights were retrained, fine-tuned, pruned or quantized.
| Upstream model | google/yamnet version 1 (formerly tfhub.dev/google/yamnet/1) |
| Upstream code | tensorflow/models → research/audioset/yamnet |
| Upstream licence | Apache 2.0 |
| Source archive sha256 | b80da2a1a56926fb0767205051a200dd7b3beaf3ea1ea126c42a53943996e5e0 |
As required by Apache 2.0 §4(b), the modifications are:
tf2onnx
(--saved-model, opset 15). No weight values were altered.yamnet_class_map.csv is copied verbatim from the SavedModel's assets/
directory for convenience.Nothing else was changed. The original NOTICE file is not reproduced because
upstream does not ship one.
The mel-spectrogram frontend is baked into the graph, so the model consumes a raw waveform directly — there is no feature extraction to reimplement (and so no opportunity to get it subtly wrong).
Input — waveform, float32, shape [num_samples]: mono PCM at
16 kHz, nominally in [-1.0, 1.0]. Length is dynamic.
Outputs, one row per frame:
| Name | Shape | Meaning |
|---|---|---|
output_0 | [frames, 521] | Per-class scores over the AudioSet ontology |
output_1 | [frames, 1024] | Embeddings (the useful part for transfer learning) |
output_2 | [frames × 96, 64] | Log-mel spectrogram patches |
Each frame covers 0.96 s of audio and the window advances 0.48 s, so
frame i spans [i × 0.48, i × 0.48 + 0.96] seconds. Input shorter than one
patch is zero-padded and still yields one frame. Empirically:
frames = 1 + ceil(max(0, num_samples - 15360) / 7680)
import numpy as np, onnxruntime as ort
session = ort.InferenceSession("yamnet.onnx")
waveform = np.zeros(16000 * 3, dtype=np.float32) # 3 s of 16 kHz mono
scores, embeddings, log_mel = session.run(None, {"waveform": waveform})
The conversion was checked against YAMNet's documented reference behaviour rather than assumed correct:
| Input | Top class |
|---|---|
| 1 kHz sine wave | Beep, bleep |
| Digital silence | Silence (1.00) |
| White noise | Static / White noise |
Frame counts match the published 0.96 s / 0.48 s framing, and outputs were compared numerically against an independent existing conversion across sine, silence, noise, chirp and sub-second inputs.
Apache 2.0, inherited from the upstream model and code.
Copyright 2022 Google LLC. The full licence text is in LICENSE.
The AudioSet ontology and labels are released by Google under CC BY 4.0.
YAMNet implements the architecture described in:
@inproceedings{hershey2017cnn,
title = {{CNN} Architectures for Large-Scale Audio Classification},
author = {Hershey, Shawn and Chaudhuri, Sourish and Ellis, Daniel P. W. and
Gemmeke, Jort F. and Jansen, Aren and Moore, R. Channing and
Plakal, Manoj and Platt, Devin and Saurous, Rif A. and
Seybold, Bryan and Slaney, Malcolm and Weiss, Ron J. and
Wilson, Kevin},
booktitle = {2017 IEEE International Conference on Acoustics, Speech and
Signal Processing (ICASSP)},
year = {2017}
}
@inproceedings{gemmeke2017audioset,
title = {Audio Set: An ontology and human-labeled dataset for audio events},
author = {Gemmeke, Jort F. and Ellis, Daniel P. W. and Freedman, Dylan and
Jansen, Aren and Lawrence, Wade and Moore, R. Channing and
Plakal, Manoj and Ritter, Marvin},
booktitle = {Proc. IEEE ICASSP 2017},
address = {New Orleans, LA},
year = {2017}
}
It uses the MobileNetV1 depthwise-separable convolution architecture:
@article{howard2017mobilenets,
title = {{MobileNets}: Efficient Convolutional Neural Networks for Mobile
Vision Applications},
author = {Howard, Andrew G. and Zhu, Menglong and Chen, Bo and
Kalenichenko, Dmitry and Wang, Weijun and Weyand, Tobias and
Andreetto, Marco and Adam, Hartwig},
journal = {arXiv preprint arXiv:1704.04861},
year = {2017}
}