【发布时间】:2020-07-16 15:29:15
【问题描述】:
我正在尝试重写用于对卫星图像进行分类的神经网络模型,
我想在那个模型中使用一些卷积层,比如
#keras.layers.Conv2D(filters=64, kernel_size=(3, 3), activation='relu', padding = 'same',input_shape=(1,nBands)),
但我无法正确获取input_shape 参数,谁能帮帮我?
之前的NN模型是这样的:
# Print the shape of reshaped data
print(xTrain.shape, xTest.shape, featuresHyderabad.shape)
#(2519025, 1, 6) (1679351, 1, 6) (1391808, 1, 6)
# Define the parameters of the model
model = keras.Sequential([
#keras.layers.Conv2D(filters=64, kernel_size=(3, 3), activation='relu', padding = 'same',input_shape=(1,nBands)),
keras.layers.Flatten(input_shape=(1, nBands)),
keras.layers.Dense(128, activation='relu',kernel_initializer='glorot_normal'),
keras.layers.Dense(2, activation='softmax')])
# Define the accuracy metrics and parameters
model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
# Run the model
model.fit(xTrain, yTrain, epochs=2,batch_size=10)
【问题讨论】:
标签: python tensorflow machine-learning keras neural-network