我通过 python 中的张量流训练了一个模型,使用将图像增强合并到模型层中。
但是,当我将训练好的模型转换为tensorflow.js(model.json)并运行它时,出现错误:
jquery-3.3.1.slim.min.js:2 Uncaught Error: Unknown layer: RandomFlip. This may be due to one of the following reasons:
1. The layer is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
2. The custom layer is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().
at jN (generic_utils.js:242)
at GI (serialization.js:31)
at e.fromConfig (models.js:1026)
at jN (generic_utils.js:277)
at GI (serialization.js:31)
at e.fromConfig (models.js:1026)
at jN (generic_utils.js:277)
at GI (serialization.js:31)
at models.js:295
at u (runtime.js:45)
以下是 model.json 文件的内容:https://github.com/maximus3219/maximus3219.github.io/blob/main/Flower_model_EN0/model.json https://github.com/maximus3219/maximus3219.github.io/blob/main/Flower_model_EN0/model.json
这可能是由于增强操作所致。
我该如何处理这些问题?
谢谢!
将 keras 模型转换为 tensorflow.js 格式时一定存在某种问题,因此像这样转换就可以了
tensorflowjs_converter --input_format keras --output_format=tfjs_graph_model G:/Deep learning/test.h5 G:/Deep learning/Test/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)