我正在构建一个在浏览器上使用面部情绪识别系统的网站。我在 tensorflow 中构建并训练了一个 CNN 模型,并将其转换为 tensorflow.js。然而,在加载模型时,我
我正在构建一个在浏览器上使用面部情绪识别系统的网站。我在 tensorflow 中构建并训练了一个 CNN 模型,并将其转换为 tensorflow.js。然而,在加载模型时,我一直收到错误,
未捕获(承诺中)错误:提供的权重数据没有目标变量:sequence/conv2d/kernel
在网上阅读了一些建议后,我尝试使用 TensorFlow 版本 2.15.0 而不是 2.16.0,但没有成功。我甚至仔细检查了 model.json 文件中权重的名称,发现这些名称与我的模型的权重名称完全相同。这是我的 model.json 文件中的 weightsManifest 块
{"weightsManifest": [{"paths": ["group1-shard1of3.bin", "group1-shard2of3.bin", "group1-shard3of3.bin"], "weights": [{"name": "sequential/conv2d/kernel", "shape": [3, 3, 1, 32], "dtype": "float32"}, {"name": "sequential/conv2d/bias", "shape": [32], "dtype": "float32"}, {"name": "sequential/conv2d_1/kernel", "shape": [3, 3, 32, 64], "dtype": "float32"}, {"name": "sequential/conv2d_1/bias", "shape": [64], "dtype": "float32"}, {"name": "sequential/conv2d_2/kernel", "shape": [3, 3, 64, 128], "dtype": "float32"}, {"name": "sequential/conv2d_2/bias", "shape": [128], "dtype": "float32"}, {"name": "sequential/conv2d_3/kernel", "shape": [3, 3, 128, 128], "dtype": "float32"}, {"name": "sequential/conv2d_3/bias", "shape": [128], "dtype": "float32"}, {"name": "sequential/dense/kernel", "shape": [2048, 1024], "dtype": "float32"}, {"name": "sequential/dense/bias", "shape": [1024], "dtype": "float32"}, {"name": "sequential/dense_1/kernel", "shape": [1024, 7], "dtype": "float32"}, {"name": "sequential/dense_1/bias", "shape": [7], "dtype": "float32"}]}]}