为什么我在 tensorflow.js posenet 的响应中让 x 和 y 的位置都为 0?

Bik*_*ram 3 tensorflow.js

初始化posenet

const net = await posenet.load();

const pose = await net.estimateSinglePose(videoElement, {
  flipHorizontal: false
});
Run Code Online (Sandbox Code Playgroud)

输出

part: "leftEye"
position: {x: 0, y: 0}
score: 0.9931495785713196
Run Code Online (Sandbox Code Playgroud)

我的问题是,即使分数很高,我的每个身体部位也总是得到位置 0,0。

Bik*_*ram 8

我想出了解决办法。确保为源元素(图像或视频)添加宽度和高度。请注意,如果您从 css 添加宽度和高度,它将不起作用,您需要以编程方式添加它。

 video = document.getElementById("video");

 //must add the following
 video.width = 500;
 video.height = 500;
Run Code Online (Sandbox Code Playgroud)