Sunday, 3 April 2022

Passing a Custom mask to the LSTM data for training and validation

I have an LSTM architecture ready:

input1 = Input(shape=(1500, 3))
lstm = LSTM(units=100, return_sequences=False, activation='relu')(input1)
outputs = Dense(150, activation="sigmoid")(lstm)
model = Model(inputs=input1, outputs=outputs)
model.compile(loss="binary_crossentropy", optimizer="adam",
                  metrics=["accuracy"]) 

The LSTM layer supports a calling argument called mask.

The way I'm reading the data is by using two generators, one iterates through training files and the other through the validation files (so on the .fit method I pass the training and validation generators).

model.fit(
        x=training_generator,
        epochs=10,
        steps_per_epoch=5, # there are 5 files
        validation_data=validation_generator,
        validation_steps=5, # there are 5 files
        verbose=1
    )

Therefore each file will have a given mask (one for the training file, another for the validation file). Therefore my question is, how can I specify which mask to use?



from Passing a Custom mask to the LSTM data for training and validation

No comments:

Post a Comment