I am working on object detection using Tensorflow.js. I am trying to run custom object detection tensorflow.js model in a browser. I could able to convert tensorflow model to te
Finally, I could figure out the problem and it was related to the size of an input frame.
SSD model needs shape of [1,300,300,3]
image/frame as input. I added this in my code and got the solution. Using the following line (in inference.html
), we can feed (300,300,3)
shape of image as an input to the model:
Using the following lines in index.js
:
tf_img = tf_img.expandDims(0);
console.log(tf_img.shape) // Image dimension is [1, 300, 300, 3]
We obtain image shape of [1,300,300,3]
which is needed by SSD.