使用 keras 将元数据添加到 CNN

时间:2021-03-04 22:56:27

标签: python tensorflow keras conv-neural-network metadata

我有一个卷积神经网络,想包含一些元数据。我的元数据位于对应于每个类的多个 csv 文件中,它包含一堆几何属性(大约 8 个测量值),特别是围绕大小和体积,这将有助于对外观相似但具有不同大小和体积的图像进行分类。我目前正在使用 Keras 构建我的模型,但我不确定在哪里以及如何将元数据添加到我的模型中?我是否需要合并所有 csv,我是否将它们分开,类似于训练图像文件夹或其他东西?

下面我包含了一个基本模型的示例。

input_ = keras.layers.Input(shape=[224,224,3])
x = tf.keras.layers.Conv2D(filters = 256, 
                              kernel_size = (3,3),
                              padding = 'same',
                              activation = 'relu')(input_)                          
x = tf.keras.layers.MaxPool2D(pool_size = (2,2), strides = (2,2))(x)

x = tf.keras.layers.Flatten()(x)
x = tf.keras.layers.Dense(1028, activation = 'relu')(x)

x = tf.keras.layers.Dense(7, activation = 'softmax')(x)

model = keras.Model(inputs=[input_], outputs=[x])

0 个答案:

没有答案
相关问题