MCD-MEL-CEPSTRAL-DISTANCE-MCD-application
MCD-MEL-CEPSTRAL-DISTANCE-MCD-application copied to clipboard
IndexError: index301 is out of bounds for axis 0 with size 301
Hi, thanks for your contribution.But I still have some problems. I have followed your steps to get two mgc files and modified the code in vecseq.py. When I run the code, the original data file provided by MCD project can get the corresponding result, but if I use my own mgc file, an error will be reported. What is the reason? Although the MCD is obtained, is the mcd obtained in this way feasible? The error is as follows:
processing source_p231_p231_220
MCD = 10.077967 (600 frames)
warping 452 frames -> 600 frames (148 repeated, 0 dropped)
Traceback (most recent call last):
File "bin/dtw_synth", line 128, in <module>
main(sys.argv)
File "bin/dtw_synth", line 120, in main
synthFullWarped = dtw.warpGeneral(synthFull, synthIndexSeq)
File "/home/zhai/anaconda3/envs/mcd3/lib/python2.7/site-packages/mcd/dtw.py", line 160, in warpGeneral
ysWarped = ys[yIndexSeq]
IndexError: index 301 is out of bounds for axis 0 with size 301
Hi, my suggestion is that, please confirm again the corresponding vecseq.py file. For there will be many different files but named the same "vecseq.py". Please click into the corresponding files path.
The same problem had been solved many times for different contact git user. The amended code aims to solve the dimension problem leaved in original MCD implementation.
Actually, I personally suggest not use MCD any more, for MCD still not have widely accepted implementation, there is only one monotonic formula, and the MCD results of different paper are also very different, so it is not very convincing as paper data. Suggesting use MOS & SMOS & ABX & t-SNE & ACC .
All the best! Luke Huang
@SeptemberN Did you solve this probem?I meet the same problem.I have changed the vecseq.py file and then this problem appears
@Lukelluke @hhm853610070 你好!我已经解决了这个问题。以下是我的思路:
1、我的音频是16k的。
2、我已经修改过了vecseq.py,请确保你是按照说明修改的。
3、我发现这个错误是发生在bin/dtw_synth
中,所以我尝试使用try-catch捕获错误。需要在bin/dtw_synth
的for uttId in args.uttIds:
加入try-catch。我个人认为这样加入捕获错误是不会影响计算的MCD结果的。
以下是我的bin/dtw_synth
的for uttId in args.uttIds:
代码:
for uttId in args.uttIds:
try:
print 'processing', uttId
s2 = str(uttId)
nat = getNatVecSeq(uttId)
synth = getSynthVecSeq(uttId)
# ignore 0th cepstral component
nat = nat[:, 1:]
synth = synth[:, 1:]
minCost, path = dtw.dtw(nat, synth, costFn)
frames = len(nat)
minCostTot += minCost
framesTot += frames
print 'MCD = %f (%d frames)' % (minCost / frames, frames)
s1 = 'MCD = %f (%d frames)' % (minCost / frames, frames)
pathCosts = [costFn(nat[i], synth[j]) for i, j in path]
synthIndexSeq = dtw.projectPathBestCost(path, pathCosts)
assert len(synthIndexSeq) == len(nat)
uniqueFrames = len(set(synthIndexSeq))
repeatedFrames = len(synthIndexSeq) - uniqueFrames
droppedFrames = len(synth) - uniqueFrames
assert len(synth) - droppedFrames + repeatedFrames == len(nat)
print 'warping %s frames -> %s frames (%s repeated, %s dropped)' % (
len(synth), len(nat), repeatedFrames, droppedFrames)
s = s2 + s1 + '\n'
with open('information.txt', mode='a') as f:
f.write(s)
print
for paramOrder, ext in zip(paramOrders, exts):
vecSeqIo = vsio.VecSeqIo(paramOrder)
synthFullFile = os.path.join(args.synthDir, uttId + '.' + ext)
synthFull = vecSeqIo.readFile(synthFullFile)
synthFullWarped = dtw.warpGeneral(synthFull, synthIndexSeq)
synthFullWarpedFile = os.path.join(args.outDir, uttId + '.' + ext)
vecSeqIo.writeFile(synthFullWarpedFile, synthFullWarped)
except:
print 'Error'
@SeptemberN 多谢!我按照你发的内容进行了修改,已经可以得到结果了。你是不是也是采用https://github.com/CSTR-Edinburgh/merlin这个项目提取的mgc文件?我有个疑问,我没有仔细看那个项目的源码,请问必须是16KHz吗?我的音频是22.05KHz,我之前用那个项目直接处理了22.05KHz的音频,然后我也用sox进行了降采样,将采样率降低到16KHz,也重新处理了16KHz的音频,最后用这个mcd-master的项目计算了MCD值,两种采样率的都可以成功运行,22.05KHz音频的MCD值更大,请问我那样直接使用22.05KHz的音频是否有问题?
@hhm853610070 抱歉,采样率不同导致的MCD不同的问题我也没注意过。(我认为没问题。我一直都在用16k的。) 其实你同其他模型对比时,在相同采样率的情况下计算MCD,得到的MCD结果更优即可吧?(个人观点)
@SeptemberN 对的,在相同采样率下比较就行了。其实我之前的疑问主要是那个项目处理非16KHz的音频有没有问题,就是是否会非常不准确,不过我后来又尝试处理其它非16K采样率的音频,应该是可行的。非常感谢你的这些回答!