从posenet提取关键点到json文件? [英] Extracting keypoints from posenet to a json file?

查看:494
本文介绍了从posenet提取关键点到json文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究posenet的tensorflow实现,以实时进行姿势估计,如果可能的话,也可以在离线模式下进行姿势估计.我正在研究以下回购协议:

I am looking into the tensorflow implementation of posenet to do pose estimation in real time and also if possible in an offline mode. I am looking into the following repo :

https://github.com/tensorflow/tfjs-models/tree/master/posenet

在下面的代码部分的以下函数中读取关键点

The keypoints are read out in the following function in the following section of code

    export function drawKeypoints(keypoints, minConfidence, ctx, scale = 1) {
  for (let i = 0; i < keypoints.length; i++) {
    const keypoint = keypoints[i];

    if (keypoint.score < minConfidence) {
      continue;
    }

    const {y, x} = keypoint.position;
    drawPoint(ctx, y * scale, x * scale, 3, color);
  }
}

https://github.com/tensorflow/tfjs-models/blob/master/posenet/demos/demo_util.js

我正在研究将关键点提取到json文件的可能性,如果可能的话?

I was looking into the possibility to extract the keypoints to a json file and if it was possible to do so ?

任何有关此方面的提示都将非常有帮助.

Any tips on this regard would be very helpful .

推荐答案

将大块保存到文件是在浏览器环境中写入文件的一种常用方法.在nodejs服务器中,可以为此目的使用fs模块.

Blob saving to a file is a common way of writing to a file in the browser environment. In the nodejs server, one can use the fs module for that purpose.

这是在浏览器中完成此操作的一种方式

Here is a way of doing it in the browser

   var blob = new Blob( [ keypointsData ], {
    type: 'application/octet-stream'
});

var url = URL.createObjectURL( blob );
var link = document.createElement( 'a' );
link.setAttribute( 'href', url );
link.setAttribute( 'download', 'data.json' );
var event = document.createEvent( 'MouseEvents' );
event.initMouseEvent( 'click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
link.dispatchEvent( event );

这篇关于从posenet提取关键点到json文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆