Python keras.activations.relu() Examples
The following are 30
code examples of keras.activations.relu().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
keras.activations
, or try the search function
.
Example #1
Source File: simple-generative-model-regressor.py From Music_Generation with GNU General Public License v3.0 | 6 votes |
def get_basic_generative_model(input_size): input = Input(shape=(1, input_size, 1)) l1a, l1b = wavenetBlock(10, 5, 2, 1, 3)(input) l2a, l2b = wavenetBlock(1, 2, 4, 1, 3)(l1a) l3a, l3b = wavenetBlock(1, 2, 8, 1, 3)(l2a) l4a, l4b = wavenetBlock(1, 2, 16, 1, 3)(l3a) l5a, l5b = wavenetBlock(1, 2, 32, 1, 3)(l4a) l6 = merge([l1b, l2b, l3b, l4b, l5b], mode='sum') l7 = Lambda(relu)(l6) l8 = Convolution2D(1, 1, 1, activation='relu')(l7) l9 = Convolution2D(1, 1, 1)(l8) l10 = Flatten()(l9) l11 = Dense(1, activation='tanh')(l10) model = Model(input=input, output=l11) model.compile(loss='mse', optimizer='rmsprop', metrics=['accuracy']) model.summary() return model
Example #2
Source File: NER.py From Jtyoui with MIT License | 6 votes |
def train_model(): if cxl_model: embedding_matrix = load_embedding() else: embedding_matrix = {} train, label = vocab_train_label(train_path, vocab=vocab, tags=tag, max_chunk_length=length) n = np.array(label, dtype=np.float) labels = n.reshape((n.shape[0], n.shape[1], 1)) model = Sequential([ Embedding(input_dim=len(vocab), output_dim=300, mask_zero=True, input_length=length, weights=[embedding_matrix], trainable=False), SpatialDropout1D(0.2), Bidirectional(layer=LSTM(units=150, return_sequences=True, dropout=0.2, recurrent_dropout=0.2)), TimeDistributed(Dense(len(tag), activation=relu)), ]) crf_ = CRF(units=len(tag), sparse_target=True) model.add(crf_) model.compile(optimizer=Adam(), loss=crf_.loss_function, metrics=[crf_.accuracy]) model.fit(x=np.array(train), y=labels, batch_size=16, epochs=4, callbacks=[RemoteMonitor()]) model.save(model_path)
Example #3
Source File: simple-generative-model-regressor.py From Music_Generation with GNU General Public License v3.0 | 6 votes |
def wavenetBlock(n_atrous_filters, atrous_filter_size, atrous_rate, n_conv_filters, conv_filter_size): def f(input_): residual = input_ tanh_out = AtrousConvolution1D(n_atrous_filters, atrous_filter_size, atrous_rate=atrous_rate, border_mode='same', activation='tanh')(input_) sigmoid_out = AtrousConvolution1D(n_atrous_filters, atrous_filter_size, atrous_rate=atrous_rate, border_mode='same', activation='sigmoid')(input_) merged = merge([tanh_out, sigmoid_out], mode='mul') skip_out = Convolution1D(1, 1, activation='relu', border_mode='same')(merged) out = merge([skip_out, residual], mode='sum') return out, skip_out return f
Example #4
Source File: MNetArt.py From CNNArt with Apache License 2.0 | 6 votes |
def fCreateMNet_Block(input_t, channels, kernel_size=(3, 3), type=1, forwarding=True, l1_reg=0.0, l2_reg=1e-6): tower_t = Conv2D(channels, kernel_size=kernel_size, kernel_initializer='he_normal', weights=None, padding='same', strides=(1, 1), kernel_regularizer=l1_l2(l1_reg, l2_reg), )(input_t) tower_t = Activation('relu')(tower_t) for counter in range(1, type): tower_t = Conv2D(channels, kernel_size=kernel_size, kernel_initializer='he_normal', weights=None, padding='same', strides=(1, 1), kernel_regularizer=l1_l2(l1_reg, l2_reg), )(tower_t) tower_t = Activation('relu')(tower_t) if (forwarding): tower_t = concatenate([tower_t, input_t], axis=1) return tower_t
Example #5
Source File: motion_MNetArt.py From CNNArt with Apache License 2.0 | 6 votes |
def fCreateMNet_Block(input_t, channels, kernel_size=(3,3), type=1, forwarding=True,l1_reg=0.0, l2_reg=1e-6 ): tower_t = Conv2D(channels, kernel_size=kernel_size, kernel_initializer='he_normal', weights=None, padding='same', strides=(1, 1), kernel_regularizer=l1_l2(l1_reg, l2_reg), )(input_t) tower_t = Activation('relu')(tower_t) for counter in range(1, type): tower_t = Conv2D(channels, kernel_size=kernel_size, kernel_initializer='he_normal', weights=None, padding='same', strides=(1, 1), kernel_regularizer=l1_l2(l1_reg, l2_reg), )(tower_t) tower_t = Activation('relu')(tower_t) if (forwarding): tower_t = concatenate([tower_t, input_t], axis=1) return tower_t
Example #6
Source File: simple-generative-model-regressor.py From keras-wavenet with GNU General Public License v3.0 | 6 votes |
def get_basic_generative_model(input_size): input = Input(shape=(1, input_size, 1)) l1a, l1b = wavenetBlock(10, 5, 2, 1, 3)(input) l2a, l2b = wavenetBlock(1, 2, 4, 1, 3)(l1a) l3a, l3b = wavenetBlock(1, 2, 8, 1, 3)(l2a) l4a, l4b = wavenetBlock(1, 2, 16, 1, 3)(l3a) l5a, l5b = wavenetBlock(1, 2, 32, 1, 3)(l4a) l6 = merge([l1b, l2b, l3b, l4b, l5b], mode='sum') l7 = Lambda(relu)(l6) l8 = Convolution2D(1, 1, 1, activation='relu')(l7) l9 = Convolution2D(1, 1, 1)(l8) l10 = Flatten()(l9) l11 = Dense(1, activation='tanh')(l10) model = Model(input=input, output=l11) model.compile(loss='mse', optimizer='rmsprop', metrics=['accuracy']) model.summary() return model
Example #7
Source File: params.py From talos with MIT License | 6 votes |
def breast_cancer(): from keras.optimizers import Adam, Nadam, RMSprop from keras.losses import logcosh, binary_crossentropy from keras.activations import relu, elu, sigmoid # then we can go ahead and set the parameter space p = {'lr': (0.5, 5, 10), 'first_neuron': [4, 8, 16, 32, 64], 'hidden_layers': [0, 1, 2], 'batch_size': (2, 30, 10), 'epochs': [50, 100, 150], 'dropout': (0, 0.5, 5), 'shapes': ['brick', 'triangle', 'funnel'], 'optimizer': [Adam, Nadam, RMSprop], 'losses': [logcosh, binary_crossentropy], 'activation': [relu, elu], 'last_activation': [sigmoid]} return p
Example #8
Source File: params.py From talos with MIT License | 6 votes |
def iris(): from keras.optimizers import Adam, Nadam from keras.losses import logcosh, categorical_crossentropy from keras.activations import relu, elu, softmax # here use a standard 2d dictionary for inputting the param boundaries p = {'lr': (0.5, 5, 10), 'first_neuron': [4, 8, 16, 32, 64], 'hidden_layers': [0, 1, 2, 3, 4], 'batch_size': (2, 30, 10), 'epochs': [2], 'dropout': (0, 0.5, 5), 'weight_regulizer': [None], 'emb_output_dims': [None], 'shapes': ['brick', 'triangle', 0.2], 'optimizer': [Adam, Nadam], 'losses': [logcosh, categorical_crossentropy], 'activation': [relu, elu], 'last_activation': [softmax]} return p
Example #9
Source File: simple-generative-model-regressor.py From keras-wavenet with GNU General Public License v3.0 | 6 votes |
def wavenetBlock(n_atrous_filters, atrous_filter_size, atrous_rate, n_conv_filters, conv_filter_size): def f(input_): residual = input_ tanh_out = AtrousConvolution1D(n_atrous_filters, atrous_filter_size, atrous_rate=atrous_rate, border_mode='same', activation='tanh')(input_) sigmoid_out = AtrousConvolution1D(n_atrous_filters, atrous_filter_size, atrous_rate=atrous_rate, border_mode='same', activation='sigmoid')(input_) merged = merge([tanh_out, sigmoid_out], mode='mul') skip_out = Convolution1D(1, 1, activation='relu', border_mode='same')(merged) out = merge([skip_out, residual], mode='sum') return out, skip_out return f
Example #10
Source File: test_activations.py From CAPTCHA-breaking with MIT License | 6 votes |
def test_relu(): ''' Relu implementation doesn't depend on the value being a theano variable. Testing ints, floats and theano tensors. ''' from keras.activations import relu as r assert r(5) == 5 assert r(-5) == 0 assert r(-0.1) == 0 assert r(0.1) == 0.1 x = T.vector() exp = r(x) f = theano.function([x], exp) test_values = get_standard_values() result = f(test_values) list_assert_equal(result, test_values) # because no negatives in test values
Example #11
Source File: params.py From talos with MIT License | 5 votes |
def titanic(): # here use a standard 2d dictionary for inputting the param boundaries p = {'lr': (0.5, 5, 10), 'first_neuron': [4, 8, 16], 'batch_size': [20, 30, 40], 'dropout': (0, 0.5, 5), 'optimizer': ['Adam', 'Nadam'], 'losses': ['logcosh', 'binary_crossentropy'], 'activation': ['relu', 'elu'], 'last_activation': ['sigmoid']} return p
Example #12
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_serialization(): all_activations = ['softmax', 'relu', 'elu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear', 'softplus', 'softsign', 'selu'] for name in all_activations: fn = activations.get(name) ref_fn = getattr(activations, name) assert fn == ref_fn config = activations.serialize(fn) fn = activations.deserialize(config) assert fn == ref_fn
Example #13
Source File: models.py From asr-study with MIT License | 5 votes |
def maas(num_features=81, num_classes=29, num_hiddens=1824, dropout=0.1, max_value=20): """ Maas' model. Reference: [1] Maas, Andrew L., et al. "Lexicon-Free Conversational Speech Recognition with Neural Networks." HLT-NAACL. 2015. """ x = Input(name='inputs', shape=(None, num_features)) o = x def clipped_relu(x): return relu(x, max_value=max_value) # First layer o = TimeDistributed(Dense(num_hiddens))(o) o = TimeDistributed(Activation(clipped_relu))(o) # Second layer o = TimeDistributed(Dense(num_hiddens))(o) o = TimeDistributed(Activation(clipped_relu))(o) # Third layer o = Bidirectional(SimpleRNN(num_hiddens, return_sequences=True, dropout_W=dropout, activation=clipped_relu, init='he_normal'), merge_mode='sum')(o) # Fourth layer o = TimeDistributed(Dense(num_hiddens))(o) o = TimeDistributed(Activation(clipped_relu))(o) # Fifth layer o = TimeDistributed(Dense(num_hiddens))(o) o = TimeDistributed(Activation(clipped_relu))(o) # Output layer o = TimeDistributed(Dense(num_classes))(o) return ctc_model(x, o)
Example #14
Source File: models.py From EEG_classification with Apache License 2.0 | 5 votes |
def get_model_cnn_crf(lr=0.001): nclass = 5 seq_input = Input(shape=(None, 3000, 1)) base_model = get_base_model() # for layer in base_model.layers: # layer.trainable = False encoded_sequence = TimeDistributed(base_model)(seq_input) encoded_sequence = SpatialDropout1D(rate=0.01)(Convolution1D(128, kernel_size=3, activation="relu", padding="same")(encoded_sequence)) encoded_sequence = Dropout(rate=0.05)(Convolution1D(128, kernel_size=3, activation="linear", padding="same")(encoded_sequence)) #out = TimeDistributed(Dense(nclass, activation="softmax"))(encoded_sequence) # out = Convolution1D(nclass, kernel_size=3, activation="linear", padding="same")(encoded_sequence) crf = CRF(nclass, sparse_target=True) out = crf(encoded_sequence) model = models.Model(seq_input, out) model.compile(optimizers.Adam(lr), crf.loss_function, metrics=[crf.accuracy]) model.summary() return model
Example #15
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_serialization(): all_activations = ['softmax', 'relu', 'elu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear', 'softplus', 'softsign', 'selu'] for name in all_activations: fn = activations.get(name) ref_fn = getattr(activations, name) assert fn == ref_fn config = activations.serialize(fn) fn = activations.deserialize(config) assert fn == ref_fn
Example #16
Source File: models.py From open-solution-toxic-comments with MIT License | 5 votes |
def _prelu(use_prelu): def f(x): if use_prelu: x = PReLU()(x) else: x = Lambda(relu)(x) return x return f
Example #17
Source File: architectures.py From open-solution-mapping-challenge with MIT License | 5 votes |
def prelu_block(use_prelu): def f(x): if use_prelu: x = PReLU()(x) else: x = Lambda(relu)(x) return x return f
Example #18
Source File: tf_models.py From TemporalConvolutionalNetworks with MIT License | 5 votes |
def temporal_convs_linear(n_nodes, conv_len, n_classes, n_feat, max_len, causal=False, loss='categorical_crossentropy', optimizer='adam', return_param_str=False): """ Used in paper: Segmental Spatiotemporal CNNs for Fine-grained Action Segmentation Lea et al. ECCV 2016 Note: Spatial dropout was not used in the original paper. It tends to improve performance a little. """ inputs = Input(shape=(max_len,n_feat)) if causal: model = ZeroPadding1D((conv_len//2,0))(model) model = Convolution1D(n_nodes, conv_len, input_dim=n_feat, input_length=max_len, border_mode='same', activation='relu')(inputs) if causal: model = Cropping1D((0,conv_len//2))(model) model = SpatialDropout1D(0.3)(model) model = TimeDistributed(Dense(n_classes, activation="softmax" ))(model) model = Model(input=inputs, output=model) model.compile(loss=loss, optimizer=optimizer, sample_weight_mode="temporal") if return_param_str: param_str = "tConv_C{}".format(conv_len) if causal: param_str += "_causal" return model, param_str else: return model
Example #19
Source File: models.py From EEG_classification with Apache License 2.0 | 5 votes |
def get_model_cnn(): nclass = 5 seq_input = Input(shape=(None, 3000, 1)) base_model = get_base_model() # for layer in base_model.layers: # layer.trainable = False encoded_sequence = TimeDistributed(base_model)(seq_input) encoded_sequence = SpatialDropout1D(rate=0.01)(Convolution1D(128, kernel_size=3, activation="relu", padding="same")(encoded_sequence)) encoded_sequence = Dropout(rate=0.05)(Convolution1D(128, kernel_size=3, activation="relu", padding="same")(encoded_sequence)) #out = TimeDistributed(Dense(nclass, activation="softmax"))(encoded_sequence) out = Convolution1D(nclass, kernel_size=3, activation="softmax", padding="same")(encoded_sequence) model = models.Model(seq_input, out) model.compile(optimizers.Adam(0.001), losses.sparse_categorical_crossentropy, metrics=['acc']) model.summary() return model
Example #20
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_relu(): x = K.placeholder(ndim=2) f = K.function([x], [activations.relu(x)]) test_values = get_standard_values() result = f([test_values])[0] assert_allclose(result, test_values, rtol=1e-05)
Example #21
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_relu(): x = K.placeholder(ndim=2) f = K.function([x], [activations.relu(x)]) test_values = get_standard_values() result = f([test_values])[0] assert_allclose(result, test_values, rtol=1e-05)
Example #22
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_serialization(): all_activations = ['softmax', 'relu', 'elu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear', 'softplus', 'softsign', 'selu'] for name in all_activations: fn = activations.get(name) ref_fn = getattr(activations, name) assert fn == ref_fn config = activations.serialize(fn) fn = activations.deserialize(config) assert fn == ref_fn
Example #23
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_relu(): x = K.placeholder(ndim=2) f = K.function([x], [activations.relu(x)]) test_values = get_standard_values() result = f([test_values])[0] assert_allclose(result, test_values, rtol=1e-05)
Example #24
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_serialization(): all_activations = ['softmax', 'relu', 'elu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear', 'softplus', 'softsign', 'selu'] for name in all_activations: fn = activations.get(name) ref_fn = getattr(activations, name) assert fn == ref_fn config = activations.serialize(fn) fn = activations.deserialize(config) assert fn == ref_fn
Example #25
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_relu(): x = K.placeholder(ndim=2) f = K.function([x], [activations.relu(x)]) test_values = get_standard_values() result = f([test_values])[0] assert_allclose(result, test_values, rtol=1e-05)
Example #26
Source File: activations_test.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def test_serialization(): all_activations = ['softmax', 'relu', 'elu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear', 'softplus', 'softsign', 'selu'] for name in all_activations: fn = activations.get(name) ref_fn = getattr(activations, name) assert fn == ref_fn config = activations.serialize(fn) fn = activations.deserialize(config) assert fn == ref_fn
Example #27
Source File: baseline_mitbih.py From ECG_Heartbeat_Classification with MIT License | 5 votes |
def get_model(): nclass = 5 inp = Input(shape=(187, 1)) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(inp) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = GlobalMaxPool1D()(img_1) img_1 = Dropout(rate=0.2)(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_1")(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_2")(dense_1) dense_1 = Dense(nclass, activation=activations.softmax, name="dense_3_mitbih")(dense_1) model = models.Model(inputs=inp, outputs=dense_1) opt = optimizers.Adam(0.001) model.compile(optimizer=opt, loss=losses.sparse_categorical_crossentropy, metrics=['acc']) model.summary() return model
Example #28
Source File: baseline_ptbdb_transfer_freeze.py From ECG_Heartbeat_Classification with MIT License | 5 votes |
def get_model(): nclass = 1 inp = Input(shape=(187, 1)) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid", trainable=False)(inp) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid", trainable=False)(img_1) img_1 = GlobalMaxPool1D()(img_1) img_1 = Dropout(rate=0.2)(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_1")(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_2")(dense_1) dense_1 = Dense(nclass, activation=activations.sigmoid, name="dense_3_ptbdb")(dense_1) model = models.Model(inputs=inp, outputs=dense_1) opt = optimizers.Adam(0.001) model.compile(optimizer=opt, loss=losses.binary_crossentropy, metrics=['acc']) model.summary() return model
Example #29
Source File: baseline_ptbdb.py From ECG_Heartbeat_Classification with MIT License | 5 votes |
def get_model(): nclass = 1 inp = Input(shape=(187, 1)) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(inp) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = GlobalMaxPool1D()(img_1) img_1 = Dropout(rate=0.2)(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_1")(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_2")(dense_1) dense_1 = Dense(nclass, activation=activations.sigmoid, name="dense_3_ptbdb")(dense_1) model = models.Model(inputs=inp, outputs=dense_1) opt = optimizers.Adam(0.001) model.compile(optimizer=opt, loss=losses.binary_crossentropy, metrics=['acc']) model.summary() return model
Example #30
Source File: baseline_ptbdb_transfer_fullupdate.py From ECG_Heartbeat_Classification with MIT License | 5 votes |
def get_model(): nclass = 1 inp = Input(shape=(187, 1)) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(inp) img_1 = Convolution1D(16, kernel_size=5, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(32, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = MaxPool1D(pool_size=2)(img_1) img_1 = Dropout(rate=0.1)(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = Convolution1D(256, kernel_size=3, activation=activations.relu, padding="valid")(img_1) img_1 = GlobalMaxPool1D()(img_1) img_1 = Dropout(rate=0.2)(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_1")(img_1) dense_1 = Dense(64, activation=activations.relu, name="dense_2")(dense_1) dense_1 = Dense(nclass, activation=activations.sigmoid, name="dense_3_ptbdb")(dense_1) model = models.Model(inputs=inp, outputs=dense_1) opt = optimizers.Adam(0.001) model.compile(optimizer=opt, loss=losses.binary_crossentropy, metrics=['acc']) model.summary() return model