Tfjs: tf.fromPixels() function throw an error under 0.11.1

Created on 20 May 2018  路  8Comments  路  Source: tensorflow/tfjs

To get help from the community, check out our Google group.

TensorFlow.js version

0.11.1

Browser version

Chrome Version 66.0.3359.181

Describe the problem or feature request

After updated the Tensor Flow js to 0.11.1, the tf.fromPixels() function throw an error:
Uncaught (in promise) TypeError: Cannot read property 'drawImage' of null
at MathBackendWebGL.fromPixels (backend_webgl.js:181)
at Engine.fromPixels (engine.js:302)
at ArrayOps.fromPixels (array_ops.js:292)
at eval (operation.js:12)
at Tracking.tidy (tracking.js:39)
at Object.descriptor.value (operation.js:12)
at eval (Webcam.js:69)
at Object.Tracking.tidy (tracking.js:39)
at Webcam.capture (Webcam.js:66)
at eval (index.js:288)
The code is come from webcam-transfer-learning (Transfer Learning to play Pacman via the Webcam) and run perfectly under the version 0.10.0

Code to reproduce the bug / link to feature request

Html has this element:

JS code as below:
tf.fromPixels(document.getElementById('webcam'));

Most helpful comment

I can take a look today. It is possible that something changed in Chrome - will investigate and update this thread.

All 8 comments

Really exciting about this new version which can let me use Tensorflow js to my project with the new saving model feature. 馃憤

I was running a project a couple days back with the previous version and that worked, but with the latest version (0.11.1) I'm having the same issue as @PengWang0316 [TypeError: Cannot read property 'drawImage' of null]

Same as @PengWang0316 and @creativesands, very excited to save my model but unfortunately tf.fromPixel throws an error with the new version

I resolve using ImageData type.
FromPixel throw error from HTMLVideoElement, HTMLImageElement and HTMLCanvasElement but it works with ImageData

@dsmilkov @caisq can you prioritize / delegate this? I am currently out of office.

@dsmilkov Any thoughts on possible causes of this bug? I'm not very familiar with tf.fromPixels().

I can take a look today. It is possible that something changed in Chrome - will investigate and update this thread.

Was this page helpful?
0 / 5 - 0 ratings