frankkramer-lab / aucmedi

a framework for Automated Classification of Medical Images
https://frankkramer-lab.github.io/aucmedi/
GNU General Public License v3.0
38 stars 13 forks source link

Neural Network load model #45

Open muellerdo opened 3 years ago

muellerdo commented 3 years ago

Delete last model before overwriting when loading a new model

Problem: Tensorflow caches various model variables which can lead to OOM when switching multiple times between different models.

Solution: clear session when loading a new model. tf.keras.backend.clear_session()

Note for me: clear_session probably not working when using multiple model variables!!!

Note for Ensemble Learning: Delete models at the end to avoid this issue

muellerdo commented 3 years ago

K.clear_session() tf.compat.v1.reset_default_graph()