简体   繁体   中英

Cannot load Tensorflow (Keras) Saved Model because file does not exist (whereas it does exist)

I never had problem loading h5 models, but now I'm trying to load the first two saved models (.pb) from here here but I keep on getting this error:

Traceback (most recent call last):
  File "C:\Rasp\project\main.py", line 34, in <module>
    model = tf.keras.models.load_model("C:\\Rasp\\aiy_vision_classifier_birds_V1_1\\saved_model.pb")
  File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\keras\saving\save.py", line 206, in load_model
    return saved_model_load.load(filepath, compile, options)
  File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\keras\saving\saved_model\load.py", line 121, in load
    meta_graph_def = loader_impl.parse_saved_model(path).meta_graphs[0]
  File "C:\Users\me\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\saved_model\loader_impl.py", line 113, in parse_saved_model
    raise IOError(
OSError: SavedModel file does not exist at: C:\Rasp\aiy_vision_classifier_birds_V1_1\saved_model.pb\{saved_model.pbtxt|saved_model.pb}

I load it by execution a python file containing (removed imports for the sake of clarity), just like it is suggested in the doc :

model = tf.keras.models.load_model("C:\\Rasp\\experts_bit_r50x1_in21k_bird_1\\saved_model.pb")

I just extracted the files into a folder of the same name, I don't understand what's going on.

I needed to target to wrapping folder, not the actual file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM