提取并预处理主要开源(主要是非商业)语音音频数据集
项目描述
提取并预处理主要开源语音音频数据集
支持的数据集
Librispeech (60GB)
TEDLIUM_release2 (35GB)
VCTK-Corpus (11GB)
此软件适用于Linux服务器,并期望您将使用该库来为机器学习系统提供数据(不是必需的,但这基本上是收集这些数据集的目的所在)
软件的MIT许可证,但请注意,数据集本身通常仅限非商业使用
功能
下载常见的开源数据集,并对它们进行基本预处理
提供可迭代对象,可以从常见格式的音频数据生成Numpy数组
使用sphfile直接访问sph文件,而不是需要先转换为wav
为多个项目打算使用的集合使用单个共享位置
安装/设置
您需要创建下载目录并使其可由运行用户写入。最好通过基于组的权限来完成此操作以允许共享,但在这里我们将展示创建用户特定的所有权
$ mkdir -p /var/datasets $ chown user:group /var/datasets $ chmod g+rw /var/datasets
如果/var/datasets不存在或不可写,下载器将使用数据填充~/.config/datasets。您可能希望将此目录链接到/var/datasets,以便您可以使用语料库的默认实例
$ ln -s /var/datasets ~/.config/datasets
请注意,下载器期望您有以下内容,这可能在Docker或最小OS安装中尚不存在
tar
wget
现在您可以下载数据集了。
从命令提示符
$ pip install audiodatasets # this will download 100+GB and then unpack it on disk, it will take a while... $ audiodatasets-download
创建MFCC数据文件
# this will generate Multi-frequency Cepestral Coefficient (MFCC) summaries for the # audio datasets (and download them if that hasn't been done). This isn't necessary # if you are doing only raw-audio processing $ audiodatasets-preprocess
播放一些音频
# this will iterate through playing every utterance that includes 'moon' in the transcript $ audiodatasets-search 'moon'
用法
设置完成后,您可能希望使用分区等来迭代数据集,以分离测试/训练/验证数据。例如,要迭代原始音频
from audiodatasets.corpora import build_corpora, partition
import random
def train_valid_test():
"""Create training, validation and tests datasets
returns three iterators yielding (array[10:512],transcript) batches
"""
utterances = []
for corpus in build_corpora():
utterances.extend( corpus.iter_utterances())
random.shuffle(utterances)
train, test,valid = partition( utterances, (3,1,1) )
def generation( utterances ):
while True:
offset = random.randint(0,511)
for name,transcript,audio_file in utterances:
for batch in t.iter_batches( audio_file, batch_size=10, input=512, offset=offset ):
yield batch,transcript
return generation(train),generation(test),generation(valid)
要迭代10毫秒的MFCC预处理数据,每个处理窗口(10毫秒)产生20个频率批次
from audiodatasets.corpora import build_corpora, partition
import random
def train_valid_test():
"""Create training, validation and tests datasets
Note: the batches vary in *time* at highest frequency, while
the frequency bins are the second-highest frequency.
See: `LibRosa MFCC <https://librosa.github.io/librosa/generated/librosa.feature.mfcc.html>`_
returns three iterators yielding (array[10:20:63],transcript) batches
"""
utterances = []
for corpus in build_corpora():
utterances.extend( corpus.mfcc_utterances())
random.shuffle(utterances)
train, test,valid = partition( utterances, (3,1,1) )
def generation( utterances ):
while True:
offset = random.randint(0,62)
for name,transcript,audio_file in utterances:
for batch in t.iter_batches( audio_file, batch_size=10, input=63, offset=offset ):
yield batch,transcript
return generation(train),generation(test),generation(valid)
项目详情
关闭
audiodatasets-1.0.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | c176afd3190f93a3da7ed7701b058156b361cecbb1bb04ac10bce18775109856 |
|
MD5 | ab5ef00365338c1f6b66bfd87357dad6 |
|
BLAKE2b-256 | ebcadb5183673bfb710d0d6d2e47633d3e3f48ad462c4cf16ee11787c630c010 |