`fromPixels` returns invalid values for `webgpu` backend
See original GitHub issuei’ve noticed some errors during model execution, so went back to check inputs and it seems that fromPixels
returns incorrect values for webgpu
backend
await tf.setBackend('webgpu');
// input is a canvas which is a copy of a webcam input in 1280x720 resolution
const buffer = await tf.browser.fromPixelsAsync(canvas);
const data = await buffer.data();
for (let idx = 0; idx < data.length; idx++) {
if (data[idx] < 0 || data[idx] > 255) console.log({ idx, val: data[idx], length: data.length });
}
{idx: 1094922, val: -1, length: 2764800}
{idx: 1094925, val: -1, length: 2764800}
{idx: 2275694, val: -1, length: 2764800}
i cannot think of any scenario where pixel value of -1
is a valid thing to have,
especially on only 3 random pixels out of entire (otherwise valid) image
note that invalid values do not occur on every frame, but it does happen often enough
processing the same input shows no such problems when using webgl
backend
environment: tfjs 3.20.0, tfjs-backend-webgpu 0.0.1-alpha.13, chrome canary 107
Issue Analytics
- State:
- Created a year ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Creates a tf.Tensor with the provided values, shape and dtype.
createElement('canvas'); const customBackend = new tf. ... Returns: void ... For WebGPU backend, the data will be stored on a buffer. There is...
Read more >How to activate webgpu backend on Tensorflow.JS
getBackend () I get webgl even with Chrome Canary with WEBGPU enabled. Also running tf.backend() doesn't seem to indicate that WEBGPU is there....
Read more >Deep Learning in the Browser - Exploring TF.js, WebDNN and ...
WebDNN supports 4 execution backend implementations: WebMetal, WebGL, WebAssembly, and fallback pure javascript implementation.
Read more >WebGPU - W3C
2.1.1 CPU-based undefined behavior; 2.1.2 GPU-based undefined behavior; 2.1.3 Uninitialized data; 2.1.4 Out-of-bounds access in shaders; 2.1.5 Invalid data ...
Read more >What are the limitations of TensorFlow JS? - Quora
... advantages: the infrastructure and set of requirements are simplified as the need for background API requests is removed; the available data is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shaoboyan Please file a chromium/dawn bug to trace the
GPUExternalTexture
issue. And this issue will be blocked by that one. @vladmandic To continue to usefromPixels
with video, you can set flagWEBGPU_IMPORT_EXTERNAL_TEXTURE
to false. In this path, it will package the video to canvas and then callcopyExternalImageToTexture()
to do the following thing.@shaoboyan live link i’ve posted (https://vladmandic.github.io/nudenet/src/verify.html, sorry there was a typo in the url) includes a sample video. its only 10sec long, but on my system it generates thousands of errors per frame - and it logs to browser console.
example: