在Keras中的layers.concatenate()之后如何规范化数据输入

时间:2019-12-12 23:03:47

标签: python tensorflow keras keras-layer tensorflow2.0

在密集网络的开头,我有一个带有连接层的CNN。我使用layer.concatenate()来合并CNN检索的特征和我的手工特征。现在,这2个数据数组具有2个不同的比例(因为第一个是CNN计算的值,另一个是我计算的特征)。因此,我将采用一种通用规模来规范化这两种数据的方法,以简化工作。这是我的CNN:

emb = Embedding()(image_input)
conv = Conv1D(64, 2, activation = 'relu', strides = 1, padding = 'same')(emb)
conv = MaxPooling1D()(conv1)
first_part_output = Flatten()(conV)

merged_model = layers.concatenate([first_part_output, other_data_input])

在这里,我将进行标准化:

normal = *here i would do the normalization*

primoDense = Dense(256, activation = 'relu')(normal)
drop = Dropout(0.45)(primoDense)
predictions = Dense(1, activation = 'sigmoid')(drop)

[first_part_output,other_data_input] 是我的新合并数组。 first_part_output 是CNN的功能。 other_data_input 是我的手工制作功能。

0 个答案:

没有答案