def build(self):
    '\n        Construct the main structure of the network\n        '
    print('DNN input shape', self.input_shape)
    if (K.image_dim_ordering() == 'tf'):
        (batch_sz, bands, frames, channels) = self.input_shape
        assert (channels >= 1)
        channel_axis = 3
        freq_axis = 1
        nn_shape = (bands, frames, channels)
    else:
        raise NotImplementedError('[ERROR] Only for TensorFlow background.')
    nb_filters = self.config['feature_maps']
    dropout_rate = self.config['dropout']
    pool_sz = [5, 2, 2]
    gru_nb = [32]
    fc_nb = [32]
    feat_input = Input(shape=nn_shape, name='input')
    x = BatchNormalization(axis=freq_axis, name='bn_0_freq')(feat_input)
    for sz in pool_sz:
        x = Conv2D(filters=nb_filters, kernel_size=(3, 3), padding='same')(x)
        x = BatchNormalization(axis=channel_axis)(x)
        x = Activation(self.config['activation'])(x)
        x = MaxPooling2D(pool_size=(sz, 1))(x)
        x = Dropout(dropout_rate)(x)
    x = Permute((2, 1, 3))(x)
    x = Reshape((frames, (- 1)))(x)
    for n in gru_nb:
        x = Bidirectional(GRU(n, activation='tanh', dropout=dropout_rate, recurrent_dropout=dropout_rate, return_sequences=True), merge_mode='mul')(x)
    for n in fc_nb:
        x = TimeDistributed(Dense(n))(x)
        x = Dropout(dropout_rate)(x)
    x = TimeDistributed(Dense(self.nclass))(x)
    y_pred = Activation(activation=self.config['out_score'], name='output')(x)
    self._compile_model(input=feat_input, output=y_pred, params=self.config)
Construct the main structure of the network
def build(self):
    '\n        \n        '
    print('DNN input shape', self.input_shape)
    if (K.image_dim_ordering() == 'tf'):
        (batch_sz, bands, frames, channels) = self.input_shape
        assert (channels >= 1)
        channel_axis = 3
        freq_axis = 1
        nn_shape = (bands, frames, channels)
    else:
        raise NotImplementedError('[ERROR] Only for TensorFlow background.')
    nb_filters = self.config['feature_maps']
    dropout_rate = self.config['dropout']
    pool_sz = [5, 2, 2]
    gru_nb = [32]
    fc_nb = [32]
    feat_input = Input(shape=nn_shape, name='input')
    x = BatchNormalization(axis=freq_axis, name='bn_0_freq')(feat_input)
    for sz in pool_sz:
        x = Conv2D(filters=nb_filters, kernel_size=(3, 3), padding='same')(x)
        x = BatchNormalization(axis=channel_axis)(x)
        x = Activation(self.config['activation'])(x)
        x = MaxPooling2D(pool_size=(sz, 1))(x)
        x = Dropout(dropout_rate)(x)
    x = Permute((2, 1, 3))(x)
    x = Reshape((frames, (- 1)))(x)
    for n in gru_nb:
        x = Bidirectional(GRU(n, activation='tanh', dropout=dropout_rate, recurrent_dropout=dropout_rate, return_sequences=True), merge_mode='mul')(x)
    for n in fc_nb:
        x = TimeDistributed(Dense(n))(x)
        x = Dropout(dropout_rate)(x)
    x = TimeDistributed(Dense(self.nclass))(x)
    y_pred = Activation(activation=self.config['out_score'], name='output')(x)
    self._compile_model(input=feat_input, output=y_pred, params=self.config)