【发布时间】:2020-01-24 20:55:05
【问题描述】:
所以我是 ml 的新手,并且正在研究 automl,它在线显示预测要好得多,但问题是我需要一个离线解决方案,所以我在训练模型并下载后将模型部署在边缘 Tensorflow 上离线。我有一个标签 txt 文件、3 个 bin 文件和 1 个 JSON 文件格式的模型文件。
我确实读过这个Google Edge Vision,但我似乎仍然无法让我的模型工作,因为这个链接显示我们必须制作一个 index.html 文件我复制粘贴了相同的代码并制作了一个 Html 文件,但是我不想从谷歌存储加载图像,所以我给出了与 index.html 文件在同一文件夹中的图像路径并删除了跨域,但它仍然只是显示图像而不是检测到的概率图片或类似的东西,是的,我确实用python打开了Http.server 8080,所以没问题
<script src="https://unpkg.com/@tensorflow/tfjs"></script>
<script src="https://unpkg.com/@tensorflow/tfjs-automl"></script>
<img id="detect" src="1.png">
<script>
async function run() {
const model = await tf.automl.loadImageClassification('model.json');
const image = document.getElementById('detect');
const predictions = await model.classify(image);
console.log(predictions);
// Show the resulting object on the page.
const pre = document.createElement('pre');
pre.textContent = JSON.stringify(predictions, null, 2);
document.body.append(pre);
}
run();
</script>
谁能帮我看看我应该怎么做我已经搜索了很多互联网论坛但找不到答案
【问题讨论】:
标签: python tensorflow machine-learning google-cloud-platform automl