TabCNN ONNX + CQT filterbank + model card (trained on GuitarSet CC BY 4.0)
Browse files- README.md +109 -0
- tabcnn-cqt.bin +3 -0
- tabcnn.onnx +3 -0
README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- audio
|
| 7 |
+
- music-information-retrieval
|
| 8 |
+
- guitar
|
| 9 |
+
- tablature
|
| 10 |
+
- guitar-tablature-estimation
|
| 11 |
+
- onnx
|
| 12 |
+
- tabcnn
|
| 13 |
+
- guitarset
|
| 14 |
+
- cqt
|
| 15 |
+
pipeline_tag: audio-classification
|
| 16 |
+
library_name: onnx
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# TabCNN (ONNX) — guitar tablature estimation
|
| 20 |
+
|
| 21 |
+
A pure-ONNX export of **TabCNN** (Wiggins & Kim, ISMIR 2019) — a small CNN that
|
| 22 |
+
estimates guitar **tablature** (which fret is played on each of the 6 strings)
|
| 23 |
+
from audio, frame by frame. Trained fresh on **GuitarSet** and exported with a
|
| 24 |
+
per-string **LogSoftmax** head so a downstream decoder can consume log-probs
|
| 25 |
+
directly.
|
| 26 |
+
|
| 27 |
+
Built to run on the pure-Dart [`onnx_runtime_dart`](https://github.com/CrispStrobe/onnx_runtime_dart)
|
| 28 |
+
runtime (no native ORT / FFI, web-capable), but it's standard ONNX and runs
|
| 29 |
+
anywhere (onnxruntime, etc.).
|
| 30 |
+
|
| 31 |
+
## Files
|
| 32 |
+
|
| 33 |
+
| File | What |
|
| 34 |
+
|---|---|
|
| 35 |
+
| `tabcnn.onnx` | the model (~0.8 M params, 3.3 MB) |
|
| 36 |
+
| `tabcnn-cqt.bin` | the **192-bin CQT filterbank** the input requires, in a compact banded binary format (see *CQT front-end* below) |
|
| 37 |
+
|
| 38 |
+
## Inputs / outputs
|
| 39 |
+
|
| 40 |
+
- **Input** `input : float32[N, 192, 9, 1]` — for each frame, a 9-frame context
|
| 41 |
+
window of the 192-bin CQT (axis order: `bins × context × channel`). `N` is a
|
| 42 |
+
batch of windows (slide one window per audio frame).
|
| 43 |
+
- **Output** `output : float32[N, 6, 21]` — per **string** (6), a **LogSoftmax**
|
| 44 |
+
over **21 classes**: **class 0 = string silent/closed**, **class k = fret k−1**
|
| 45 |
+
(class 1 = open, class 20 = fret 19).
|
| 46 |
+
- **Frame hop** = 512 / 22050 = **0.023220 s** (≈ 43.07 fps).
|
| 47 |
+
|
| 48 |
+
Decode by taking the per-string argmax (or, better, a per-string temporal Viterbi
|
| 49 |
+
over the log-probs to suppress single-frame flips).
|
| 50 |
+
|
| 51 |
+
## CQT front-end (get this exact — it's the #1 correctness risk)
|
| 52 |
+
|
| 53 |
+
TabCNN is trained on a specific `librosa.cqt`. Reproduce it precisely:
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import librosa, numpy as np
|
| 57 |
+
from scipy.io import wavfile
|
| 58 |
+
sr0, x = wavfile.read("guitar.wav")
|
| 59 |
+
x = librosa.util.normalize(x.astype(float)) # whole-waveform peak norm
|
| 60 |
+
x = librosa.resample(x, orig_sr=sr0, target_sr=22050)
|
| 61 |
+
C = np.abs(librosa.cqt(x, sr=22050, hop_length=512, # RAW magnitude, no log/norm
|
| 62 |
+
n_bins=192, bins_per_octave=24)) # fmin defaults to C1
|
| 63 |
+
repr_ = np.swapaxes(C, 0, 1) # [frames, 192]
|
| 64 |
+
# window: pad 4 frames each side, take [f:f+9], -> [192,9,1]
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
`tabcnn-cqt.bin` is that same filterbank precomputed (banded, `n_fft` 32768,
|
| 68 |
+
boxcar STFT) for a pure-Dart front-end that has no `librosa` — it matches
|
| 69 |
+
`librosa.cqt` at **cosine 0.999947 and median magnitude ratio 0.9999**. Binary
|
| 70 |
+
layout: `int32[4]{nBins,nFft,nFreq,hop} · float32[2]{mean,std} · float32[nBins]lengths ·
|
| 71 |
+
int32[nBins]lo · int32[nBins]hi · float32[Σband]re · float32[Σband]im`; magnitude =
|
| 72 |
+
`|Σ band·STFT| / √length` (the `mean`/`std` fields are 0/1 and unused — TabCNN
|
| 73 |
+
eats **raw** magnitude, not log-normalized features).
|
| 74 |
+
|
| 75 |
+
## Performance
|
| 76 |
+
|
| 77 |
+
- **Tablature F1 = 0.745** (precision 0.784, recall 0.710) on a held-out
|
| 78 |
+
guitarist (GuitarSet guitarist-5 fold) — in line with the vanilla paper's 0.748.
|
| 79 |
+
- Runs on `onnx_runtime_dart` bit-for-bit vs onnxruntime (240/240 per-string
|
| 80 |
+
argmax agreement, max|Δ| 2.7e-5).
|
| 81 |
+
|
| 82 |
+
⚠ **Vanilla, not GuitarProFX.** This is vanilla TabCNN; the GuitarProFX-augmented
|
| 83 |
+
variant (DAFx-24) — which improves zero-shot robustness on real *electric* guitar
|
| 84 |
+
— has no public weights, so it isn't used here. Expect degradation on distorted /
|
| 85 |
+
electric tones (the paper reports ~0.45 zero-shot on EGSet12 for vanilla); use for
|
| 86 |
+
clean acoustic-ish guitar, or retrain with re-rendered audio for electric.
|
| 87 |
+
|
| 88 |
+
## Licence & attribution (CC BY 4.0)
|
| 89 |
+
|
| 90 |
+
Trained on **GuitarSet** (Xi, Bittner, Pauwels, Ye, Bello — ISMIR 2018), released
|
| 91 |
+
under **CC BY 4.0**. These derived weights are redistributed under the same
|
| 92 |
+
licence; **attribution to GuitarSet is required** if you use them. Architecture:
|
| 93 |
+
TabCNN (Wiggins & Kim, ISMIR 2019).
|
| 94 |
+
|
| 95 |
+
```bibtex
|
| 96 |
+
@inproceedings{xi2018guitarset,
|
| 97 |
+
title={GuitarSet: A Dataset for Guitar Transcription},
|
| 98 |
+
author={Xi, Qingyang and Bittner, Rachel M. and Pauwels, Johan and Ye, Xuzhou and Bello, Juan Pablo},
|
| 99 |
+
booktitle={ISMIR}, year={2018}}
|
| 100 |
+
|
| 101 |
+
@inproceedings{wiggins2019tabcnn,
|
| 102 |
+
title={Guitar Tablature Estimation with a Convolutional Neural Network},
|
| 103 |
+
author={Wiggins, Andrew and Kim, Youngmoo}, booktitle={ISMIR}, year={2019}}
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## Reproduction
|
| 107 |
+
|
| 108 |
+
Train / export / CQT-blob scripts:
|
| 109 |
+
[`onnx_runtime_dart/tool/tabcnn/`](https://github.com/CrispStrobe/onnx_runtime_dart/tree/main/tool/tabcnn).
|
tabcnn-cqt.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e5dfa1f10f76545a30cbfd3224431503dbad943b1def78624632284e6df597a
|
| 3 |
+
size 696312
|
tabcnn.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15c58000ed2d1deb3d3fc07581aa1823482dad91d913399dc0209ef240ad8a51
|
| 3 |
+
size 3339979
|