[英]Error while loading trained Tensorflow Saved Model on pycharm. ValueError: invalid literal for int() with base 10: 'class_name'
Context: I have trained a model which consist in an image classifier.This model consist in a TF CNN and has been trained online (with google colaboratory) I then downloaded it as a tf.savemodel object.背景:我已经训练了一个包含在图像分类器中的模型。这个模型包含在一个 TF CNN 中并且已经在线训练(与谷歌合作)然后我将它下载为一个 tf.savemodel 对象。 I would like to deploy this trained model on a PyQt5 Desktop app.
我想在 PyQt5 桌面应用程序上部署这个训练有素的模型。
Problem: When I try to load my trained model in my code in PyCharm (2020.1.3) I get the following error :问题:当我尝试在 PyCharm (2020.1.3) 的代码中加载经过训练的模型时,出现以下错误:
ValueError: invalid literal for int() with base 10: 'class_name'
During handling of the above exception, another exception occurred:在处理上述异常的过程中,又出现了一个异常:
ValueError: Error converting shape to a TensorShape: invalid literal
for int() with base 10: 'class_name'.
code used to load model:用于加载模型的代码:
model1=tf.keras.models.load_model(r'C:\Users\user\Desktop\UNI\L3\saved_models\model7')
SIDE NOTE: When I run the same line on colab the model is successfully loaded into the notebook.旁注:当我在 colab 上运行同一行时,模型已成功加载到笔记本中。
Questions:问题:
-What does the error mean? - 错误是什么意思?
-Why does it work on colab and not in my IDE? - 为什么它可以在 colab 上运行,而不是在我的 IDE 中?
-How can I fix this in order to load and use the trained model in my app ? - 我该如何解决这个问题,以便在我的应用程序中加载和使用经过训练的模型?
检查当前系统中 TF 的版本,您可能已经使用 2.1 进行了训练,并尝试使用 2.3 版本加载模型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.