【发布时间】:2020-06-24 18:50:01
【问题描述】:
我想知道如何格式化 executeAsync tensorflow 对象检测 executeAsync 方法输出,所以它看起来像这样:
我当前的输出看起来像这样,仅通过浏览是无法阅读的:
我一直在浏览 coco-ssd.js,但由于某种原因,它写得很糟糕。 https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd 当然这需要美化,但在那之后,几乎没有一个变量叫它的名字,它基本上是字母表中的所有字母。
这就是我得到预测的方式(未格式化):
async function asyncCall() {
const modelUrl = 'http://192.168.0.14:8000/web_model_4/model.json';
const img = document.getElementById('img');
const imgTensor = tf.browser.fromPixels(img);
const t4d = imgTensor.expandDims(0);
const model = await tf.loadGraphModel(modelUrl).then(model => {
predictions = model.executeAsync(t4d, ['detection_classes']).then(predictions=> { //, 'detection_classes', 'detection_scores'
console.log('Predictions: ', predictions);
})
})
}
asyncCall();
感谢您的帮助。我敢肯定还有其他人在使用 coco ssd 训练自定义模型时遇到问题。 谢谢!
【问题讨论】:
标签: object-detection tensorflow.js