keras icon indicating copy to clipboard operation
keras copied to clipboard

No file or directory found at spiral_keras_model.h5

Open project-set opened this issue 1 year ago • 1 comments

hello, please help me because the Keras Spiral H5 model is not found even though I have installed TensorFlow

spiral h5

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..error_handler(*args, **kwargs) 67 filtered_tb = _process_traceback_frames(e.traceback) 68 # To get the full stack trace, call: 69 # 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**

project-set avatar Jun 23 '24 11:06 project-set

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.

mehtamansi29 avatar Jun 25 '24 06:06 mehtamansi29

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.

github-actions[bot] avatar Jul 11 '24 01:07 github-actions[bot]

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

github-actions[bot] avatar Jul 25 '24 01:07 github-actions[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Jul 25 '24 01:07 google-ml-butler[bot]