Merge pull request #73 from ANaaim/Optimise_MarkerAugmentation

Clear keras session to avoid time increase when doing batch processing
This commit is contained in:
David PAGNON 2024-02-27 21:30:06 +01:00 committed by GitHub
commit 62534a9229
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,6 +31,7 @@ from Pose2Sim.MarkerAugmenter.utils import TRC2numpy
import json
import glob
import logging
import keras
## AUTHORSHIP INFORMATION
@ -183,7 +184,8 @@ def augmentTRC(config_dict):
model = tf.keras.models.model_from_json(pretrainedModel_json)
model.load_weights(os.path.join(augmenterModelDir, "weights.h5"))
outputs = model.predict(inputs)
keras.backend.clear_session()
# %% Post-process outputs.
# Step 1: Reshape if necessary (eg, LSTM)
if augmenterModelName == "LSTM":