跳转到主要内容

提取并预处理主要开源(主要是非商业)语音音频数据集

项目描述

https://img.shields.io/pypi/v/audiodatasets.svg https://img.shields.io/travis/mcfletch/audiodatasets.svg Documentation Status Updates

提取并预处理主要开源语音音频数据集

  • 支持的数据集

  • 此软件适用于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 (17.1 kB 查看哈希值)

上传时间

由以下支持