如何将LSTM应用于临时数据以进行像素选择?
随着时间的流逝,我有一组二进制图像,分辨率为2200 x 1000像素。 15个临时图像。我将图像分成100 x 100像素的贴片,并获得输入形状x_train =(220、15、100、100、1)。 作为掩码,有一个二进制文件,分辨率为2200 x 1000,其中白色是稳定的像素,而黑色则不稳定。
要输入LSTM层,我使用input_shape =(15,100*100)和y_train =(220,15,1000)。
我的模型:
model = Sequential()
model.add(LSTM(16, activation='relu', input_shape = (15, 100*100), return_sequences=True))
model.add(BatchNormalization())
model.add(Dense(10000, activation='relu'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
model.summary()
history = model.fit(X_train, Y_train, epochs=5, batch_size=128, validation_split=0.1, verbose=2)
以及结果:
Epoch 1/5
1/1 - 1s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 2/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 3/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 4/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 5/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
如何正确提交输入数据(x_train和y_train)并在这种情况下训练模型? 如何将数据标签(220、15、10000)放入(220、15、2),其中2个是两个类,该模型会正确读取它吗?
I have a set of binary images over time with a resolution of 2200 by 1000 pixels. 15 temporary images. I split the images into patches of 100 by 100 pixels and got the input shape X_train=(220, 15, 100, 100, 1).
As a mask, there is a binary file with a resolution of 2200 by 1000, where white is a stable pixel in time, and black is not stable.
To enter the LSTM layer I use input_shape = (15, 100*100) and Y_train=(220, 15, 1000).
My model:
model = Sequential()
model.add(LSTM(16, activation='relu', input_shape = (15, 100*100), return_sequences=True))
model.add(BatchNormalization())
model.add(Dense(10000, activation='relu'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
model.summary()
history = model.fit(X_train, Y_train, epochs=5, batch_size=128, validation_split=0.1, verbose=2)
And the results:
Epoch 1/5
1/1 - 1s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 2/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 3/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 4/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
Epoch 5/5
1/1 - 0s - loss: nan - val_loss: nan - val_accuracy: 1.0000 - accuracy: 1.0000
How to properly submit input data (X_train and Y_train) and train the model if possible in this case?
How to put the data label (220, 15, 10000) to (220, 15, 2) where 2 are two classes, and will it be correctly read by the model?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论