Running object detection using Tensorflow.js

前端 未结 2 1962
梦毁少年i
梦毁少年i 2021-01-24 08:19

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

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-24 08:59

    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.

提交回复
热议问题