共计 4172 个字符,预计需要花费 11 分钟才能阅读完成。
本周迎来了「AI 静止辨认小程序插件」一个具备里程碑意义的性能更新:“姿势类似度比拟”性能。利用此个性能够极大的进步您适配静止(动作)辨认检测的速度,上面就带您体验一下此个性的魅力。
一、确保将插件版本升级至v1.0.7
。
//app.json
{
"plugins": {
"aiSport": {
"version": "1.0.7",
"provider": "wx6130e578c4a26a1a"
}
}
}
二、姿势类似度比拟 API 介绍
「姿势类似度比拟」性能,是对给定的两组“人体关键点”进行分区及综合比拟,并给出评分,省去了您在适配静止(动作)辨认检测时,配置检测规定的繁琐。性能有三个次要对象搁置在插件的 calc
命名空间,别离是:calc.PoseComparer
、calc.PoseComparerResult
、calc.PoseComparerPartItem
,详情的请参考api-docs
。
三、取姿势样本
进行姿势比拟前您须要取一个规范姿势的关键点样本,您能够通过咱们为您提供的「静止构建调试工具」来提取样本。
四、执行样本比拟
// 样本姿势人体关键点
const sample =
[{y:95.41808288282594,x:214.42673274576924,score:0.51611328125,name:"nose"},
{y:84.61684727250136,x:221.80983627909686,score:0.7265625,name:"left_eye"},
{y:87.59059985661885,x:202.12153237356293,score:0.59130859375,name:"right_eye"},
{y:92.85449529945058,x:234.93538334278358,score:0.814453125,name:"left_ear"},
{y:99.07546188234281,x:188.58581196413604,score:0.6806640625,name:"right_ear"},
{y:149.86859452983884,x:271.3040866650822,score:0.7246093153953552,name:"left_shoulder"},
{y:162.78905492065545,x:158.09624324078422,score:0.82666015625,name:"right_shoulder"},
{y:236.41516213602512,x:280.8747980656871,score:0.728515625,name:"left_elbow"},
{y:246.8062369181066,x:156.3188420992395,score:0.55859375,name:"right_elbow"},
{y:305.46100866896046,x:286.61722490605007,score:0.6591796875,name:"left_wrist"},
{y:313.80120003234475,x:152.9006975047454,score:0.70849609375,name:"right_wrist"},
{y:304.5039375289,x:251.342317172392,score:0.87646484375,name:"left_hip"},
{y:303.68360752741575,x:189.6796075527766,score:0.8740234375,name:"right_hip"},
{y:431.38422581120494,x:237.66987231438497,score:0.70703125,name:"left_knee"},
{y:430.01698132540423,x:189.6796075527766,score:0.8017578125,name:"right_knee"},
{y:529.8258287888553,x:229.19295650242066,score:0.6884765625,name:"left_ankle"},
{y:534.747908937738,x:201.71134233782658,score:0.578125,name:"right_ankle"}];
// 以后帧动作,抽帧并且辨认后,取人体辨认后果中的 keypoints
const frame =
[{y:154.06250001297832,x:258.7499999883252,score:0.728515625,name:"nose"},
{y:143.12500001305142,x:254.37499998835446,score:0.56298828125,name:"left_eye"},
{y:143.75001908653357,x:255.937499988344,score:0.69482421875,name:"right_eye"},
{y:143.984394086532,x:229.99999998851743,score:0.43115234375,name:"left_ear"}
,{y:146.17187501303107,x:236.09374998847667,score:0.4919433891773224,name:"right_ear"},
{y:201.4062690861481,x:205.9375190621646,score:0.51416015625,name:"left_shoulder"},
{y:202.03125001265758,x:227.96874998853102,score:0.66259765625,name:"right_shoulder"},
{y:281.25001908561427,x:234.6874999884861,score:0.26416015625,name:"left_elbow"},
{y:270.6250190856853,x:254.06249998835656,score:0.278076171875,name:"right_elbow"},
{y:246.09376908584932,x:289.06249998812257,score:0.1997070610523224,name:"left_wrist"},
{y:238.43750001241418,x:300.62499998804526,score:0.50927734375,name:"right_wrist"},
{y:321.5624618648858,x:218.59376906208004,score:0.58154296875,name:"left_hip"},
{y:323.43750001184594,x:224.06249998855716,score:0.5615234375,name:"right_hip"},
{y:453.43750001097675,x:217.34376906208837,score:0.6103515625,name:"left_knee"},
{y:455.6250000109622,x:214.06249998862396,score:0.51416015625,name:"right_knee"},
{y:572.5000000101808,x:215.31249998861563,score:0.403564453125,name:"left_ankle"},
{y:593.1250000100429,x:216.0937499886104,score:0.52294921875,name:"right_ankle"}];
// 新建比拟器,执行比拟
const poseComparer = new AiSports.calc.PoseComparer();
const result = poseComparer.compare(sample, frame);
console.log(result);
// 输入后果
//{items:
// [{key:"head",score:0.4327263684686711,summary:"头部偏转类似度"},
// {key:"trunk",score:0.8407704975917485,summary:"躯干状态类似度"},
// {key:"left_hand",score:0.2155245751055277,summary:"左手类似度"},
// {key:"right_hand",score:0.21361728579451628,summary:"左手类似度"},
// {key:"left_foot",score:0.5147016736506456,summary:"左脚类似度"},
// {key:"right_foot",score:0.5190758118853293,summary:"右脚类似度"}],
// score:0.5110266728697409 // 整体类似度评分
//}
五、类似度后果利用
获得类似后果后,您能够依据静止(动作)的要求,间接进行总体评分或指定分区的评分判断(倡议类似度在≥0.80 时视为通过 )。若有更精密的要求,也能够再配置一些增强规定进行再检测,详情请参考集成文档的body-calc
相干章节。
注:目前类似度的比拟,在前、后视角时置信度绝对更高,正侧视图稍差些,前期咱们将针对侧视图进行优化,敬请期待。
AI 静止辨认小程序插件介绍:
本插件能够为您的小程序提供人体检测、静止辨认的 AI 能力,插件目前反对跳绳、开合跳、俯卧撑、仰卧起坐、深蹲(深蹲起)、平板撑持、马步蹲等静止的辨认检测计时、计数剖析,更多的静止类型正在丰盛中;插件静止辨认引擎提供了基于规定配置的静止辨认能力,您能够通过配置一些简略的规定,减少一项新的静止(动作)辨认能力,若是简单的静止品种,也能够通过代码扩大的形式进行。
正文完