Datasets:
Tasks:
Audio Classification
Sub-tasks:
keyword-spotting
Languages:
English
Size:
100K<n<1M
ArXiv:
License:
Convert dataset to Parquet
#5
by lhoestq HF Staff - opened
Files changed (16)
- README.md+27-13
- speech_commands.pyDeleted-229
- v0.01/test-00000-of-00001.parquetAdded+3
- v0.01/train-00000-of-00004.parquetAdded+3
- v0.01/train-00001-of-00004.parquetAdded+3
- v0.01/train-00002-of-00004.parquetAdded+3
- v0.01/train-00003-of-00004.parquetAdded+3
- v0.01/validation-00000-of-00001.parquetAdded+3
- v0.02/test-00000-of-00001.parquetAdded+3
- v0.02/train-00000-of-00006.parquetAdded+3
- v0.02/train-00001-of-00006.parquetAdded+3
- v0.02/train-00002-of-00006.parquetAdded+3
- v0.02/train-00003-of-00006.parquetAdded+3
- v0.02/train-00004-of-00006.parquetAdded+3
- v0.02/train-00005-of-00006.parquetAdded+3
- v0.02/validation-00000-of-00001.parquetAdded+3
70 unmodified lines71727374747576777778798080818283828384858650 unmodified lines13713813914014014114214314314414514614614714814914814915015115215315415515615715815916016116216316416516616716816917017117265 unmodified lines23823924022424124224310 unmodified lines25425525624125725825911 unmodified lines27127227325927427527670 unmodified lines dtype: int8 splits: - name: train num_bytes: 1626283624 num_bytes: 1624802079.0 num_examples: 51093 - name: validation num_bytes: 217204539 num_bytes: 217003968.304 num_examples: 6799 - name: test num_bytes: 98979965 num_bytes: 98888548.326 num_examples: 3081 download_size: 1454702755 dataset_size: 1942468128 download_size: 1794668711 dataset_size: 1940694595.6299999- config_name: v0.02 features: - name: file50 unmodified lines dtype: int8 splits: - name: train num_bytes: 2684381672 num_bytes: 2681496094.824 num_examples: 84848 - name: validation num_bytes: 316435178 num_bytes: 316135541.396 num_examples: 9982 - name: test num_bytes: 157096106 num_bytes: 156951097.18 num_examples: 4890 download_size: 2285975869 dataset_size: 3157912956 download_size: 2908293664 dataset_size: 3154582733.3999996config_names:- v0.01- v0.02configs:- config_name: v0.01 data_files: - split: train path: v0.01/train-* - split: validation path: v0.01/validation-* - split: test path: v0.01/test-*- config_name: v0.02 data_files: - split: train path: v0.02/train-* - split: validation path: v0.02/validation-* - split: test path: v0.02/test-*---
# Dataset Card for SpeechCommands65 unmodified lines{ "file": "no/7846fd85_nohash_0.wav", "audio": { "path": "no/7846fd85_nohash_0.wav", "array": array([ -0.00021362, -0.00027466, -0.00036621, ..., 0.00079346, 0.00091553, 0.00079346]), "sampling_rate": 1600010 unmodified lines{ "file": "tree/8b775397_nohash_0.wav", "audio": { "path": "tree/8b775397_nohash_0.wav", "array": array([ -0.00854492, -0.01339722, -0.02026367, ..., 0.00274658, 0.00335693, 0.0005188]), "sampling_rate": 1600011 unmodified lines{ "file": "_silence_/doing_the_dishes.wav", "audio": { "path": "_silence_/doing_the_dishes.wav", "array": array([ 0. , 0. , 0. , ..., -0.00592041, -0.00405884, -0.00253296]), "sampling_rate": 16000123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229# coding=utf-8# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.
"""Speech Commands, an audio dataset of spoken words designed to help train and evaluate keyword spotting systems. """
import textwrap
import datasets
_CITATION = """@article{speechcommandsv2, author = { {Warden}, P.}, title = "{Speech Commands: A Dataset for Limited-Vocabulary Speech Recognition}", journal = {ArXiv e-prints}, archivePrefix = "arXiv", eprint = {1804.03209}, primaryClass = "cs.CL", keywords = {Computer Science - Computation and Language, Computer Science - Human-Computer Interaction}, year = 2018, month = apr, url = {https://arxiv.org/abs/1804.03209},}"""
_DESCRIPTION = """This is a set of one-second .wav audio files, each containing a single spokenEnglish word or background noise. These words are from a small set of commands, and are spoken by avariety of different speakers. This data set is designed to help train simplemachine learning models. This dataset is covered in more detail at[https://arxiv.org/abs/1804.03209](https://arxiv.org/abs/1804.03209).
Version 0.01 of the data set (configuration `"v0.01"`) was released on August 3rd 2017 and contains64,727 audio files.
In version 0.01 thirty different words were recoded: "Yes", "No", "Up", "Down", "Left","Right", "On", "Off", "Stop", "Go", "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine","Bed", "Bird", "Cat", "Dog", "Happy", "House", "Marvin", "Sheila", "Tree", "Wow".
In version 0.02 more words were added: "Backward", "Forward", "Follow", "Learn", "Visual".
In both versions, ten of them are used as commands by convention: "Yes", "No", "Up", "Down", "Left","Right", "On", "Off", "Stop", "Go". Other words are considered to be auxiliary (in current implementationit is marked by `True` value of `"is_unknown"` feature). Their function is to teach a model to distinguish core wordsfrom unrecognized ones.
The `_silence_` class contains a set of longer audio clips that are either recordings ora mathematical simulation of noise.
"""
_LICENSE = "Creative Commons BY 4.0 License"
_URL = "https://www.tensorflow.org/datasets/catalog/speech_commands"
_DL_URL = "https://s3.amazonaws.com/datasets.huggingface.co/SpeechCommands/{name}/{name}_{split}.tar.gz"
WORDS = [ "yes", "no", "up", "down", "left", "right", "on", "off", "stop", "go",]
UNKNOWN_WORDS_V1 = [ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "bed", "bird", "cat", "dog", "happy", "house", "marvin", "sheila", "tree", "wow",]
UNKNOWN_WORDS_V2 = UNKNOWN_WORDS_V1 + [ "backward", "forward", "follow", "learn", "visual",]
SILENCE = "_silence_" # background noiseLABELS_V1 = WORDS + UNKNOWN_WORDS_V1 + [SILENCE]LABELS_V2 = WORDS + UNKNOWN_WORDS_V2 + [SILENCE]
class SpeechCommandsConfig(datasets.BuilderConfig): """BuilderConfig for SpeechCommands."""
def __init__(self, labels, **kwargs): super(SpeechCommandsConfig, self).__init__(**kwargs) self.labels = labels
class SpeechCommands(datasets.GeneratorBasedBuilder): BUILDER_CONFIGS = [ SpeechCommandsConfig( name="v0.01", description=textwrap.dedent( """\ Version 0.01 of the SpeechCommands dataset. Contains 30 words (20 of them are auxiliary) and background noise. """ ), labels=LABELS_V1, version=datasets.Version("0.1.0"), ), SpeechCommandsConfig( name="v0.02", description=textwrap.dedent( """\ Version 0.02 of the SpeechCommands dataset. Contains 35 words (25 of them are auxiliary) and background noise. """ ), labels=LABELS_V2, version=datasets.Version("0.2.0"), ), ]
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "file": datasets.Value("string"), "audio": datasets.features.Audio(sampling_rate=16_000), "label": datasets.ClassLabel(names=self.config.labels), "is_unknown": datasets.Value("bool"), "speaker_id": datasets.Value("string"), "utterance_id": datasets.Value("int8"), } ), homepage=_URL, citation=_CITATION, license=_LICENSE, version=self.config.version, )
def _split_generators(self, dl_manager):
archive_paths = dl_manager.download( { "train": _DL_URL.format(name=self.config.name, split="train"), "validation": _DL_URL.format(name=self.config.name, split="validation"), "test": _DL_URL.format(name=self.config.name, split="test"), } )
return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={ "archive": dl_manager.iter_archive(archive_paths["train"]), }, ), datasets.SplitGenerator( name=datasets.Split.VALIDATION, gen_kwargs={ "archive": dl_manager.iter_archive(archive_paths["validation"]), }, ), datasets.SplitGenerator( name=datasets.Split.TEST, gen_kwargs={ "archive": dl_manager.iter_archive(archive_paths["test"]), }, ), ]
def _generate_examples(self, archive): for path, file in archive: if not path.endswith(".wav"): continue
word, audio_filename = path.split("/") is_unknown = False
if word == SILENCE: speaker_id, utterance_id = None, 0
else: # word is either in WORDS or unknown if word not in WORDS: is_unknown = True # an audio filename looks like `0bac8a71_nohash_0.wav` speaker_id, _, utterance_id = audio_filename.split(".wav")[0].split("_")
yield path, { "file": path, "audio": {"path": path, "bytes": file.read()}, "label": word, "is_unknown": is_unknown, "speaker_id": speaker_id, "utterance_id": utterance_id, }123version https://git-lfs.github.com/spec/v1oid sha256:04643a87596682601f4b583f537ce744c495d94f77c06e91b57a1c6f0568b898size 91044673123version https://git-lfs.github.com/spec/v1oid sha256:d736a87eacfe4d812310915634f62d2cca082a5387088fcee07ab52763adda7esize 373442836123version https://git-lfs.github.com/spec/v1oid sha256:8e1ba8620b5ac74c496740df659f903147e393765a16fbe91d1f3bcf72a8f35dsize 374547021123version https://git-lfs.github.com/spec/v1oid sha256:9a6854c9a931f6d42420950b7a76b8a1e19ec4fd1e6be780b7756dd7a862cbdcsize 385509512123version https://git-lfs.github.com/spec/v1oid sha256:8ea289a60ae5f5bd46d610ace1e41ff771cb1bf81e49fc03a72b13793081206fsize 371839017123version https://git-lfs.github.com/spec/v1oid sha256:60b49c5f4c679018f84ffc42a670e9ebc55dc66cefd7e852eac4e86aaebfb53csize 198285652123version https://git-lfs.github.com/spec/v1oid sha256:6446af16af8ef28423c57aac7ec0faf091905e2580afcaca5e7733188b6ee85asize 142673940123version https://git-lfs.github.com/spec/v1oid sha256:3104193b88158e7f507ecedd249283b1bfacd23bc84fde2d424df86bb9ca6279size 408752040123version https://git-lfs.github.com/spec/v1oid sha256:571445a0fa82c0f6c8c92c4545baf836bbe9f439326c9bd8e6b6a3dc8de6b7ffsize 409078516123version https://git-lfs.github.com/spec/v1oid sha256:f49d14a179e15fc861c708c9cb66479ab8fe8b96cdbfe06e2d8638b7faf4c1efsize 412384667123version https://git-lfs.github.com/spec/v1oid sha256:e1e8d9e798b45053015632233265d0f6522b51f23eae80d75f96205acb545ff7size 408330296123version https://git-lfs.github.com/spec/v1oid sha256:18e1c61afe006401155334731fb27a338a50a65933e0fef71a3eb2204b15a3a0size 426640461123version https://git-lfs.github.com/spec/v1oid sha256:281d138d5dd89150b55b0f3ca8ccf1ccd5e63557d4972b64a787df11984e28cdsize 408650563123version https://git-lfs.github.com/spec/v1oid sha256:06683ef0761319a415ee516939c64b9b7a20be0b6bb17ce8d2b6e36abe373a46size 291783181README.md+27-13
speech_commands.pyDeleted-229
v0.01/test-00000-of-00001.parquetAdded+3
v0.01/train-00000-of-00004.parquetAdded+3
v0.01/train-00001-of-00004.parquetAdded+3
v0.01/train-00002-of-00004.parquetAdded+3
v0.01/train-00003-of-00004.parquetAdded+3
v0.01/validation-00000-of-00001.parquetAdded+3
v0.02/test-00000-of-00001.parquetAdded+3
v0.02/train-00000-of-00006.parquetAdded+3
v0.02/train-00001-of-00006.parquetAdded+3
v0.02/train-00002-of-00006.parquetAdded+3
v0.02/train-00003-of-00006.parquetAdded+3
v0.02/train-00004-of-00006.parquetAdded+3
v0.02/train-00005-of-00006.parquetAdded+3
v0.02/validation-00000-of-00001.parquetAdded+3