我按照this guide中的步骤将预训练的keras模型转换为与Tensorflow.js一起使用
现在,当我尝试使用以下命令将其导入javascript时
const model = tf.loadModel("{% static "keras/model.json" %}");
出现以下错误:
Uncaught (in promise) Error: Unknown layer: GaussianNoise. 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 new t (errors.ts:48)
at deserializeKerasObject (generic_utils.ts:239)
at deserialize (serialization.ts:31)
at t.fromConfig (models.ts:940)
at deserializeKerasObject (generic_utils.ts:274)
at deserialize (serialization.ts:31)
at models.ts:302
at common.ts:14
at Object.next (common.ts:14)
at i (common.ts:14)我使用的是0.15.3版本的Tensorflow.js,是这样导入的:
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.15.3/dist/tf.min.js"></script>
我用Tensorflow 1.12.0和Keras 2.2.4训练我的神经网络
发布于 2019-03-06 01:18:12
您正在使用tfjs尚不支持的层tf.layer.gaussianNoise。
考虑使用支持的其他图层更改此图层
https://stackoverflow.com/questions/55007059
复制相似问题