加载增强层操作中的

加载增强层操作中的

本文介绍了加载增强层操作中的 Tensorflow.js 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过 python 中的 tensorflow 训练了一个模型,使用合并到模型层中的图像增强.但是,当我将训练好的模型转换为tensorflow.js(model.json)并运行时,出现错误:

I have trained a model via tensorflow in python, using image augmentation incorporated into the model layers.However, when I converted to trained model to tensorflow.js (model.json) and run it, there is an error:

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

Here is the content of the model.json file:https://github.com/maximus3219/maximus3219.github.io/blob/main/Flower_model_EN0/model.json

这可能是由于增强操作.我应该如何处理这些问题?谢谢!

This is probably due to augmentation operations.How should I deal with the problems?Thanks!

推荐答案

在将 keras 模型转换为 tensorflow.js 格式时肯定存在某种问题,因此像这样转换它会起作用

There must be some sort of issue when converting the keras model to tensorflow.js format so converting it like this will work

tensorflowjs_converter --input_format keras --output_format=tfjs_graph_model G:/Deep learning/test.h5 G:/Deep learning/Test/

这篇关于加载增强层操作中的 Tensorflow.js 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 22:01