andabi / deep-voice-conversion

Deep neural networks for voice conversion (voice style transfer) in Tensorflow
MIT License
3.92k stars 843 forks source link

net2 training problem:ValueError: selected axis is out of range #20

Open AricJames opened 6 years ago

AricJames commented 6 years ago

After training net1, I use slt in Arctic to train net2. But I met the problem:

Traceback (most recent call last): File "train2.py", line 98, in train(logdir1=logdir1, logdir2=logdir2) File "train2.py", line 70, in train convert.convert(logdir2, queue=False) File "/home/xjl910940173/yang/deep-voice-conversion-master/deep-voice-conversion-master/convert.py", line 69, in convert audio = inv_preemphasis(audio, coeff=hp_default.preemphasis) File "/home/xjl910940173/yang/deep-voice-conversion-master/deep-voice-conversion-master/utils.py", line 31, in inv_preemphasis return signal.lfilter([1], [1, -coeff], x) File "/home/xjl910940173/.local/lib/python3.5/site-packages/scipy/signal/signaltools.py", line 1346, in lfilter return sigtools._linear_filter(b, a, x, axis) ValueError: selected axis is out of range

Expect your reply!

fangpengzhan commented 6 years ago

I also met the problem. Have you solved it, please?

AricJames commented 6 years ago

@fangpengzhan Not yet. But I will further research it.

lukas0001 commented 6 years ago

hey you guys, I 've solved this problem. I had the same with the axis out of range. I replaced all axis=-1 with axis=0 in the signaltools.py file of scipy with notepad and the problem with the out of range went away. I think the axis is just like a filter and isn't that important. after that I had a further problem with audio.size in convert.py ... maybe you will have the same. so I replaced following lines with this: y_audio = np.reshape(y_audio, (1, 1), order='C')#(1, y_audio.size), order='C') code after sharp is original audio = np.reshape(audio, (1, 1), order='C')#(1, audio.size), order='C') I dont know if thats allowed but now train1, train2 and convert seem to work!!! But now I face an other problem : I have no outputfile as wave. I 've searched everywhere . train1, train2 and convert tell me just that they have done completly. I understood the spectrogram as a mask that can change voice of a wave file or a text to speech text file. please tell me how to solve this!

shane9311 commented 6 years ago

@lukas0001 hey,i don't know English too much. I've solved this problem too,but i did't use your solution. Using python2.7 can solve this problem.python3 have some problems with map(lambda ....). The result is not a wavefile,but you can find your audio datas and download it in tensorborad. btw,can you tell me what's your finally loss value of train2? my loss value is 1.3 and I found the result of convertion is not very well!

AricJames commented 6 years ago

@shane9311 hello,your method is effective.I have successfully run the project. I used little data, so the loss value is high. But I do not know how to check the audio,can you tell me the command to use the tensorboard. Thank you!

shane9311 commented 6 years ago

@shiyangccy In console, tensorboard --logdir=***** --port=9999, then go to http://xx.xx.xx.xx:9999

Jubird915 commented 6 years ago

hey guys, I solve this issue in python3.6 version.

Spectrogram to waveform

    audioWavList = []
    y_audioWavList = []
    for i in range(len(pred_specs)):
        audioWavList.append(spectrogram2wav(pred_specs[i].T, hp_default.n_fft, hp_default.win_length, hp_default.hop_length, hp_default.n_iter))
        y_audioWavList.append(spectrogram2wav(y_specs[i].T, hp_default.n_fft, hp_default.win_length, hp_default.hop_length, hp_default.n_iter))
    audio = np.array(audioWavList)
    y_audio = np.array(y_audioWavList)

    # audio = np.array(map(lambda spec: spectrogram2wav(spec.T, hp_default.n_fft, hp_default.win_length, hp_default.hop_length, hp_default.n_iter), pred_specs))
    # y_audio = np.array(map(lambda spec: spectrogram2wav(spec.T, hp_default.n_fft, hp_default.win_length, hp_default.hop_length, hp_default.n_iter), y_specs))

just decompose the map(lamda....) sentences

carlfm01 commented 6 years ago

@Jubird915 not working, changing the lambda produces a weird sound, I'm using v2 of the model.

carlfm01 commented 6 years ago

Fixed now by adding list() to the map()

`audio = np.array(list(map(lambda spec: spec2wav(spec.T, hp.Default.n_fft, hp.Default.win_length,hp.Default.hop_length,hp.Default.n_iter), pred_spec)))

y_audio = np.array(list(map(lambda spec: spec2wav(spec.T, hp.Default.n_fft, hp.Default.win_length,hp.Default.hop_length,hp.Default.n_iter),y_spec)))`