Update README.md
Browse files
README.md
CHANGED
@@ -1,37 +1,174 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
3 |
tags:
|
|
|
4 |
- automatic-speech-recognition
|
5 |
-
-
|
|
|
6 |
- generated_from_trainer
|
7 |
metrics:
|
8 |
- wer
|
9 |
model-index:
|
10 |
-
- name:
|
11 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
-
|
15 |
-
should probably proofread and complete it, then remove this comment. -->
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
This model is a fine-tuned version of [facebook/wav2vec2-large-960h-lv60-self](https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self) on the EXPERIMENTS/DATA/UWB_ATCC/TRAIN - NA dataset.
|
20 |
It achieves the following results on the evaluation set:
|
21 |
- Loss: 0.7287
|
22 |
- Wer: 0.1756
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
|
28 |
## Intended uses & limitations
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
## Training and evaluation data
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
## Training procedure
|
37 |
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language: en
|
4 |
+
datasets:
|
5 |
+
- Jzuluaga/uwb_atcc
|
6 |
tags:
|
7 |
+
- audio
|
8 |
- automatic-speech-recognition
|
9 |
+
- en-atc
|
10 |
+
- en
|
11 |
- generated_from_trainer
|
12 |
metrics:
|
13 |
- wer
|
14 |
model-index:
|
15 |
+
- name: wav2vec2-large-960h-lv60-self-en-atc-uwb-atcc
|
16 |
+
results:
|
17 |
+
- task:
|
18 |
+
type: automatic-speech-recognition
|
19 |
+
name: Speech Recognition
|
20 |
+
dataset:
|
21 |
+
type: Jzuluaga/uwb_atcc
|
22 |
+
name: UWB-ATCC dataset (Air Traffic Control Communications)
|
23 |
+
config: test
|
24 |
+
split: test
|
25 |
+
metrics:
|
26 |
+
- type: wer
|
27 |
+
value: 17.20
|
28 |
+
name: TEST WER
|
29 |
+
verified: False
|
30 |
+
- type: wer
|
31 |
+
value: 13.72
|
32 |
+
name: TEST WER (+LM)
|
33 |
+
verified: False
|
34 |
+
- task:
|
35 |
+
type: automatic-speech-recognition
|
36 |
+
name: Speech Recognition
|
37 |
+
dataset:
|
38 |
+
type: Jzuluaga/atcosim_corpus
|
39 |
+
name: ATCOSIM corpus (Air Traffic Control Communications)
|
40 |
+
config: test
|
41 |
+
split: test
|
42 |
+
metrics:
|
43 |
+
- type: wer
|
44 |
+
value: 15.31
|
45 |
+
name: TEST WER
|
46 |
+
verified: False
|
47 |
+
- type: wer
|
48 |
+
value: 11.88
|
49 |
+
name: TEST WER (+LM)
|
50 |
+
verified: False
|
51 |
---
|
52 |
|
53 |
+
# wav2vec2-large-960h-lv60-self-en-atc-uwb-atcc
|
|
|
54 |
|
55 |
+
This model is a fine-tuned version of [facebook/wav2vec2-large-960h-lv60-self](https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self) on the [UWB-ATCC corpus](https://huggingface.co/datasets/Jzuluaga/uwb_atcc).
|
56 |
+
|
57 |
+
<a href="https://colab.research.google.com/github/idiap/w2v2-air-traffic/blob/main/src/eval_xlsr_atc_model.ipynb">
|
58 |
+
<img alt="GitHub" src="https://colab.research.google.com/assets/colab-badge.svg\">
|
59 |
+
</a>
|
60 |
+
<a href="https://github.com/idiap/w2v2-air-traffic">
|
61 |
+
<img alt="GitHub" src="https://img.shields.io/badge/GitHub-Open%20source-green\">
|
62 |
+
</a>
|
63 |
|
|
|
64 |
It achieves the following results on the evaluation set:
|
65 |
- Loss: 0.7287
|
66 |
- Wer: 0.1756
|
67 |
|
68 |
+
Paper: [How Does Pre-trained Wav2Vec 2.0 Perform on Domain Shifted ASR? An Extensive Benchmark on Air Traffic Control Communications](https://arxiv.org/abs/2203.16822).
|
69 |
+
|
70 |
+
Authors: Juan Zuluaga-Gomez, Amrutha Prasad, Iuliia Nigmatulina, Saeed Sarfjoo, Petr Motlicek, Matthias Kleinert, Hartmut Helmke, Oliver Ohneiser, Qingran Zhan
|
71 |
+
|
72 |
+
Abstract: Recent work on self-supervised pre-training focus</b> on leveraging large-scale unlabeled speech data to build robust end-to-end (E2E)acoustic models (AM) that can be later fine-tuned on downstream tasks e.g., automatic speech recognition (ASR). Yet, few works investigated the impact on performance when the data properties substantially differ between the pre-training and fine-tuning phases, termed domain shift. We target this scenario by analyzing the robustness of Wav2Vec 2.0 and XLS-R models on downstream ASR for a completely unseen domain, air traffic control (ATC) communications. We benchmark these two models on several open-source and challenging ATC databases with signal-to-noise ratio between 5 and 20 dB. Relative word error rate (WER) reductions between 20% to 40% are obtained in comparison to hybrid-based ASR baselines by only fine-tuning E2E acoustic models with a smaller fraction of labeled data. We analyze WERs on the low-resource scenario and gender bias carried by one ATC dataset.
|
73 |
|
74 |
+
Code — GitHub repository: https://github.com/idiap/w2v2-air-traffic
|
75 |
+
|
76 |
+
## Usage
|
77 |
+
|
78 |
+
You can use our Google Colab notebook to run and evaluate our model: https://github.com/idiap/w2v2-air-traffic/blob/master/src/eval_xlsr_atc_model.ipynb
|
79 |
|
80 |
## Intended uses & limitations
|
81 |
|
82 |
+
This model was fine-tuned on air traffic control data. We don't expect that it keeps the same performance on some others datasets, e.g., LibriSpeech or CommonVoice.
|
83 |
+
|
84 |
|
85 |
## Training and evaluation data
|
86 |
|
87 |
+
See Table 1 (page 3) in our paper: [How Does Pre-trained Wav2Vec 2.0 Perform on Domain Shifted ASR? An Extensive Benchmark on Air Traffic Control Communications](https://arxiv.org/abs/2203.16822). We described there the partitions of how to use our model.
|
88 |
+
|
89 |
+
- We use the UWB-ATCC corpus to fine-tune this model. You can download the raw data here: https://lindat.mff.cuni.cz/repository/xmlui/handle/11858/00-097C-0000-0001-CCA1-0
|
90 |
+
- However, do not worry, we have prepared the database in `Datasets format`. Here, [UWB-ATCC corpus on HuggingFace](https://huggingface.co/datasets/Jzuluaga/uwb_atcc). You can scroll and check the train/test partitions, and even listen to some audios.
|
91 |
+
- If you want to prepare a database in HuggingFace format, you can follow the data loader script in: [data_loader_atc.py](https://huggingface.co/datasets/Jzuluaga/uwb_atcc/blob/main/atc_data_loader.py).
|
92 |
+
-
|
93 |
+
## Writing your own inference script
|
94 |
+
|
95 |
+
If you use language model, you need to install the KenLM bindings with:
|
96 |
+
|
97 |
+
```bash
|
98 |
+
conda activate your_environment
|
99 |
+
pip install https://github.com/kpu/kenlm/archive/master.zip
|
100 |
+
```
|
101 |
+
|
102 |
+
The snippet of code:
|
103 |
+
|
104 |
+
```python
|
105 |
+
from datasets import load_dataset, load_metric, Audio
|
106 |
+
import torch
|
107 |
+
from transformers import AutoModelForCTC, Wav2Vec2Processor, Wav2Vec2ProcessorWithLM
|
108 |
+
import torchaudio.functional as F
|
109 |
+
|
110 |
+
USE_LM = False
|
111 |
+
DATASET_ID = "Jzuluaga/uwb_atcc"
|
112 |
+
MODEL_ID = "Jzuluaga/wav2vec2-large-960h-lv60-self-en-atc-uwb-atcc"
|
113 |
+
|
114 |
+
# 1. Load the dataset
|
115 |
+
# we only load the 'test' partition, however, if you want to load the 'train' partition, you can change it accordingly
|
116 |
+
uwb_atcc_corpus_test = load_dataset(DATASET_ID, "test", split="test")
|
117 |
+
|
118 |
+
# 2. Load the model
|
119 |
+
model = AutoModelForCTC.from_pretrained(MODEL_ID)
|
120 |
+
|
121 |
+
# 3. Load the processors, we offer support with LM, which should yield better resutls
|
122 |
+
if USE_LM:
|
123 |
+
processor = Wav2Vec2ProcessorWithLM.from_pretrained(MODEL_ID)
|
124 |
+
else:
|
125 |
+
processor = Wav2Vec2Processor.from_pretrained(MODEL_ID)
|
126 |
+
# 4. Format the test sample
|
127 |
+
sample = next(iter(uwb_atcc_corpus_test))
|
128 |
+
file_sampling_rate = sample['audio']['sampling_rate']
|
129 |
+
# resample if neccessary
|
130 |
+
if file_sampling_rate != 16000:
|
131 |
+
resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), file_sampling_rate, 16000).numpy()
|
132 |
+
else:
|
133 |
+
resampled_audio = torch.tensor(sample["audio"]["array"]).numpy()
|
134 |
+
input_values = processor(resampled_audio, return_tensors="pt").input_values
|
135 |
+
|
136 |
+
# 5. Run the forward pass in the model
|
137 |
+
with torch.no_grad():
|
138 |
+
logits = model(input_values).logits
|
139 |
+
|
140 |
+
# get the transcription with processor
|
141 |
+
if USE_LM:
|
142 |
+
transcription = processor.batch_decode(logits.numpy()).text
|
143 |
+
else:
|
144 |
+
pred_ids = torch.argmax(logits, dim=-1)
|
145 |
+
transcription = processor.batch_decode(pred_ids)
|
146 |
+
# print the output
|
147 |
+
print(transcription)
|
148 |
+
```
|
149 |
+
|
150 |
+
# Cite us
|
151 |
+
|
152 |
+
If you use this code for your research, please cite our paper with:
|
153 |
+
|
154 |
+
```
|
155 |
+
@article{zuluaga2022how,
|
156 |
+
title={How Does Pre-trained Wav2Vec2. 0 Perform on Domain Shifted ASR? An Extensive Benchmark on Air Traffic Control Communications},
|
157 |
+
author={Zuluaga-Gomez, Juan and Prasad, Amrutha and Nigmatulina, Iuliia and Sarfjoo, Saeed and Motlicek, Petr and Kleinert, Matthias and Helmke, Hartmut and Ohneiser, Oliver and Zhan, Qingran},
|
158 |
+
journal={IEEE Spoken Language Technology Workshop (SLT), Doha, Qatar},
|
159 |
+
year={2022}
|
160 |
+
}
|
161 |
+
```
|
162 |
+
and,
|
163 |
+
|
164 |
+
```
|
165 |
+
@article{zuluaga2022bertraffic,
|
166 |
+
title={BERTraffic: BERT-based Joint Speaker Role and Speaker Change Detection for Air Traffic Control Communications},
|
167 |
+
author={Zuluaga-Gomez, Juan and Sarfjoo, Seyyed Saeed and Prasad, Amrutha and Nigmatulina, Iuliia and Motlicek, Petr and Ondre, Karel and Ohneiser, Oliver and Helmke, Hartmut},
|
168 |
+
journal={IEEE Spoken Language Technology Workshop (SLT), Doha, Qatar},
|
169 |
+
year={2022}
|
170 |
+
}
|
171 |
+
```
|
172 |
|
173 |
## Training procedure
|
174 |
|