Search code examples
javascriptreactjstensorflow.js

I'm trying to get the output from my model,but got 4 tensor.I dont know anything about these tensors


I'm trying to get the output from my model,but got 4 tensor.I dont know anything about these tensors i use the model to detect face. Here is my model enter image description here

The model's input is frame of Webcam ,Here is the output enter image description here

here are my code

      const img = tf.browser.fromPixels(video)
      let resized = img;
      if (img.shape[0] !== 640 || img.shape[1] !== 640) {
        const alignCorners = true;
        resized = tf.image.resizeBilinear(
          img, [640, 640], alignCorners,
        );
      }

      // 
      const batched = resized.reshape([-1, 640, 640, 3]);

      // console.log(batched)
      const obj = await net.executeAsync(batched);
      console.log(obj);

Solution

  • To get the tensor data, you can use the dataSync method which is the synchronous version of data