【发布时间】:2020-02-09 00:35:04
【问题描述】:
我正在尝试学习教程,只想在 TensorFlowJS 中加载图像。
import * as tf from '@tensorflow/tfjs-node';
import fs from 'fs';
(async () => {
const desk = fs.readFileSync(__dirname + '/' + 'desk.png');
const buf = Buffer.from(desk);
const imageArray = new Uint8Array(buf);
const pngDecodedTensor = tf.node.decodePng(imageArray);
})();
当我运行上面的代码时,我看到了这个错误:
The shape of dict['image_tensor'] provided in model.execute(dict) must be [-1,-1,-1,3], but was [1,4032,3024,4]
图片为 3024x4032 和 10.4MB
感谢您的帮助
【问题讨论】:
标签: node.js typescript tensorflow.js