Skip to content

[BUG Report]:读取报错,.h5的模型 #1300

@xdaker

Description

@xdaker

Description

读取.h5的模型报错:Tensorflow.Exceptions.NotOkStatusException: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for E:\aa\007005.h5\variables\variables
at Tensorflow.Checkpoint.CheckpointReader..ctor(String filename)
at Tensorflow.Checkpoint.TrackableSaver.restore(String save_path, CheckpointOptions options)
at Tensorflow.Loader._restore_checkpoint()
at Tensorflow.Loader..ctor(SavedObjectGraph object_graph_proto, SavedModel saved_model_proto, String export_dir, CheckpointOptions ckpt_options, LoadOptions save_options, IDictionary2 filters) at Tensorflow.Loader.<>c__DisplayClass45_1.<load_partial>b__3(NameScope x) at Tensorflow.Binding.tf_with[T](T py, Action1 action)
at Tensorflow.Loader.load_partial(String export_dir, IDictionary2 filters, Object tags, LoadOptions options) at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load(String path, Boolean compile, LoadOptions options) at Tensorflow.Keras.Saving.SavedModel.KerasLoadModelUtils.load_model(String filepath, IDictionary2 custom_objects, Boolean compile, LoadOptions options)
at Tensorflow.Keras.Models.ModelsApi.load_model(String filepath, Boolean compile, LoadOptions options)
保存模型的方法:
// 保存模型
Model?.save(MLNetModelPath);
读取模型方法:
tf.keras.models.load_model(MLNetModelPath);;//在这里报错

是哪里有问题?还有我发现007005.h5文件夹下面有variables文件夹,但是并没有variables\variables文件夹,两个文件夹重复,是不是代码问题?
版本:TensorFlow.Keras 0.15.0

Reproduction Steps

No response

Known Workarounds

No response

Configuration and Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions