segan icon indicating copy to clipboard operation
segan copied to clipboard

Compatible with Tensorflow 1.1.0rc1 + Python 3.5.2

Open lordet01 opened this issue 7 years ago • 1 comments

Here is the patch files for compatible with TF 1.1.0 + Python 3. In addition, I wrote a simple script to enhance multiple wave files in a folder.

I am also sharing the model that was trained from my PC with the modified codes. https://drive.google.com/open?id=0BzoVVRWvLDl1ajNtTHdDaHpZT0E https://drive.google.com/open?id=0BzoVVRWvLDl1T0R2NFBlMVV1VW8 https://drive.google.com/open?id=0BzoVVRWvLDl1a3hWWUc1Si1OeW8

Best regards,

-Kwang Myung Jeon

lordet01 avatar Apr 27 '17 05:04 lordet01

Please also use the code below to replace the clean method on the SEGAN class because it is extremely slow.

def clean(self, x):
    """ clean a utterance x
        x: numpy array containing the normalized noisy waveform
    """
    # zero pad if necessary
    remainder = len(x) % (2 ** 14)
    if remainder != 0:
        x = np.pad(x, (0, 2**14 - remainder), 'constant', constant_values=0)
    # split files into equal 2 ** 14 sample chunks
    x = np.array(np.array_split(x, int(len(x) / 2 ** 14)))
    x_ = np.zeros((self.batch_size, 2 ** 14))
    x_[:len(x)] = x
    fdict = {self.gtruth_noisy[0]: x_}
    output = self.sess.run(self.Gs[0], feed_dict=fdict)[:len(x)]
    output = output.flatten()
    # remove zero padding if added
    if remainder != 0:
        output = output[:-(2**14 - remainder)]
    return output

rafaelvalle avatar Oct 19 '17 01:10 rafaelvalle