lvndry commited on
Commit
e305870
·
verified ·
1 Parent(s): 472592e

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +99 -0
  2. drone-v1.onnx +3 -0
  3. drone-v1.pt +3 -0
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: torch
4
+ tags:
5
+ - audio
6
+ - music
7
+ - key-detection
8
+ - constant-q-transform
9
+ - cnn
10
+ model-index:
11
+ - name: drone-v1
12
+ results:
13
+ - task:
14
+ name: Musical key detection
15
+ type: classification
16
+ dataset:
17
+ name: GiantSteps (held-out, 604 tracks)
18
+ type: other
19
+ metrics:
20
+ - name: MIREX (weighted)
21
+ type: other
22
+ value: 73.58
23
+ - name: exact
24
+ type: other
25
+ value: 66.8
26
+ ---
27
+
28
+ # drone-v1
29
+
30
+ A 109,128-parameter key classifier: 24 classes (12 tonics x major/minor) from a
31
+ constant-Q spectrogram. K10 (MIREX 2026) architecture, retrained on 1,363
32
+ Beatport EDM tracks. The smallest model to beat the native libkeyfinder
33
+ reference (69.35% MIREX) on the held-out GiantSteps 604.
34
+
35
+ ## Results
36
+
37
+ Held-out GiantSteps 604, single evaluation per seed:
38
+
39
+ | seed | exact | MIREX |
40
+ | --- | --- | --- |
41
+ | 13 | 68.5% | 74.8% |
42
+ | 37 | 66.1% | 73.0% |
43
+ | 73 | 65.7% | 72.9% |
44
+ | **mean** | **66.8%** | **73.58%** |
45
+
46
+ The shipped `drone-v1.pt` is the seed-13 checkpoint. `drone-v1.onnx` is its
47
+ export (opset 18, dynamic batch, CPU parity verified).
48
+
49
+ ## Input contract
50
+
51
+ - Audio: mono, 22,050 Hz PCM (decode with any standard decoder, e.g. ffmpeg).
52
+ - Features: `librosa.cqt`, 24 bins per octave, 208 bins from two semitones
53
+ below C1 (fmin ~ 25.957 Hz), hop 4096, `log1p` amplitude, shape
54
+ `(208, frames)`. The 192 core bins are rows 8..199; the 16 outer rows are
55
+ the +/-(4) semitone shift pad.
56
+ - Model input: `(batch, 192, frames)` — the core window of the CQT, any length
57
+ >= 1 frame (the head pools over time).
58
+ - Output: 24 logits. Class `i` = tonic `i // 12` semitones from C, mode
59
+ `i % 2` (0 = major, 1 = minor).
60
+
61
+ ## Usage
62
+
63
+ Python (PyTorch):
64
+
65
+ ```python
66
+ from drone import Predictor
67
+
68
+ predictor = Predictor() # resolves drone-v1.pt by default
69
+ print(predictor.predict("track.mp3")) # (tonic, mode, softmax probability)
70
+ ```
71
+
72
+ Or raw, with the ONNX file:
73
+
74
+ ```python
75
+ import numpy as np
76
+ import onnxruntime as ort
77
+ import librosa
78
+
79
+ y, _ = librosa.load("track.mp3", sr=22050, mono=True)
80
+ cqt = np.log1p(np.abs(librosa.cqt(
81
+ y, sr=22050, hop_length=4096, fmin=25.95661061576629,
82
+ n_bins=208, bins_per_octave=24)))
83
+ x = cqt[8:200].astype(np.float32)[None]
84
+ logits = ort.InferenceSession("drone-v1.onnx").run(["logits"], {"features": x})[0]
85
+ ```
86
+
87
+ ## Training
88
+
89
+ Beatport EDM Key Dataset previews (1,363 of 1,486 usable; 933 minor / 430
90
+ major), K10 protocol: 320-frame crops, +/-(4) semitone shift as an exact
91
+ re-slice with a transposed label, AdamW 1e-3, cosine 120 epochs, batch 32,
92
+ plain cross-entropy. Audio is (c) Beatport; annotations are CC BY-SA 4.0.
93
+ Full story in [`docs/training.md`](https://github.com/lvndry/drone/blob/main/docs/training.md)
94
+ in the source repository.
95
+
96
+ ## Caveats
97
+
98
+ Trained on 2-minute EDM previews; expect lower accuracy on long, genre-diverse
99
+ recordings. Softmax values are uncalibrated.
drone-v1.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52ae158b51eebb1df45f294aa5b54a26c056efa12e93ab4816ebe5409faee1ed
3
+ size 461695
drone-v1.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dcf8a7a292b7c12076ffff63c8c6550cb09a6c41ce4d000fd7949fc6bb4b452c
3
+ size 575099