- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
执行以下代码后:
var myImage = new Image(48,48);
myImage.src = '1.png';
document.body.appendChild(myImage);
console.log(tf.browser.fromPixels(myImage));
出现警告消息:
WebGL: INVALID_VALUE: texImage2D: no image
尽管图像已成功加载并显示在 html 页面上,但转换似乎失败了。怎么解决这个问题?
最佳答案
通常您需要等待图像加载。
const myImage = new Image();
myImage.onload = function() {
console.log(tf.browser.fromPixels(myImage));
};
myImage.src = '1.png';
document.body.appendChild(myImage);
关于javascript - WebGL:使用 tf.browser.fromPixels 转换本地镜像时出现 INVALID_VALUE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58507432/
我有一些基本的 tensorflow.js 代码 from an example on the documentation : const image = new ImageData(1, 1); i
这里 tf.browser.fromPixels 返回一个只有零的张量。 image.data 包含预期的值(不仅仅是零)。 tfjs 是使用脚本标签加载的。 tfjs 1.0.0 但更改版本无济于事
我想做的是转换使用 tf.fromPixels() 创建的张量并将其转换为 [28, 28] 然后用作作为从 Python 训练的模型中获取预测的输入。 我遇到的问题是模型中的第一层,其输入形状为[2
我正在使用 tensorflowjs做一些前端图像分类。我正在尝试使用 tf.browser.fromPixels将 img 元素转换为张量。但是,我得到的形状全为零 [160, 160, 3] .我
我在 node + nwjs 项目中使用 tensorflow.js,当我将视频元素作为输入到 tensowflow fromPixels 方法时,我在控制台中得到这个奇怪的错误作为输出: Uncau
执行以下代码后: var myImage = new Image(48,48); myImage.src = '1.png'; document.body.appendChild(myIm
我正在尝试使用 TensorFlow.js 的 tf.browser.fromPixels() 函数。不幸的是,我收到以下错误: backend_webgl.ts:309 Uncaught Error
我是一名优秀的程序员,十分优秀!