Reputation: 23
i am using tensorflow js browser side this is the dependency
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
In the javascript this is what I am doing
let imageModelURL = "https://linktocode.com/model.json"
let htmlVideo = document.getElementById("video");
let model;
async function tensorFlow(){
console.log("loading model")
if (document.readyState !== 'complete') {
console.log("dom not loaded")
}
model = await tf.loadLayersModel(imageModelURL);
classifyVideo();
}
document.addEventListener('DOMContentLoaded', run);
function run()
{
console.log("DOM Content Loaded")
tensorFlow();
}
function classifyVideo() {
console.log("classifying video")
console.log(tf)
console.log(tf.browser)
console.log(tf.browser.fromPixel) //this is undefined
let example = tf.browser.fromPixel(remoteVideo); //this throws error
let prediction = model.predict(example);
console.log(prediction)
classifyVideo();
}
when thee above code is executed i get Uncaught (in promise) TypeError: tf.browser.fromPixel is not a function Not sure why it is happening. I am not much experienced in tensorflow.js. Please let me know if there is anything I should add
Thanks
Upvotes: 2
Views: 410
Reputation: 6799
It is tf.browser.fromPixels
not tf.browser.fromPixel
as per the documenation.
Upvotes: 1