keras
keras copied to clipboard
No file or directory found at spiral_keras_model.h5
hello, please help me because the Keras Spiral H5 model is not found even though I have installed TensorFlow
import os
file_path = 'path/to/spiral_keras_model.h5' print(os.path.exists(file_path))
False
model = load_model('spiral_keras_model.h5') class_names = ['1 Healthy-Spiral', '0 Parkinsons-Spiral'] # Define your actual class names
**--------------------------------------------------------------------------- OSError Traceback (most recent call last) Cell In[22], line 1 ----> 1 model = load_model('spiral_keras_model.h5') 2 class_names = ['1 Healthy-Spiral', '0 Parkinsons-Spiral']
File ~\anaconda3\Lib\site-packages\keras\src\saving\saving_api.py:262, in load_model(filepath, custom_objects, compile, safe_mode, **kwargs) 254 return saving_lib.load_model( 255 filepath, 256 custom_objects=custom_objects, 257 compile=compile, 258 safe_mode=safe_mode, 259 ) 261 # Legacy case. --> 262 return legacy_sm_saving_lib.load_model( 263 filepath, custom_objects=custom_objects, compile=compile, **kwargs 264 )
File ~\anaconda3\Lib\site-packages\keras\src\utils\traceback_utils.py:70, in filter_traceback.tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File ~\anaconda3\Lib\site-packages\keras\src\saving\legacy\save.py:234, in load_model(filepath, custom_objects, compile, options) 232 if isinstance(filepath_str, str): 233 if not tf.io.gfile.exists(filepath_str): --> 234 raise IOError( 235 f"No file or directory found at {filepath_str}" 236 ) 238 if tf.io.gfile.isdir(filepath_str): 239 return saved_model_load.load( 240 filepath_str, compile, options 241 )
OSError: No file or directory found at spiral_keras_model.h5**
Hi @project-set -
As per the code snippet shared by you, you are getting False for this line print(os.path.exists(file_path)). It means the model file_path is not correct. Please correct model file_path and try to load the h5 model in tensorflow 2.15 or keras 2.15 version.
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.