Commit
•
146ebe6
0
Parent(s):
Update files from the datasets library (from 1.13.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.13.0
- .gitattributes +27 -0
- README.md +322 -0
- ami.py +581 -0
- dataset_infos.json +0 -0
- dummy/headset-multi/1.6.2/dummy_data.zip +3 -0
- dummy/headset-single/1.6.2/dummy_data.zip +3 -0
- dummy/microphone-multi/1.6.2/dummy_data.zip +3 -0
- dummy/microphone-single/1.6.2/dummy_data.zip +3 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pretty_name: AMI Corpus
|
3 |
+
annotations_creators:
|
4 |
+
- expert-generated
|
5 |
+
language_creators:
|
6 |
+
- crowdsourced
|
7 |
+
- expert-generated
|
8 |
+
languages:
|
9 |
+
- en
|
10 |
+
licenses:
|
11 |
+
- cc-by-4-0
|
12 |
+
multilinguality:
|
13 |
+
- monolingual
|
14 |
+
size_categories:
|
15 |
+
- 100K<n<1M
|
16 |
+
source_datasets:
|
17 |
+
- original
|
18 |
+
task_categories:
|
19 |
+
- speech-processing
|
20 |
+
task_ids:
|
21 |
+
- automatic-speech-recognition
|
22 |
+
---
|
23 |
+
|
24 |
+
# Dataset Card for AMI Corpus
|
25 |
+
|
26 |
+
## Table of Contents
|
27 |
+
- [Dataset Description](#dataset-description)
|
28 |
+
- [Dataset Summary](#dataset-summary)
|
29 |
+
- [Dataset Preprocessing](#dataset-preprocessing)
|
30 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
31 |
+
- [Languages](#languages)
|
32 |
+
- [Dataset Structure](#dataset-structure)
|
33 |
+
- [Data Instances](#data-instances)
|
34 |
+
- [Data Fields](#data-fields)
|
35 |
+
- [Data Splits](#data-splits)
|
36 |
+
- [Dataset Creation](#dataset-creation)
|
37 |
+
- [Curation Rationale](#curation-rationale)
|
38 |
+
- [Source Data](#source-data)
|
39 |
+
- [Annotations](#annotations)
|
40 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
41 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
42 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
43 |
+
- [Discussion of Biases](#discussion-of-biases)
|
44 |
+
- [Other Known Limitations](#other-known-limitations)
|
45 |
+
- [Additional Information](#additional-information)
|
46 |
+
- [Dataset Curators](#dataset-curators)
|
47 |
+
- [Licensing Information](#licensing-information)
|
48 |
+
- [Citation Information](#citation-information)
|
49 |
+
- [Contributions](#contributions)
|
50 |
+
|
51 |
+
## Dataset Description
|
52 |
+
|
53 |
+
- **Homepage:** [AMI corpus](https://groups.inf.ed.ac.uk/ami/corpus/)
|
54 |
+
- **Repository:** [Needs More Information]
|
55 |
+
- **Paper:** [Needs More Information]
|
56 |
+
- **Leaderboard:** [Needs More Information]
|
57 |
+
- **Point of Contact:** [Needs More Information]
|
58 |
+
|
59 |
+
### Dataset Summary
|
60 |
+
|
61 |
+
The AMI Meeting Corpus consists of 100 hours of meeting recordings. The recordings use a range of signals
|
62 |
+
synchronized to a common timeline. These include close-talking and far-field microphones, individual and
|
63 |
+
room-view video cameras, and output from a slide projector and an electronic whiteboard. During the meetings,
|
64 |
+
the participants also have unsynchronized pens available to them that record what is written. The meetings
|
65 |
+
were recorded in English using three different rooms with different acoustic properties, and include mostly
|
66 |
+
non-native speakers.
|
67 |
+
|
68 |
+
### Dataset Preprocessing
|
69 |
+
|
70 |
+
Individual samples of the AMI dataset contain very large audio files (between 10 and 60 minutes).
|
71 |
+
Such lengths are unfeasible for most speech recognition models. In the following, we show how the
|
72 |
+
dataset can effectively be chunked into multiple segments as defined by the dataset creators.
|
73 |
+
|
74 |
+
The following function cuts the long audio files into the defined segment lengths:
|
75 |
+
|
76 |
+
```python
|
77 |
+
import librosa
|
78 |
+
import math
|
79 |
+
from datasets import load_dataset
|
80 |
+
|
81 |
+
SAMPLE_RATE = 16_000
|
82 |
+
|
83 |
+
def chunk_audio(batch):
|
84 |
+
new_batch = {
|
85 |
+
"audio": [],
|
86 |
+
"words": [],
|
87 |
+
"speaker": [],
|
88 |
+
"lengths": [],
|
89 |
+
"word_start_times": [],
|
90 |
+
"segment_start_times": [],
|
91 |
+
}
|
92 |
+
|
93 |
+
audio, _ = librosa.load(batch["file"][0], sr=SAMPLE_RATE)
|
94 |
+
|
95 |
+
word_idx = 0
|
96 |
+
num_words = len(batch["words"][0])
|
97 |
+
for segment_idx in range(len(batch["segment_start_times"][0])):
|
98 |
+
words = []
|
99 |
+
word_start_times = []
|
100 |
+
start_time = batch["segment_start_times"][0][segment_idx]
|
101 |
+
end_time = batch["segment_end_times"][0][segment_idx]
|
102 |
+
|
103 |
+
# go back and forth with word_idx since segments overlap with each other
|
104 |
+
while (word_idx > 1) and (start_time < batch["word_end_times"][0][word_idx - 1]):
|
105 |
+
word_idx -= 1
|
106 |
+
|
107 |
+
while word_idx < num_words and (start_time > batch["word_start_times"][0][word_idx]):
|
108 |
+
word_idx += 1
|
109 |
+
|
110 |
+
new_batch["audio"].append(audio[int(start_time * SAMPLE_RATE): int(end_time * SAMPLE_RATE)])
|
111 |
+
|
112 |
+
while word_idx < num_words and batch["word_start_times"][0][word_idx] < end_time:
|
113 |
+
words.append(batch["words"][0][word_idx])
|
114 |
+
word_start_times.append(batch["word_start_times"][0][word_idx])
|
115 |
+
word_idx += 1
|
116 |
+
|
117 |
+
new_batch["lengths"].append(end_time - start_time)
|
118 |
+
new_batch["words"].append(words)
|
119 |
+
new_batch["speaker"].append(batch["segment_speakers"][0][segment_idx])
|
120 |
+
new_batch["word_start_times"].append(word_start_times)
|
121 |
+
|
122 |
+
new_batch["segment_start_times"].append(batch["segment_start_times"][0][segment_idx])
|
123 |
+
|
124 |
+
return new_batch
|
125 |
+
|
126 |
+
ami = load_dataset("ami", "headset-single")
|
127 |
+
ami = ami.map(chunk_audio, batched=True, batch_size=1, remove_columns=ami["train"].column_names)
|
128 |
+
```
|
129 |
+
|
130 |
+
The segmented audio files can still be as long as a minute. To further chunk the data into shorter
|
131 |
+
audio chunks, you can use the following script.
|
132 |
+
|
133 |
+
```python
|
134 |
+
MAX_LENGTH_IN_SECONDS = 20.0
|
135 |
+
|
136 |
+
def chunk_into_max_n_seconds(batch):
|
137 |
+
new_batch = {
|
138 |
+
"audio": [],
|
139 |
+
"text": [],
|
140 |
+
}
|
141 |
+
|
142 |
+
sample_length = batch["lengths"][0]
|
143 |
+
segment_start = batch["segment_start_times"][0]
|
144 |
+
|
145 |
+
if sample_length > MAX_LENGTH_IN_SECONDS:
|
146 |
+
num_chunks_per_sample = math.ceil(sample_length / MAX_LENGTH_IN_SECONDS)
|
147 |
+
avg_chunk_length = sample_length / num_chunks_per_sample
|
148 |
+
num_words = len(batch["words"][0])
|
149 |
+
|
150 |
+
# start chunking by times
|
151 |
+
start_word_idx = end_word_idx = 0
|
152 |
+
chunk_start_time = 0
|
153 |
+
for n in range(num_chunks_per_sample):
|
154 |
+
while (end_word_idx < num_words - 1) and (batch["word_start_times"][0][end_word_idx] < segment_start + (n + 1) * avg_chunk_length):
|
155 |
+
end_word_idx += 1
|
156 |
+
|
157 |
+
chunk_end_time = int((batch["word_start_times"][0][end_word_idx] - segment_start) * SAMPLE_RATE)
|
158 |
+
new_batch["audio"].append(batch["audio"][0][chunk_start_time: chunk_end_time])
|
159 |
+
new_batch["text"].append(" ".join(batch["words"][0][start_word_idx: end_word_idx]))
|
160 |
+
|
161 |
+
chunk_start_time = chunk_end_time
|
162 |
+
start_word_idx = end_word_idx
|
163 |
+
else:
|
164 |
+
new_batch["audio"].append(batch["audio"][0])
|
165 |
+
new_batch["text"].append(" ".join(batch["words"][0]))
|
166 |
+
|
167 |
+
return new_batch
|
168 |
+
|
169 |
+
ami = ami.map(chunk_into_max_n_seconds, batched=True, batch_size=1, remove_columns=ami["train"].column_names, num_proc=64)
|
170 |
+
```
|
171 |
+
|
172 |
+
A segmented and chunked dataset of the config `"headset-single"`can be found [here](https://huggingface.co/datasets/ami-wav2vec2/ami_single_headset_segmented_and_chunked).
|
173 |
+
|
174 |
+
### Supported Tasks and Leaderboards
|
175 |
+
|
176 |
+
- `automatic-speech-recognition`: The dataset can be used to train a model for Automatic Speech Recognition (ASR). The model is presented with an audio file and asked to transcribe the audio file to written text. The most common evaluation metric is the word error rate (WER). The task does not have an active leaderboard at the moment.
|
177 |
+
|
178 |
+
- `speaker-diarization`: The dataset can be used to train model for Speaker Diarization (SD). The model is presented with an audio file and asked to predict which speaker spoke at what time.
|
179 |
+
|
180 |
+
### Languages
|
181 |
+
|
182 |
+
The audio is in English.
|
183 |
+
|
184 |
+
## Dataset Structure
|
185 |
+
|
186 |
+
### Data Instances
|
187 |
+
|
188 |
+
A typical data point comprises the path to the audio file (or files in the case of
|
189 |
+
the multi-headset or multi-microphone dataset), called `file` and its transcription as
|
190 |
+
a list of words, called `words`. Additional information about the `speakers`, the `word_start_time`, `word_end_time`, `segment_start_time`, `segment_end_time` is given.
|
191 |
+
In addition
|
192 |
+
|
193 |
+
and its transcription, called `text`. Some additional information about the speaker and the passage which contains the transcription is provided.
|
194 |
+
|
195 |
+
```
|
196 |
+
{'word_ids': ["ES2004a.D.words1", "ES2004a.D.words2", ...],
|
197 |
+
'word_start_times': [0.3700000047683716, 0.949999988079071, ...],
|
198 |
+
'word_end_times': [0.949999988079071, 1.5299999713897705, ...],
|
199 |
+
'word_speakers': ['A', 'A', ...],
|
200 |
+
'segment_ids': ["ES2004a.sync.1", "ES2004a.sync.2", ...]
|
201 |
+
'segment_start_times': [10.944000244140625, 17.618999481201172, ...],
|
202 |
+
'segment_end_times': [17.618999481201172, 18.722000122070312, ...],
|
203 |
+
'segment_speakers': ['A', 'B', ...],
|
204 |
+
'words', ["hmm", "hmm", ...]
|
205 |
+
'channels': [0, 0, ..],
|
206 |
+
'file': "/.cache/huggingface/datasets/downloads/af7e748544004557b35eef8b0522d4fb2c71e004b82ba8b7343913a15def465f"
|
207 |
+
}
|
208 |
+
```
|
209 |
+
|
210 |
+
### Data Fields
|
211 |
+
|
212 |
+
- word_ids: a list of the ids of the words
|
213 |
+
|
214 |
+
- word_start_times: a list of the start times of when the words were spoken in seconds
|
215 |
+
|
216 |
+
- word_end_times: a list of the end times of when the words were spoken in seconds
|
217 |
+
|
218 |
+
- word_speakers: a list of speakers one for each word
|
219 |
+
|
220 |
+
- segment_ids: a list of the ids of the segments
|
221 |
+
|
222 |
+
- segment_start_times: a list of the start times of when the segments start
|
223 |
+
|
224 |
+
- segment_end_times: a list of the start times of when the segments ends
|
225 |
+
|
226 |
+
- segment_speakers: a list of speakers one for each segment
|
227 |
+
|
228 |
+
- words: a list of all the spoken words
|
229 |
+
|
230 |
+
- channels: a list of all channels that were used for each word
|
231 |
+
|
232 |
+
- file: a path to the audio file
|
233 |
+
|
234 |
+
### Data Splits
|
235 |
+
|
236 |
+
The dataset consists of several configurations, each one having train/validation/test splits:
|
237 |
+
|
238 |
+
- headset-single: Close talking audio of single headset. This configuration only includes audio belonging to the headset of the person currently speaking.
|
239 |
+
|
240 |
+
- headset-multi (4 channels): Close talking audio of four individual headset. This configuration includes audio belonging to four individual headsets. For each annotation there are 4 audio files 0, 1, 2, 3.
|
241 |
+
|
242 |
+
- microphone-single: Far field audio of single microphone. This configuration only includes audio belonging the first microphone, *i.e.* 1-1, of the microphone array.
|
243 |
+
|
244 |
+
- microphone-multi (8 channels): Far field audio of microphone array. This configuration includes audio of the first microphone array 1-1, 1-2, ..., 1-8.
|
245 |
+
|
246 |
+
In general, `headset-single` and `headset-multi` include significantly less noise than
|
247 |
+
`microphone-single` and `microphone-multi`.
|
248 |
+
|
249 |
+
| | Train | Valid | Test |
|
250 |
+
| ----- | ------ | ----- | ---- |
|
251 |
+
| headset-single | 136 (80h) | 18 (9h) | 16 (9h) |
|
252 |
+
| headset-multi (4 channels) | 136 (320h) | 18 (36h) | 16 (36h) |
|
253 |
+
| microphone-single | 136 (80h) | 18 (9h) | 16 (9h) |
|
254 |
+
| microphone-multi (8 channels) | 136 (640h) | 18 (72h) | 16 (72h) |
|
255 |
+
|
256 |
+
Note that each sample contains between 10 and 60 minutes of audio data which makes it
|
257 |
+
impractical for direct transcription. One should make use of the segment and word start times and end times to chunk the samples into smaller samples of manageable size.
|
258 |
+
|
259 |
+
## Dataset Creation
|
260 |
+
|
261 |
+
All information about the dataset creation can be found
|
262 |
+
[here](https://groups.inf.ed.ac.uk/ami/corpus/overview.shtml)
|
263 |
+
|
264 |
+
### Curation Rationale
|
265 |
+
|
266 |
+
[Needs More Information]
|
267 |
+
|
268 |
+
### Source Data
|
269 |
+
|
270 |
+
#### Initial Data Collection and Normalization
|
271 |
+
|
272 |
+
[Needs More Information]
|
273 |
+
|
274 |
+
#### Who are the source language producers?
|
275 |
+
|
276 |
+
[Needs More Information]
|
277 |
+
|
278 |
+
### Annotations
|
279 |
+
|
280 |
+
#### Annotation process
|
281 |
+
|
282 |
+
[Needs More Information]
|
283 |
+
|
284 |
+
#### Who are the annotators?
|
285 |
+
|
286 |
+
[Needs More Information]
|
287 |
+
|
288 |
+
### Personal and Sensitive Information
|
289 |
+
|
290 |
+
[Needs More Information]
|
291 |
+
|
292 |
+
## Considerations for Using the Data
|
293 |
+
|
294 |
+
### Social Impact of Dataset
|
295 |
+
|
296 |
+
[More Information Needed]
|
297 |
+
|
298 |
+
### Discussion of Biases
|
299 |
+
|
300 |
+
[More Information Needed]
|
301 |
+
|
302 |
+
### Other Known Limitations
|
303 |
+
|
304 |
+
[Needs More Information]
|
305 |
+
|
306 |
+
## Additional Information
|
307 |
+
|
308 |
+
### Dataset Curators
|
309 |
+
|
310 |
+
[Needs More Information]
|
311 |
+
|
312 |
+
### Licensing Information
|
313 |
+
|
314 |
+
CC BY 4.0
|
315 |
+
|
316 |
+
### Citation Information
|
317 |
+
#### TODO
|
318 |
+
|
319 |
+
### Contributions
|
320 |
+
|
321 |
+
Thanks to [@cahya-wirawan](https://github.com/cahya-wirawan) and [@patrickvonplaten](https://github.com/patrickvonplaten) for adding this dataset.
|
322 |
+
#### TODO
|
ami.py
ADDED
@@ -0,0 +1,581 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""AMI Corpus"""
|
18 |
+
|
19 |
+
import os
|
20 |
+
import xml.etree.ElementTree as ET
|
21 |
+
|
22 |
+
import numpy as np
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
logger = datasets.logging.get_logger(__name__)
|
28 |
+
|
29 |
+
_CITATION = """\
|
30 |
+
@inproceedings{10.1007/11677482_3,
|
31 |
+
author = {Carletta, Jean and Ashby, Simone and Bourban, Sebastien and Flynn, Mike and Guillemot, Mael and Hain, Thomas and Kadlec, Jaroslav and Karaiskos, Vasilis and Kraaij, Wessel and Kronenthal, Melissa and Lathoud, Guillaume and Lincoln, Mike and Lisowska, Agnes and McCowan, Iain and Post, Wilfried and Reidsma, Dennis and Wellner, Pierre},
|
32 |
+
title = {The AMI Meeting Corpus: A Pre-Announcement},
|
33 |
+
year = {2005},
|
34 |
+
isbn = {3540325492},
|
35 |
+
publisher = {Springer-Verlag},
|
36 |
+
address = {Berlin, Heidelberg},
|
37 |
+
url = {https://doi.org/10.1007/11677482_3},
|
38 |
+
doi = {10.1007/11677482_3},
|
39 |
+
abstract = {The AMI Meeting Corpus is a multi-modal data set consisting of 100 hours of meeting
|
40 |
+
recordings. It is being created in the context of a project that is developing meeting
|
41 |
+
browsing technology and will eventually be released publicly. Some of the meetings
|
42 |
+
it contains are naturally occurring, and some are elicited, particularly using a scenario
|
43 |
+
in which the participants play different roles in a design team, taking a design project
|
44 |
+
from kick-off to completion over the course of a day. The corpus is being recorded
|
45 |
+
using a wide range of devices including close-talking and far-field microphones, individual
|
46 |
+
and room-view video cameras, projection, a whiteboard, and individual pens, all of
|
47 |
+
which produce output signals that are synchronized with each other. It is also being
|
48 |
+
hand-annotated for many different phenomena, including orthographic transcription,
|
49 |
+
discourse properties such as named entities and dialogue acts, summaries, emotions,
|
50 |
+
and some head and hand gestures. We describe the data set, including the rationale
|
51 |
+
behind using elicited material, and explain how the material is being recorded, transcribed
|
52 |
+
and annotated.},
|
53 |
+
booktitle = {Proceedings of the Second International Conference on Machine Learning for Multimodal Interaction},
|
54 |
+
pages = {28–39},
|
55 |
+
numpages = {12},
|
56 |
+
location = {Edinburgh, UK},
|
57 |
+
series = {MLMI'05}
|
58 |
+
}
|
59 |
+
"""
|
60 |
+
|
61 |
+
_URL = "https://groups.inf.ed.ac.uk/ami/corpus/"
|
62 |
+
|
63 |
+
_DL_URL_ANNOTATIONS = "http://groups.inf.ed.ac.uk/ami/AMICorpusAnnotations/ami_public_manual_1.6.2.zip"
|
64 |
+
_DL_SAMPLE_FORMAT = "https://groups.inf.ed.ac.uk/ami/AMICorpusMirror//amicorpus/{}/audio/{}"
|
65 |
+
|
66 |
+
_SPEAKERS = ["A", "B", "C", "D", "E"]
|
67 |
+
|
68 |
+
# Commented out samples don't seem to exist
|
69 |
+
|
70 |
+
_TRAIN_SAMPLE_IDS = [
|
71 |
+
"ES2002a",
|
72 |
+
"ES2002b",
|
73 |
+
"ES2002c",
|
74 |
+
"ES2002d",
|
75 |
+
"ES2003a",
|
76 |
+
"ES2003b",
|
77 |
+
"ES2003c",
|
78 |
+
"ES2003d",
|
79 |
+
"ES2005a",
|
80 |
+
"ES2005b",
|
81 |
+
"ES2005c",
|
82 |
+
"ES2005d",
|
83 |
+
"ES2006a",
|
84 |
+
"ES2006b",
|
85 |
+
"ES2006c",
|
86 |
+
"ES2006d",
|
87 |
+
"ES2007a",
|
88 |
+
"ES2007b",
|
89 |
+
"ES2007c",
|
90 |
+
"ES2007d",
|
91 |
+
"ES2008a",
|
92 |
+
"ES2008b",
|
93 |
+
"ES2008c",
|
94 |
+
"ES2008d",
|
95 |
+
"ES2009a",
|
96 |
+
"ES2009b",
|
97 |
+
"ES2009c",
|
98 |
+
"ES2009d",
|
99 |
+
"ES2010a",
|
100 |
+
"ES2010b",
|
101 |
+
"ES2010c",
|
102 |
+
"ES2010d",
|
103 |
+
"ES2012a",
|
104 |
+
"ES2012b",
|
105 |
+
"ES2012c",
|
106 |
+
"ES2012d",
|
107 |
+
"ES2013a",
|
108 |
+
"ES2013b",
|
109 |
+
"ES2013c",
|
110 |
+
"ES2013d",
|
111 |
+
"ES2014a",
|
112 |
+
"ES2014b",
|
113 |
+
"ES2014c",
|
114 |
+
"ES2014d",
|
115 |
+
"ES2015a",
|
116 |
+
"ES2015b",
|
117 |
+
"ES2015c",
|
118 |
+
"ES2015d",
|
119 |
+
"ES2016a",
|
120 |
+
"ES2016b",
|
121 |
+
"ES2016c",
|
122 |
+
"ES2016d",
|
123 |
+
"IS1000a",
|
124 |
+
"IS1000b",
|
125 |
+
"IS1000c",
|
126 |
+
"IS1000d",
|
127 |
+
"IS1001a",
|
128 |
+
"IS1001b",
|
129 |
+
"IS1001c",
|
130 |
+
"IS1001d",
|
131 |
+
"IS1002b",
|
132 |
+
"IS1002c",
|
133 |
+
"IS1002d",
|
134 |
+
"IS1003a",
|
135 |
+
"IS1003b",
|
136 |
+
"IS1003c",
|
137 |
+
"IS1003d",
|
138 |
+
"IS1004a",
|
139 |
+
"IS1004b",
|
140 |
+
"IS1004c",
|
141 |
+
"IS1004d",
|
142 |
+
"IS1005a",
|
143 |
+
"IS1005b",
|
144 |
+
"IS1005c",
|
145 |
+
"IS1006a",
|
146 |
+
"IS1006b",
|
147 |
+
"IS1006c",
|
148 |
+
"IS1006d",
|
149 |
+
"IS1007a",
|
150 |
+
"IS1007b",
|
151 |
+
"IS1007c",
|
152 |
+
"IS1007d",
|
153 |
+
"TS3005a",
|
154 |
+
"TS3005b",
|
155 |
+
"TS3005c",
|
156 |
+
"TS3005d",
|
157 |
+
"TS3006a",
|
158 |
+
"TS3006b",
|
159 |
+
"TS3006c",
|
160 |
+
"TS3006d",
|
161 |
+
"TS3007a",
|
162 |
+
"TS3007b",
|
163 |
+
"TS3007c",
|
164 |
+
"TS3007d",
|
165 |
+
"TS3008a",
|
166 |
+
"TS3008b",
|
167 |
+
"TS3008c",
|
168 |
+
"TS3008d",
|
169 |
+
"TS3009a",
|
170 |
+
"TS3009b",
|
171 |
+
"TS3009c",
|
172 |
+
"TS3009d",
|
173 |
+
"TS3010a",
|
174 |
+
"TS3010b",
|
175 |
+
"TS3010c",
|
176 |
+
"TS3010d",
|
177 |
+
"TS3011a",
|
178 |
+
"TS3011b",
|
179 |
+
"TS3011c",
|
180 |
+
"TS3011d",
|
181 |
+
"TS3012a",
|
182 |
+
"TS3012b",
|
183 |
+
"TS3012c",
|
184 |
+
"TS3012d",
|
185 |
+
"EN2001a",
|
186 |
+
"EN2001b",
|
187 |
+
"EN2001d",
|
188 |
+
"EN2001e",
|
189 |
+
"EN2003a",
|
190 |
+
"EN2004a",
|
191 |
+
"EN2005a",
|
192 |
+
"EN2006a",
|
193 |
+
"EN2006b",
|
194 |
+
"EN2009b",
|
195 |
+
"EN2009c",
|
196 |
+
"EN2009d",
|
197 |
+
"IN1001",
|
198 |
+
"IN1002",
|
199 |
+
"IN1005",
|
200 |
+
"IN1007",
|
201 |
+
"IN1008",
|
202 |
+
"IN1009",
|
203 |
+
"IN1012",
|
204 |
+
"IN1013",
|
205 |
+
"IN1014",
|
206 |
+
"IN1016",
|
207 |
+
]
|
208 |
+
|
209 |
+
_VALIDATION_SAMPLE_IDS = [
|
210 |
+
"ES2011a",
|
211 |
+
"ES2011b",
|
212 |
+
"ES2011c",
|
213 |
+
"ES2011d",
|
214 |
+
"IS1008a",
|
215 |
+
"IS1008b",
|
216 |
+
"IS1008c",
|
217 |
+
"IS1008d",
|
218 |
+
"TS3004a",
|
219 |
+
"TS3004b",
|
220 |
+
"TS3004c",
|
221 |
+
"TS3004d",
|
222 |
+
"IB4001",
|
223 |
+
"IB4002",
|
224 |
+
"IB4003",
|
225 |
+
"IB4004",
|
226 |
+
"IB4010",
|
227 |
+
"IB4011",
|
228 |
+
]
|
229 |
+
|
230 |
+
|
231 |
+
_EVAL_SAMPLE_IDS = [
|
232 |
+
"ES2004a",
|
233 |
+
"ES2004b",
|
234 |
+
"ES2004c",
|
235 |
+
"ES2004d",
|
236 |
+
"IS1009a",
|
237 |
+
"IS1009b",
|
238 |
+
"IS1009c",
|
239 |
+
"IS1009d",
|
240 |
+
"TS3003a",
|
241 |
+
"TS3003b",
|
242 |
+
"TS3003c",
|
243 |
+
"TS3003d",
|
244 |
+
"EN2002a",
|
245 |
+
"EN2002b",
|
246 |
+
"EN2002c",
|
247 |
+
"EN2002d",
|
248 |
+
]
|
249 |
+
|
250 |
+
|
251 |
+
_DESCRIPTION = """\
|
252 |
+
The AMI Meeting Corpus consists of 100 hours of meeting recordings. The recordings use a range of signals
|
253 |
+
synchronized to a common timeline. These include close-talking and far-field microphones, individual and
|
254 |
+
room-view video cameras, and output from a slide projector and an electronic whiteboard. During the meetings,
|
255 |
+
the participants also have unsynchronized pens available to them that record what is written. The meetings
|
256 |
+
were recorded in English using three different rooms with different acoustic properties, and include mostly
|
257 |
+
non-native speakers. \n
|
258 |
+
"""
|
259 |
+
|
260 |
+
|
261 |
+
class AMIConfig(datasets.BuilderConfig):
|
262 |
+
"""BuilderConfig for LibriSpeechASR."""
|
263 |
+
|
264 |
+
def __init__(self, formats, missing_files=None, **kwargs):
|
265 |
+
"""
|
266 |
+
Args:
|
267 |
+
formats: `List[string]`, a list of audio file formats
|
268 |
+
missing_files: `List[string]`, a list of missing audio file ids
|
269 |
+
**kwargs: keyword arguments forwarded to super.
|
270 |
+
"""
|
271 |
+
self.dl_path_formats = [_DL_SAMPLE_FORMAT + "." + f + ".wav" for f in formats]
|
272 |
+
|
273 |
+
# for microphone configs some audio files are missing
|
274 |
+
self.missing_files = missing_files if missing_files is not None else []
|
275 |
+
super(AMIConfig, self).__init__(version=datasets.Version("1.6.2", ""), **kwargs)
|
276 |
+
|
277 |
+
|
278 |
+
class AMI(datasets.GeneratorBasedBuilder):
|
279 |
+
"""AMI dataset."""
|
280 |
+
|
281 |
+
BUILDER_CONFIGS = [
|
282 |
+
AMIConfig(name="headset-single", formats=["Mix-Headset"], description=""),
|
283 |
+
AMIConfig(name="headset-multi", formats=["Headset-0", "Headset-1", "Headset-2", "Headset-3"], description=""),
|
284 |
+
AMIConfig(
|
285 |
+
name="microphone-single",
|
286 |
+
formats=["Array1-01"],
|
287 |
+
missing_files=["IS1003b", "IS1007d"],
|
288 |
+
),
|
289 |
+
AMIConfig(
|
290 |
+
name="microphone-multi",
|
291 |
+
formats=[
|
292 |
+
"Array1-01",
|
293 |
+
"Array1-02",
|
294 |
+
"Array1-03",
|
295 |
+
"Array1-04",
|
296 |
+
"Array1-05",
|
297 |
+
"Array1-06",
|
298 |
+
"Array1-07",
|
299 |
+
"Array1-08",
|
300 |
+
],
|
301 |
+
missing_files=["IS1003b", "IS1007d"],
|
302 |
+
),
|
303 |
+
]
|
304 |
+
|
305 |
+
def _info(self):
|
306 |
+
features_dict = {
|
307 |
+
"word_ids": datasets.Sequence(datasets.Value("string")),
|
308 |
+
"word_start_times": datasets.Sequence(datasets.Value("float")),
|
309 |
+
"word_end_times": datasets.Sequence(datasets.Value("float")),
|
310 |
+
"word_speakers": datasets.Sequence(datasets.Value("string")),
|
311 |
+
"segment_ids": datasets.Sequence(datasets.Value("string")),
|
312 |
+
"segment_start_times": datasets.Sequence(datasets.Value("float")),
|
313 |
+
"segment_end_times": datasets.Sequence(datasets.Value("float")),
|
314 |
+
"segment_speakers": datasets.Sequence(datasets.Value("string")),
|
315 |
+
"words": datasets.Sequence(datasets.Value("string")),
|
316 |
+
"channels": datasets.Sequence(datasets.Value("string")),
|
317 |
+
}
|
318 |
+
|
319 |
+
if self.config.name == "headset-single":
|
320 |
+
features_dict.update({"file": datasets.Value("string")})
|
321 |
+
config_description = (
|
322 |
+
"Close talking audio of single headset. "
|
323 |
+
"This configuration only includes audio belonging to the "
|
324 |
+
"headset of the person currently speaking."
|
325 |
+
)
|
326 |
+
elif self.config.name == "microphone-single":
|
327 |
+
features_dict.update({"file": datasets.Value("string")})
|
328 |
+
config_description = (
|
329 |
+
"Far field audio of single microphone. "
|
330 |
+
"This configuration only includes audio belonging the first microphone, "
|
331 |
+
"*i.e.* 1-1, of the microphone array."
|
332 |
+
)
|
333 |
+
elif self.config.name == "headset-multi":
|
334 |
+
features_dict.update(
|
335 |
+
{
|
336 |
+
"file-0": datasets.Value("string"),
|
337 |
+
"file-1": datasets.Value("string"),
|
338 |
+
"file-2": datasets.Value("string"),
|
339 |
+
"file-3": datasets.Value("string"),
|
340 |
+
}
|
341 |
+
)
|
342 |
+
config_description = (
|
343 |
+
"Close talking audio of four individual headset. "
|
344 |
+
"This configuration includes audio belonging to four individual headsets."
|
345 |
+
" For each annotation there are 4 audio files 0, 1, 2, 3."
|
346 |
+
)
|
347 |
+
elif self.config.name == "microphone-multi":
|
348 |
+
features_dict.update(
|
349 |
+
{
|
350 |
+
"file-1-1": datasets.Value("string"),
|
351 |
+
"file-1-2": datasets.Value("string"),
|
352 |
+
"file-1-3": datasets.Value("string"),
|
353 |
+
"file-1-4": datasets.Value("string"),
|
354 |
+
"file-1-5": datasets.Value("string"),
|
355 |
+
"file-1-6": datasets.Value("string"),
|
356 |
+
"file-1-7": datasets.Value("string"),
|
357 |
+
"file-1-8": datasets.Value("string"),
|
358 |
+
}
|
359 |
+
)
|
360 |
+
config_description = (
|
361 |
+
"Far field audio of microphone array. "
|
362 |
+
"This configuration includes audio of "
|
363 |
+
"the first microphone array 1-1, 1-2, ..., 1-8."
|
364 |
+
)
|
365 |
+
else:
|
366 |
+
raise ValueError(f"Configuration {self.config.name} does not exist.")
|
367 |
+
|
368 |
+
return datasets.DatasetInfo(
|
369 |
+
description=_DESCRIPTION + config_description,
|
370 |
+
features=datasets.Features(features_dict),
|
371 |
+
homepage=_URL,
|
372 |
+
citation=_CITATION,
|
373 |
+
)
|
374 |
+
|
375 |
+
def _split_generators(self, dl_manager):
|
376 |
+
|
377 |
+
# multi-processing doesn't work for AMI
|
378 |
+
if hasattr(dl_manager, "_download_config") and dl_manager._download_config.num_proc != 1:
|
379 |
+
logger.warning(
|
380 |
+
"AMI corpus cannot be downloaded using multi-processing. "
|
381 |
+
"Setting number of downloaded processes `num_proc` to 1. "
|
382 |
+
)
|
383 |
+
dl_manager._download_config.num_proc = 1
|
384 |
+
|
385 |
+
annotation_path = dl_manager.download_and_extract(_DL_URL_ANNOTATIONS)
|
386 |
+
|
387 |
+
# train
|
388 |
+
train_files = [path.format(_id, _id) for _id in _TRAIN_SAMPLE_IDS for path in self.config.dl_path_formats]
|
389 |
+
train_files = list(
|
390 |
+
filter(lambda f: f.split("/")[-1].split(".")[0] not in self.config.missing_files, train_files)
|
391 |
+
)
|
392 |
+
train_ids = [f.split("/")[-1].split(".")[0] for f in train_files]
|
393 |
+
train_path = dl_manager.download_and_extract(train_files)
|
394 |
+
|
395 |
+
# validation
|
396 |
+
validation_files = [
|
397 |
+
path.format(_id, _id) for _id in _VALIDATION_SAMPLE_IDS for path in self.config.dl_path_formats
|
398 |
+
]
|
399 |
+
validation_ids = [f.split("/")[-1].split(".")[0] for f in validation_files]
|
400 |
+
validation_path = dl_manager.download_and_extract(validation_files)
|
401 |
+
|
402 |
+
# test
|
403 |
+
eval_files = [path.format(_id, _id) for _id in _EVAL_SAMPLE_IDS for path in self.config.dl_path_formats]
|
404 |
+
eval_ids = [f.split("/")[-1].split(".")[0] for f in eval_files]
|
405 |
+
eval_path = dl_manager.download_and_extract(eval_files)
|
406 |
+
|
407 |
+
return [
|
408 |
+
datasets.SplitGenerator(
|
409 |
+
name=datasets.Split.TRAIN,
|
410 |
+
gen_kwargs={
|
411 |
+
"annotation_path": annotation_path,
|
412 |
+
"samples_paths": train_path,
|
413 |
+
"ids": _TRAIN_SAMPLE_IDS,
|
414 |
+
"verification_ids": train_ids,
|
415 |
+
},
|
416 |
+
),
|
417 |
+
datasets.SplitGenerator(
|
418 |
+
name=datasets.Split.VALIDATION,
|
419 |
+
gen_kwargs={
|
420 |
+
"annotation_path": annotation_path,
|
421 |
+
"samples_paths": validation_path,
|
422 |
+
"ids": _VALIDATION_SAMPLE_IDS,
|
423 |
+
"verification_ids": validation_ids,
|
424 |
+
},
|
425 |
+
),
|
426 |
+
datasets.SplitGenerator(
|
427 |
+
name=datasets.Split.TEST,
|
428 |
+
gen_kwargs={
|
429 |
+
"annotation_path": annotation_path,
|
430 |
+
"samples_paths": eval_path,
|
431 |
+
"ids": _EVAL_SAMPLE_IDS,
|
432 |
+
"verification_ids": eval_ids,
|
433 |
+
},
|
434 |
+
),
|
435 |
+
]
|
436 |
+
|
437 |
+
@staticmethod
|
438 |
+
def _sort(key, lists):
|
439 |
+
indices = np.argsort(key)
|
440 |
+
|
441 |
+
sorted_lists = [np.array(array)[indices].tolist() for array in lists]
|
442 |
+
return sorted_lists
|
443 |
+
|
444 |
+
@staticmethod
|
445 |
+
def _extract_words_annotations(paths):
|
446 |
+
word_ids = []
|
447 |
+
word_start_times = []
|
448 |
+
word_end_times = []
|
449 |
+
words = []
|
450 |
+
word_speakers = []
|
451 |
+
|
452 |
+
for path in paths:
|
453 |
+
# retrive speaker
|
454 |
+
speaker = path.split(".")[-3]
|
455 |
+
|
456 |
+
with open(path, "r", encoding="utf-8") as words_file:
|
457 |
+
root = ET.parse(words_file).getroot()
|
458 |
+
for type_tag in root.findall("w"):
|
459 |
+
word_id = type_tag.get("{http://nite.sourceforge.net/}id")
|
460 |
+
|
461 |
+
word_start_time = type_tag.get("starttime")
|
462 |
+
word_end_time = type_tag.get("endtime")
|
463 |
+
text = type_tag.text
|
464 |
+
|
465 |
+
if word_start_time is not None and word_end_time is not None:
|
466 |
+
word_ids.append(word_id)
|
467 |
+
word_start_times.append(float(word_start_time))
|
468 |
+
word_end_times.append(float(word_end_time))
|
469 |
+
words.append(text)
|
470 |
+
word_speakers.append(speaker)
|
471 |
+
else:
|
472 |
+
logger.warning(
|
473 |
+
f"Annotation {word_id} of file {path} is missing information about"
|
474 |
+
"either word_start_time or word_end_time. Skipping sample..."
|
475 |
+
)
|
476 |
+
|
477 |
+
return AMI._sort(word_start_times, [word_ids, word_start_times, word_end_times, words, word_speakers])
|
478 |
+
|
479 |
+
@staticmethod
|
480 |
+
def _extract_segments_annotations(paths):
|
481 |
+
segment_ids = []
|
482 |
+
channels = []
|
483 |
+
segment_start_times = []
|
484 |
+
segment_end_times = []
|
485 |
+
segment_speakers = []
|
486 |
+
|
487 |
+
for path in paths:
|
488 |
+
speaker = path.split(".")[-3]
|
489 |
+
|
490 |
+
with open(path, "r", encoding="utf-8") as segments_file:
|
491 |
+
root = ET.parse(segments_file).getroot()
|
492 |
+
for type_tag in root.findall("segment"):
|
493 |
+
segment_ids.append(type_tag.get("{http://nite.sourceforge.net/}id"))
|
494 |
+
segment_start_times.append(float(type_tag.get("transcriber_start")))
|
495 |
+
segment_end_times.append(float(type_tag.get("transcriber_end")))
|
496 |
+
channels.append(type_tag.get("channel"))
|
497 |
+
segment_speakers.append(speaker)
|
498 |
+
|
499 |
+
return AMI._sort(
|
500 |
+
segment_start_times, [segment_ids, segment_start_times, segment_end_times, channels, segment_speakers]
|
501 |
+
)
|
502 |
+
|
503 |
+
def _generate_examples(self, annotation_path, samples_paths, ids, verification_ids):
|
504 |
+
logger.info(f"⏳ Generating {', '.join(ids)}")
|
505 |
+
|
506 |
+
# number of audio files of config
|
507 |
+
num_audios = len(self.config.dl_path_formats)
|
508 |
+
|
509 |
+
# filter missing ids
|
510 |
+
ids = list(filter(lambda n: n not in self.config.missing_files, ids))
|
511 |
+
|
512 |
+
# audio
|
513 |
+
samples_paths_dict = {}
|
514 |
+
for i, _id in enumerate(ids):
|
515 |
+
sample_paths = samples_paths[num_audios * i : num_audios * (i + 1)]
|
516 |
+
sample_verification_id = set(verification_ids[num_audios * i : num_audios * (i + 1)])
|
517 |
+
|
518 |
+
# make sure that multi microphone samples are correctly atttributed to labels
|
519 |
+
if len(sample_verification_id) > 1 or next(iter(sample_verification_id)) != _id:
|
520 |
+
raise ValueError(
|
521 |
+
f"Incorrect dataset generation. The files {sample_paths} of id {_id} have incorrect verification_ids {sample_verification_id}."
|
522 |
+
)
|
523 |
+
|
524 |
+
# set correct files correctly
|
525 |
+
samples_paths_dict[_id] = sample_paths
|
526 |
+
|
527 |
+
# words
|
528 |
+
words_paths = {
|
529 |
+
_id: [os.path.join(annotation_path, "words/{}.{}.words.xml".format(_id, speaker)) for speaker in _SPEAKERS]
|
530 |
+
for _id in ids
|
531 |
+
}
|
532 |
+
words_paths = {_id: list(filter(lambda path: os.path.isfile(path), words_paths[_id])) for _id in ids}
|
533 |
+
words_paths = {key: words_paths[key] for key in words_paths if len(words_paths[key]) > 0}
|
534 |
+
|
535 |
+
# segments
|
536 |
+
segments_paths = {
|
537 |
+
_id: [
|
538 |
+
os.path.join(annotation_path, "segments/{}.{}.segments.xml".format(_id, speaker))
|
539 |
+
for speaker in _SPEAKERS
|
540 |
+
]
|
541 |
+
for _id in ids
|
542 |
+
}
|
543 |
+
segments_paths = {_id: list(filter(lambda path: os.path.isfile(path), segments_paths[_id])) for _id in ids}
|
544 |
+
segments_paths = {key: segments_paths[key] for key in segments_paths if len(segments_paths[key]) > 0}
|
545 |
+
|
546 |
+
for _id in words_paths.keys():
|
547 |
+
word_ids, word_start_times, word_end_times, words, word_speakers = self._extract_words_annotations(
|
548 |
+
words_paths[_id]
|
549 |
+
)
|
550 |
+
|
551 |
+
(
|
552 |
+
segment_ids,
|
553 |
+
segment_start_times,
|
554 |
+
segment_end_times,
|
555 |
+
channels,
|
556 |
+
segment_speakers,
|
557 |
+
) = self._extract_segments_annotations(segments_paths[_id])
|
558 |
+
|
559 |
+
result = {
|
560 |
+
"word_ids": word_ids,
|
561 |
+
"word_start_times": word_start_times,
|
562 |
+
"word_end_times": word_end_times,
|
563 |
+
"word_speakers": word_speakers,
|
564 |
+
"segment_ids": segment_ids,
|
565 |
+
"segment_start_times": segment_start_times,
|
566 |
+
"segment_end_times": segment_end_times,
|
567 |
+
"segment_speakers": segment_speakers,
|
568 |
+
"channels": channels,
|
569 |
+
"words": words,
|
570 |
+
}
|
571 |
+
|
572 |
+
if self.config.name in ["headset-single", "microphone-single"]:
|
573 |
+
result.update({"file": samples_paths_dict[_id][0]})
|
574 |
+
elif self.config.name in ["headset-multi"]:
|
575 |
+
result.update({f"file-{i}": samples_paths_dict[_id][i] for i in range(num_audios)})
|
576 |
+
elif self.config.name in ["microphone-multi"]:
|
577 |
+
result.update({f"file-1-{i+1}": samples_paths_dict[_id][i] for i in range(num_audios)})
|
578 |
+
else:
|
579 |
+
raise ValueError(f"Configuration {self.config.name} does not exist.")
|
580 |
+
|
581 |
+
yield _id, result
|
dataset_infos.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
dummy/headset-multi/1.6.2/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ec3d9c11ef6c29bdf89592e5ae3b88b2336ff055ab362be138c5827c5999dee
|
3 |
+
size 48550
|
dummy/headset-single/1.6.2/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ec3d9c11ef6c29bdf89592e5ae3b88b2336ff055ab362be138c5827c5999dee
|
3 |
+
size 48550
|
dummy/microphone-multi/1.6.2/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ec3d9c11ef6c29bdf89592e5ae3b88b2336ff055ab362be138c5827c5999dee
|
3 |
+
size 48550
|
dummy/microphone-single/1.6.2/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ec3d9c11ef6c29bdf89592e5ae3b88b2336ff055ab362be138c5827c5999dee
|
3 |
+
size 48550
|