利用Vue.js和TensorFlow.js进行图像识别及构建ASP.NET Core音乐库
一、Vue.js与TensorFlow.js实现姿态检测
在姿态检测代码中, PoseClassifier 类的构造函数会处理 WebGLTexture 问题。若在Windows系统上运行,加载 WebGL 纹理可能会出现问题,可通过以下代码解决:
constructor() {
// If running on Windows, there can be issues
// loading WebGL textures properly.
// Running the following command solves this.
tf.ENV.set('WEBGL_PACK', false);
}
接下来编写异步的 Pose 方法,该方法会返回 Keypoint 数组,若 PoseNet 模型加载失败或未找到任何姿态则返回 null 。此方法不仅接受图像,还接受用于绘制点的画布:
public async Pose(image: HTMLImageElement, canvas: HTMLCanvasElement):
Promise<Keypoint[] | null> {
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



