【发布时间】:2020-01-15 03:37:53
【问题描述】:
我正在尝试重用由 tensorflow 创建的 tensorflowjs 模型。为了了解转换器的工作原理,我尝试转换 mobilenetv2 模型:
tensorflowjs_converter --input_format=tf_hub --output_format=tensorflowjs 'https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2' ./web_model
这似乎行得通。然后我尝试通过更改模型的加载方式在mobilenet demo 中使用这个新的转换模型:
// const model = await mobilenet.load({version, alpha});
// replaced by
const model = await mobilenet.load({ modelUrl: './web_model/model.json', version, alpha, inputRange: [0, 1], fromTFHub: true });
// Classify the image.
const predictions = await model.classify(img);
分类调用触发错误:
Uncaught (in promise) Error: Activation relu6 has not been implemented for the WebGL backend.
我不知道官方的 tensorflowjs mobilenet 模型是如何生成的 :(
【问题讨论】:
-
没有
fromTFhub属性
标签: tensorflow.js tensorflowjs-converter