I have some basic tensorflow.js code from an example on the documentation:
const image = new ImageData(1, 1);
image.data[0] = 100;
image.data[1] = 150;
image.data[2] = 200;
image.data[3] = 255;
const xs = tf.fromPixels(image);
xs.print();
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
With this version (the one the website tells you to use):
https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js
And getting the error: Uncaught TypeError: tf.fromPixels is not a function
what might cause this? Are others getting this error when you run the snippet?
You are looking at the documentation for version 0.12.0.
tf.fromPixels was deprecated in version 1.0.0, use: tf.browser.fromPixels()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With