Skip to main content
. 2024 Oct 30;24(21):6983. doi: 10.3390/s24216983
Algorithm 1 Preprocessing and ConvLSTM Model Development

Libraries: Import required libraries—TensorFlow, Keras, NumPy, OpenCV.

Input: Image sequences (Ex. in Figure 2)

Output: Serialized ConvLSTM model and predictions

  •   1:

    Step 1: Load Images

  •   2:

    Load image sequences {I1,I2,⋯,In} from the input folder

  •   3:

    Step 2: Preprocessing

  •   4:

    Convert images to grayscale:

  •   5:

    Resize images to 50×50 pixels and reshape them for ConvLSTM input.

  •   6:
    Normalize pixel values:
    Inorm=Igray255.0
  •   7:

    Step 3: Model Construction

  •   8:
    Construct ConvLSTM model with convolutional layers, batch normalization and a Conv3D layer with sigmoid activation:
    y^=σ(W·X+b)
    where y^ is the prediction, W are the weights, X is the input and b is the bias term.
  •   9:

    Step 4: Training

  • 10:

    Define the loss function as the Mean Squared Error (MSE), as mentioned in Equation (2)

  • 11:

    Train the model

  • 12:

    Step 5: Save Model

  • 13:

    Serialize the trained model.

  • 14:

    Step 6: Evaluation

  • 15:

    Compare predicted images y^ with ground truth images y.