我已将'ssd_mobilenet_v1_coco_2017_11_17'TF对象检测模型转换为带有tfjs-converter的tensorflow.js格式为tf_frozen_model。不管我提供的输入如何,“ model.executeAsync”始终为detection_scores输出节点生成带有零的数组。我测试了其他输出节点,它们产生相同的结果,全为零。
tensorflowjs_converter \
--input_format=tf_frozen_model \
--output_node_names='detection_scores' \
--saved_model_tags=serve \
/Tensor_Flow_Models/research/object_detection/ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb \
/Tensor_Flow_Models/research/object_detection/tfjsmodels
async loadMobilenet()
{
this.picture = <HTMLImageElement> document.getElementById("pic");
const MODEL_URL = '/assets/tensorflowjs_model.pb';
const WEIGHTS_URL = '/assets/weights_manifest.json';
tf.loadFrozenModel(MODEL_URL, WEIGHTS_URL).then(async (model) => {
const image_tensor = tf.expandDims(tf.fromPixels(this.picture),0);
const result = <tf.Tensor> await model.executeAsync({image_tensor:
image_tensor});
console.log(result.dataSync());
})
我在项目中使用的tfjs版本: “ @ tensorflow / tfjs”:“ ^ 0.13.5”, “ @ tensorflow / tfjs-converter”:“ ^ 0.8.4”,