Products
GG网络技术分享 2025-11-13 00:18 10
THCHS30数据集是一个针对中文语音的宝昂贵材料,它为语音处理和语音识别的研究研究与应用给了丰有钱的训练和测试数据。
data包含语音和标注文件。test测试脚本。doc标注说明文档。librosa库提取MFCC特征。librosa库进行语音分割。
python
!pip install torch torchvision torchaudio kaldi_io fastai
with open as f: for filepath in tqdm: f.write + " " + filepath + " ")
for uttid, feat in kaldiio.readmatscp: np.save
with open as f: for line in tqdm: utt_id, _, transcript = line.split transcript = transcript.strip.replace f.write
char2idx = {} with open as f: for line in f: utt_id, transcript = line.strip.split for char in transcript: if char not in char2idx: char2idx = len + 1
with open as f: json.dump
with open as f: char2idx = json.load
traindataset = AudioDataset trainloader = DataLoader
model = MyModel + 1) optimizer = optim.Adam, lr=1e-3)
criterion = nn.CTCLoss)
for epoch in range: for batch in trainloader: audio, audiolengths, text, textlengths = batch optimizer.zerograd logprobs = model inputlengths = audiolengths // 2 loss = criterion.logsoftmax, text, inputlengths, textlengths) loss.backward optimizer.step
testdataset = AudioDataset testloader = DataLoader totalcer = totalwer = total = 0 with torch.nograd: for batch in testloader: audio, , text, textlengths = batch logprobs = model output = logprobs.transpose.argmax totalcer += .sum.item totalwer += .sum.item total += textlengths.sum.item cer = totalcer / total wer = total_wer / total
THCHS30数据集是一个有力巨大的工具,Neng帮研究研究人员和开发者提升中文语音处理手艺的水平。。
Demand feedback