首页 > 解决方案 > Tensorflowjs:“未知层:标准化”

问题描述

目前正在尝试将在 python 上训练的 keras 训练(简单回归)模型加载到 javascript(用于 html)中。这个模型最初是通过一个简单的方法保存在 python 中的

model.save("model")

然后通过 tensorflowjs_wizard(在 anaconda 上)转换为 tensorflowjs。

但是通过在js/html中运行代码的过程中,弹出了一个错误,被视为未知层:

Unknown layer: Normalization. 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)

我不太确定“移植到 TensorFlow.js”是什么意思有没有人见过这个问题或知道如何解决这个问题?谢谢!!!!

版本:张量流:2.5.0 张量流js:3.8.0

标签: javascriptpythontensorflownormalizationtensorflow.js

解决方案


推荐阅读