[英]SavedModel file does not exist error while converting vgg16
I want to convert rcmalli_vggface_tf_vgg16.h5 pre-trained model to js format to use in a tensorflow-js project.我想将预训练的 rcmalli_vggface_tf_vgg16.h5 model转换为 js 格式以在 tensorflow-js 项目中使用。
to convert this file I tried different ways but yet I could not to solve the problem.转换这个文件我尝试了不同的方法,但我无法解决问题。
I'm using converters.convert_tf_saved_model
method to load and then convert it to a json file.我正在使用
converters.convert_tf_saved_model
方法加载然后将其转换为 json 文件。
converters.convert_tf_saved_model('rcmalli_vggface_tf_vgg16.h5','web_model')
But every time following error is shown:但是每次显示以下错误:
SavedModel file does not exist at: rcmalli_vggface_tf_vgg16.h5
While I am sure the h5 file is next to the file that is running the program.虽然我确定 h5 文件位于运行程序的文件旁边。
I try full path address but same error occured.我尝试了完整路径地址,但发生了同样的错误。 I do not know what is problem
我不知道是什么问题
You are converting a keras saved_model but the model is a keras layers_model because it is stored in h5 file.您正在转换 keras saved_model但 model 是 keras layers_model因为它存储在 h5 文件中。
I find this way the simplest to convert the model. And it did it in about 2 seconds.我发现这种转换 model 的方法最简单。它在大约 2 秒内完成。
tensorflowjs_converter --input_format=keras rcmalli_vggface_tf_vgg16.h5 ./converted
tf.loadLayers
API.tf.loadLayers
API 加载它。const model = await tf.loadGraphModel('path/to/model.json');
const model = await tf.loadGraphModel('path/to/model.json');
Note*: ./converted
is the output directory, be sure not to overwrite your own stuff.注意*:./converted是
./converted
目录,一定不要覆盖你自己的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.