无法在 tensorflow.js 中加载模型

Failure to load model in tensorflow.js

我已经将不同的迁移训练模型(VGG16、InceptionV3、EfficientNetB0)从 python 中的 tensorflow 转换为 tensorflowjs。 而且在tensorflowjs中实现后,加载模型失败

其中一个错误是:

Uncaught Error: Unknown layer: Functional. 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 models.js:295
    at u (runtime.js:45)
    at Generator._invoke (runtime.js:274)
    at Generator.forEach.t.<computed> [as next] (runtime.js:97)
    at Wm (runtime.js:728)

还有

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)

此外,

Failed to load resource: the server responded with a status of 404 ()

问题是什么? 如果我使用可教机器生成的 .json 文件,则可以加载模型。 (然而,由于未知原因,预测变得完全错误,而且问题似乎不仅仅是标签问题。) 但是,如果我使用通过 tensorflow 转换器从 .h5 或 SavedModel 生成的 model.json 文件,无论我使用哪种预训练模型,或生成的文件格式(.h5 或 SavedModel),模型都无法加载到 javascript.

请帮忙!!

转到 model.json 文件并搜索关键字 Functional(您可以使用 ctrl+f Functional)并将该词替换为 Model