javascript - 在这种情况下,如何将 Tensorflow.js 与 node.js 一起使用?
问题描述
示例 https://github.com/tensorflow/tfjs-models/tree/master/coco-ssd
从浏览器加载图像,如下所示:
(async () => {
const img = document.getElementById('img');
// Load the model.
const model = await cocoSsd.load();
// Classify the image.
const predictions = await model.detect(img);
console.log('Predictions: ');
console.log(predictions);
})();
虽然这适用于浏览器,但我想让它在纯 node.js 中运行。有没有办法不创建dom对象(如canvas),使用fs模块加载数据?
解决方案
推荐阅读
- c++ - 给出不精确答案的递归 Karatsuba 算法
- elasticsearch - 如何为 Elasticsearch 快照名称添加时间?
- django - Django - 如何从模板中的查询集中获取最后一项
- c# - 范围返回一组错误的单元格
- css - 如何同时运行两个 CSS 动画?
- sap - 更新 SAP BODS 数据存储中所有更改的表
- java - 如何获取jar内资源的文件路径
- python-3.x - 从网页中抓取带有隐藏行的表格
- node.js - fcm admin.messaging().sendToDevice(tokens, messagePayload, options) 正在触发两次 nodejs
- java - 从多对多删除。如何记住 URL 中的参数?