File size: 4,114 Bytes
e602007
 
f2f380f
 
 
8ed37b4
f2f380f
8ed37b4
b179bff
 
 
 
 
 
 
 
 
 
 
 
f2f380f
 
 
 
26d37cb
 
f2f380f
 
ac6a6c7
 
 
 
d8e7521
ac6a6c7
 
 
 
 
 
 
57ca9f9
 
 
4f1e40e
57ca9f9
829da9c
57ca9f9
ac6a6c7
 
 
 
 
 
 
 
 
 
 
43882d2
 
ac6a6c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3c6ee3
 
9ffab83
b3c6ee3
 
 
 
 
9ffab83
b3c6ee3
 
 
 
 
 
 
 
 
 
d8e7521
 
 
 
 
 
ac6a6c7
 
e65f332
ac6a6c7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
configs:
- config_name: 20k
  data_files:
  - split: train
    path: 20k/train/*.tar
  - split: test
    path: 20k/test/*.tar
- config_name: 500k
  data_files:
  - split: train
    path: 500k/train/*.tar
  - split: test
    path: 500k/test/*.tar
- config_name: 2m
  data_files:
  - split: train
    path: 2m/train/*.tar
  - split: test
    path: 2m/test/*.tar
task_categories:
- audio-classification
tags:
- audio
- multi-label
- webdataset
size_categories:
- 1M<n<10M
---

# AudioSet

AudioSet<sup>[1]</sup> is a large-scale dataset comprising approximately 2 million 10-second YouTube audio clips, categorised into 527 sound classes. 
We have pre-processed all audio files to a 16 kHz sampling rate and stored them in the WebDataset format for efficient large-scale training and retrieval.

## Download

We recommend using the following commands to download the `confit/audioset-16khz-wds` dataset from HuggingFace. 
The dataset is available in two versions:

 - train:
   - 20k: A smaller balanced version with 20,550 clips for quick experimentation.
   - 500k<sup>[2]</sup>: A (slightly more) balanced version with 497,982 clips for quick experimentation.
   - 2m: The complete unbalanced dataset with 1,912,024 clips.
 - test: The eval set with 18,886 clips.

> **_NOTE:_** All versions of train sets share the same test set.

```bash
# For the 20k version
huggingface-cli download confit/audioset-16khz-wds --include 20k/train/*.tar  --repo-type=dataset --local-dir /path/to/store
huggingface-cli download confit/audioset-16khz-wds --include 20k/test/*.tar  --repo-type=dataset --local-dir /path/to/store

# For the 2m version
huggingface-cli download confit/audioset-16khz-wds --include 2m/train/*.tar  --repo-type=dataset --local-dir /path/to/store
huggingface-cli download confit/audioset-16khz-wds --include 2m/test/*.tar  --repo-type=dataset --local-dir /path/to/store
```

> **_NOTE:_** The `--local-dir /path/to/store` argument specifies the root directory where the dataset will be stored. You do not need to manually create subdirectories (e.g., `/path/to/store/20k/train`). The command will automatically create the required folder structure.

## Format and Usage

The dataset is stored in the WebDataset (WDS) format, which is optimised for distributed training and streaming. 
Each `.tar` archive contains audio files and corresponding metadata.

To load the dataset in Python using webdataset:

```python
train_base_url = '/path/to/20k/train/shard-{i:05d}.tar'
train_urls = [train_base_url.format(i=i) for i in range(7)]

test_base_url = '/path/to/20k/test/shard-{i:05d}.tar'
test_urls = [test_base_url.format(i=i) for i in range(6)]

raw_datasets = load_dataset(
    "webdataset",
    data_files={"train": train_urls, "test": test_urls},
    streaming=False
)
```

Each sample in the dataset follows the WebDataset format, which includes the following fields:

```plain
{
    '__key__': 'sample-000000000',
    '__url__': '/path/to/20k/train/shard-00000.tar',
    'wav': {
        'path': 'sample-000000000.wav',
        'array': array([ 0., ..., -0.00256348]),
        'sampling_rate': 16000
    },
    'json': {
        'id': 'YUJxAKoY0gRM',
        'label': ['Clarinet'],
        'label_id': [198]
    }
}
```

## References

[1] Gemmeke, J. F., Ellis, D. P., Freedman, D., Jansen, A., Lawrence, W., Moore, R. C., ... & Ritter, M. (2017, March). Audio set: An ontology and human-labeled dataset for audio events. In 2017 IEEE international conference on acoustics, speech and signal processing (ICASSP) (pp. 776-780). IEEE.

[2] Nagrani, A., Yang, S., Arnab, A., Jansen, A., Schmid, C., & Sun, C. (2021). Attention bottlenecks for multimodal fusion. Advances in neural information processing systems, 34, 14200-14213.

## License and Usage Restrictions

We downloaded the dataset from qiuqiangkong's [GitHub](https://github.com/qiuqiangkong/audioset_tagging_cnn) and pre-processed it into WebDataset format. 
Please ensure compliance with YouTube's terms of service when using this dataset. 
Some clips may no longer be available if the original videos have been removed or made private.