如何将LSTM应用于临时数据以进行像素选择?

发布于 2025-02-06 20:17:55 字数 1237 浏览 0 评论 0原文

随着时间的流逝,我有一组二进制图像,分辨率为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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文