예제 #1
0
    def __init__(self, X, Y, speakers, dropout=0.5, training=True):
        self.X = X
        self.Y = Y
        self.speakers = speakers

        stft_X, D_X = tf_featurization.get_stft(self.X, T=512 * 3)

        self.stft = []
        for i in range(speakers):
            self.stft.append(tf_featurization.get_stft(self.Y[i], T=512 * 3))

        params = {'conv_n_filters': [48 * (2**i) for i in range(6)]}

        logits = unet.Model(
            D_X,
            cout=speakers,
            output_mask_logit=True,
            dropout=dropout,
            training=training,
            params=params,
        ).logits
        logits = tf.nn.sigmoid(logits)

        self.outputs = []
        for i in range(speakers):
            self.outputs.append(logits[:, :, :, i:i + 1] * D_X)

        self.loss = []
        for i in range(speakers):
            self.loss.append(
                tf.reduce_mean(tf.abs(self.outputs[i] - self.stft[i][1]),
                               axis=[1, 2, 3]))
        self.cost = tf.reduce_sum(self.loss, axis=-1)
        self.cost = tf.reduce_mean(self.cost)
예제 #2
0
    def __init__(self, X, Y):
        self.X = X
        self.Y = Y

        stft_X, D_X = tf_featurization.get_stft(self.X)

        self.stft = []
        for i in range(len(self.Y)):
            self.stft.append(tf_featurization.get_stft(self.Y[i]))

        self.outputs = []
        for i in range(len(self.Y)):
            with tf.variable_scope(f'model_{i}'):
                self.outputs.append(unet.Model(D_X, num_layers=6).logits)

        self.loss = []
        for i in range(len(self.Y)):
            self.loss.append(
                tf.reduce_mean(tf.abs(self.outputs[i] - self.stft[i][1])))

        self.cost = tf.reduce_sum(self.loss)
예제 #3
0
 def body(i, stft, D):
     stft_x, D_x = tf_featurization.get_stft(X[i])
     return i + 1, stft.write(i, stft_x), D.write(i, D_x)