jimbozhang
commited on
Commit
•
6685d58
1
Parent(s):
68b2ec4
Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- AudioSet
|
5 |
+
metrics:
|
6 |
+
- mAP
|
7 |
+
pipeline_tag: audio-classification
|
8 |
+
---
|
9 |
+
|
10 |
+
# CED-Base Model
|
11 |
+
|
12 |
+
CED are simple ViT-Transformer-based models for audio tagging. Notable differences from other available models include:
|
13 |
+
1. Simplification for finetuning: Batchnormalization of Mel-Spectrograms. During finetuning one does not need to first compute mean/variance over the dataset, which is common for AST.
|
14 |
+
1. Support for variable length inputs. Most other models use a static time-frequency position embedding, which hinders the model's generalization to segments shorter than 10s. Many previous transformers simply pad their input to 10s in order to avoid the performance impact, which in turn slows down training/inference drastically.
|
15 |
+
1. Training/Inference speedup: 64-dimensional mel-filterbanks and 16x16 patches without overlap, leading to 248 patches from a 10s spectrogram. In comparison, AST uses 128 mel-filterbanks with 16x16 (10x10 overlap) convolution, leading to 1212 patches during training/inference. CED-Tiny runs on a common CPU as fast as a comparable MobileNetV3.
|
16 |
+
1. Performance: CED with 10M parameters outperforms the majority of previous approaches (~80M).
|
17 |
+
|
18 |
+
The abstract from the paper is the following:
|
19 |
+
|
20 |
+
Augmentation and knowledge distillation (KD) are well-established techniques employed in audio classification tasks, aimed at enhancing performance and reducing model sizes on the widely recognized Audioset (AS) benchmark. Although both techniques are effective individually, their combined use, called consistent teaching, hasn't been explored before. This paper proposes CED, a simple training framework that distils student models from large teacher ensembles with consistent teaching. To achieve this, CED efficiently stores logits as well as the augmentation methods on disk, making it scalable to large-scale datasets. Central to CED's efficacy is its label-free nature, meaning that only the stored logits are used for the optimization of a student model only requiring 0.3\% additional disk space for AS. The study trains various transformer-based models, including a 10M parameter model achieving a 49.0 mean average precision (mAP) on AS.
|
21 |
+
|
22 |
+
### Model Sources
|
23 |
+
|
24 |
+
- **Repository:** https://github.com/RicherMans/CED
|
25 |
+
- **Paper:** [CED: Consistent ensemble distillation for audio tagging](https://arxiv.org/abs/2308.11957)
|
26 |
+
- **Demo:** https://huggingface.co/spaces/mispeech/ced-base
|
27 |
+
|
28 |
+
## Uses
|
29 |
+
|
30 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
31 |
+
|
32 |
+
```python
|
33 |
+
>>> from ced_model.feature_extraction_ced import CedFeatureExtractor
|
34 |
+
>>> from ced_model.modeling_ced import CedForAudioClassification
|
35 |
+
|
36 |
+
>>> model_path = "mispeech/ced-base"
|
37 |
+
>>> feature_extractor = CedFeatureExtractor.from_pretrained(model_path)
|
38 |
+
>>> model = CedForAudioClassification.from_pretrained(model_path)
|
39 |
+
|
40 |
+
>>> import torchaudio
|
41 |
+
>>> audio, sampling_rate = torchaudio.load(your_wavpath) # https://github.com/RicherMans/CED/raw/main/resources/JeD5V5aaaoI_931_932.wav
|
42 |
+
|
43 |
+
>>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt")
|
44 |
+
>>> with torch.no_grad():
|
45 |
+
... logits = model(**inputs).logits
|
46 |
+
|
47 |
+
>>> predicted_class_ids = torch.argmax(logits, dim=-1).item()
|
48 |
+
>>> predicted_label = model.config.id2label[predicted_class_ids]
|
49 |
+
>>> predicted_label
|
50 |
+
'Finger snapping'
|
51 |
+
```
|