How to apply LSTM to temporary data for pixel selection?

Viewed 29

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?

0 Answers
Related