SpeechBrain是使用pytorch实现的灵活,用户友好的语音工具箱,以便用户可以快速实现语音识别,语音增强,信号处理等等任务,目前比较新且无相关文档,现分享相关数据处理pipeline
data prepare(基于voxcleb_prepare.py)
- 修改头文件路径 采样率 等信息
- 修改csv生成文件方法(voxcleb_prepare中 _get_utt_split_lists)
我的数据路径
train—speaker_id—wav文件
test—speaker_id—wav文件
dev—speaker_id—wav文件
logger = logging.getLogger(__name__)
OPT_FILE = "cn_dataset_prepare.pkl"
TRAIN_CSV = "train.csv"
DEV_CSV = "dev.csv"
TEST_CSV = "test.csv"
ENROL_CSV = "enrol.csv"
SAMPLERATE = 16000
# DEV_WAV = "train_set.zip"
# TEST_WAV = "train_set.tar.gz.zip"
DEV_WAV = "train_set.tar.gz"
TEST_WAV = "train_set.tar.gz"
META = "meta"
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
def _get_utt_split_lists(
data_folders, split_ratio, verification_pairs_file, split_speaker=False
):
"""
Tot. number of speakers vox1= 1211.
Tot. number of speakers vox2= 5994.
Splits the audio file list into train and dev.
This function automatically removes verification test files from the training and dev set (if any).
"""
train_lst = []
dev_lst = []
print("Getting file list...")
for data_folder in data_folders:
test_lst = [
line.rstrip("\n").split(" ")[1]
for line in open(verification_pairs_file)
]
test_lst = set(sorted(test_lst))
# # TODO ---------此处为需要修改的位置
# 正则提取speaker_id,这个位置需要根据你的文件名进行修改
test_spks = [snt.split("/"<