问题描述
我在 Keras 中创建了一个模型并将其转换为 Tensorflow.js 模型并将其加载到我的 node.js 项目中。现在我想在 Tensorflow.js 中从这个模型中获得预测。我已经弄清楚如何加载单个图像:
var singleImageData = fs.readFileSync('path/to/image.jpeg');
var image = tf.node.decodeImage(new Uint8Array(singleImageData),3);
image = tf.cast(image,'float32');
//other image processing
这会创建一个形状为 (imageWidth,imageHeight,3)
的张量。但我想将一批图像加载到形状为 (batchNumber,imageWidth,3)
的张量中。
我该怎么做?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)