Closed sj-choi closed 5 months ago
Hi, thanks for bringing this up! This is a new regression introduced in Tf >= 2.16, where loading models saved in .h5 format fails (with a non-helpful error message). Downgrading Tensorflow to <=2.15 should remedy this (see also the updated "requirements.txt")
Thank you for the tip. It worked!
While using Anaconda3 on an Ubuntu-based Linux system (20.04 LTS), I attempted LST-AI segmentation. Although it initially appeared to work well, it stopped mid-way through post-processing, leaving some processed files without segmentation results.
Python version=3.10.14 My packages: tensforflow=2.16.1, scikit-image=0.22.0, scipy=1.13.0, numpy=1.24.3, requests=2.31.0, pillow=10.3.0, nibabel=5.2.1. I believe the package versions all meet the requirements.
Any guidance will be appreciated.
I attached a screenshot of where the process stopped.
preprocessing...
image shape after preprocessing: (129, 153, 129)
prediction (CNN id)...
0
1
2
3
4
running postprocessing...
exporting segmentation...
Limiting the number of threads to 4
Limiting the number of threads to 4
Running LST Segmentation.
Running segmentation on /CPU:0.
Running model 0.
Traceback (most recent call last):
File "/home/xubuntu/anaconda3/envs/lst_env/bin/lst", line 7, in
File "/home/xubuntu/lst_direcgtory/LST-AI/LST_AI/lst", line 320, in
File "/home/xubuntu/lst_direcgtory/LST-AI/LST_AI/segment.py", line 102, in unet_segmentation
File "/home/xubuntu/lst_direcgtory/LST-AI/LST_AI/custom_tf.py", line 28, in load_custom_model
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 183, in load_model
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 133, in load_model_from_hdf5
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 495, in deserialize_keras_object
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/models/model.py", line 512, in from_config
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/models/functional.py", line 510, in functional_from_config
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/models/functional.py", line 490, in process_layer
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/legacy/saving/saving_utils.py", line 85, in model_from_config
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 473, in deserialize_keras_object
File "/home/xubuntu/anaconda3/envs/lst_env/lib/python3.10/site-packages/keras/src/legacy/saving/serialization.py", line 354, in class_and_config_for_serialized_keras_object
ValueError: Unknown layer: 'Addons>InstanceNormalization'. Please ensure you are using a
keras.utils.custom_object_scope
and that this object is included in the scope. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.Some files left: