美文网首页
posenet一些实验

posenet一些实验

作者: 小小英语Merce | 来源:发表于2020-02-10 11:46 被阅读0次

目前能下到的posenet模型有如下:

multi_person_mobilenet_v1_075_float.tflite 5MB

posenet_mobilenet_v1_100_257x257_multi_kpt_stripped.tflite 13MB

用后者在安卓和iphone6上测试,inference的时间平均大概是200ms和100ms。如果换成第一个模型,估计可以到100ms和60ms,仍然会耗费大量的cpu资源。

目前tflite可以使用gpu做代理,降低cpu的消耗,应该是一个不错的方案。

最有希望的是quant int8量化模型,但是官方并没有给出来,似乎float的tflite模型并无法直接量化为int8的模型,所以没办法。如果有根据以往的经验,推理时间可以降低3倍左右,即50ms左右,基本上可以短期使用了。

目前没有尝试。

后面会尝试将heatmap和short offset的做法合并到mobilenetv2+yolov3的模型上,重写loss函数,期望有不错的结果。代更...

实践证明,如果只是定位一个点,根本不需要要heatmap和offset来做,可以直接在conv 1x1的网格上生成置信值,更简单。问题在于当这个点在几个网格交接处时,置信度会下降,heatmap应该是为了解决这个问题而做的,但是肉眼看不到效果,所以选择更直接的算法,效果如下:红框为鼻子尖落入的grid框,绿点代表在框内偏移:

成功的例子1 侧面例子 有点偏 失败的例子

Ref:

https://arxiv.org/abs/1803.08225 the paper,并没有开源

https://medium.com/tensorflow/real-time-human-pose-estimation-in-the-browser-with-tensorflow-js-7dd0bc881cd5 一篇作者相关人士写的blog

https://github.com/scnuhealthy/Tensorflow_PersonLab 这是一个python很厉害的人基于论文写的一个方案,说他python厉害,是因为如下代码比较绕,需要模拟下才知道啥意思。。。值得读下代码,借鉴其loss方法和heatmap short offset的的实现。由于qt的问题,没跑起来。


def compute_heatmaps(kp_maps, short_offsets):

    heatmaps = []

    map_shape = kp_maps.shape[:2]

    idx = np.rollaxis(np.indices(map_shape[::-1]), 0, 3).transpose((1,0,2))

    for i in range(config.NUM_KP):

        this_kp_map = kp_maps[:,:,i:i+1]

        votes = idx + short_offsets[:,:,2*i:2*i+2]

        votes = np.reshape(np.concatenate([votes, this_kp_map], axis=-1), (-1, 3))

        heatmaps.append(accumulate_votes(votes, shape=map_shape) / (np.pi*config.KP_RADIUS**2))

    return np.stack(heatmaps, axis=-1)

https://github.com/google-coral/project-posenet google 的edge coral tpu嵌入式方案

相关文章

网友评论

      本文标题:posenet一些实验

      本文链接:https://www.haomeiwen.com/subject/cehaxhtx.html