With Baidu human brain analysis techniques to help you supervise norms Fitness

[Raiders] [human use critical point identification]

1. The embodiment described
Baidu introduced human identification key, and detects the image of the human body return to position rectangular frame, precise positioning of the core 21 key points, comprising the head, facial, neck, extremities, and joints, support people detection, and other large complex scenes action. Supports multiple human body detection, detection of all the body image, the coordinate position of each marker in the body; Any number of the human body, the body adapted to mild occlusion situation truncated.

Features identify the key points of the human body can be applied to sports and fitness, according to human information key points, analysis of body posture, movement trajectory, angle of movement, sports training aids Athletes and fitness training effect, improve teaching efficiency. In these applications, the determination on body posture is a key, judging by the attitude of action and then determine whether athletes or sports enthusiasts to meet the requirements for gymnastics, yoga pose high requirements for physical activity; somatosensory game even has a very good help.

2. Program and ideas realized
Raiders key through the body to calculate the human left arm, left shoulder, left leg, and right and left hip angle 8, and further compared with the requirements of the standard and the angle between the allowable error range. Enabling determination of body posture and scoring. I developed functionality while providing posture scoring, provide renderings and motion analysis diagram based on the original, easy to analyze athletes. The main contents include the following:

2.1 platform to access
specific access mode is relatively simple, you can refer to my other posts, not repeat it here:
http://ai.baidu.com/forum/topic/show/943327

2.2 Baidu human body key function calls:
Please refer to my other article: Baidu [fourth] human brain new experience to identify critical points
https://ai.baidu.com/forum/topic/show/954123

2.3 Other aspects:
angle calculation: calculating by a cosine.
Key Filters: keys for different confidence rendered and displayed in FIG analysis, of 0.9 or more with green, yellow 0.5-0.9, 0.5 or less in a different color red. Convenient user identification.
Rendering: rendering on the original, and the main display key connection, including the body, limbs, head, face an increased central axis from the head to the neck to the nose.
Analysis Figure: show key points and main connections, including the body in the new picture, limbs, head, face increased a central axis from the nose to the top of the head to the neck, enabling users to view the face direction. Also shows the angle of each position and meets the requirements, if they meet the green, red if not match. Benefit of the athletes were analyzed.

Number * number of angle by an angle of 100 / Total identified: the determination score

3 achieve results and test:

Case 1: A classic gymnastics pommel horse action:

Requirements limbs straight, right leg and the body straight, left leg about 75 degrees. The following is a specific angle requirements:

required_pose1={
'shoulder_left_angle':[15,10],
'shoulder_right_angle':[60,10],
'hip_left_angle':[180,10],
'hip_right_angle':[75,10],

'arm_left_angle':[180,10],
'arm_right_angle':[180,10],
'leg_left_angle':[180,10],
'leg_right_angle':[180,10]
}

The above values ​​each required angle for the first, second to allow room for error.

Below is a rendering, charts and reports:

 

处理时长:0.71秒
person_num: 1
左肩:13.0,符合
右肩:57.5,符合
左髋:175.6,符合
右髋:71.6,符合
左臂:171.2,符合
右臂:173.1,符合
左腿:171.9,符合
右腿:178.8,符合
动作评分:100.0

 

案例2:多人双手张开动作:

动作模板,双手张开:

required_pose2={
'shoulder_left_angle':[90,10],
'shoulder_right_angle':[90,10],
'hip_left_angle':[170,10],
'hip_right_angle':[170,10],

'arm_left_angle':[180,10],
'arm_right_angle':[180,10],
'leg_left_angle':[180,10],
'leg_right_angle':[180,10]
}

渲染图:

分析图:

报告:

处理时长:4.00秒
person_num: 2
左肩:93.6,符合
右肩:99.5,符合
左髋:165.8,符合
右髋:171.7,符合
左臂:171.9,符合
右臂:180.0,符合
左腿:174.5,符合
右腿:175.2,符合
动作评分:100.0


左肩:116.6,不符
右肩:108.4,不符
左髋:156.8,不符
右髋:164.7,符合
左臂:175.2,符合
右臂:180.0,符合
左腿:nan,不符
右腿:175.2,符合
动作评分:50.0

案例3,瑜伽动作:

动作模板:

required_pose3={
'shoulder_left_angle':[180,10],
'shoulder_right_angle':[80,10],
'hip_left_angle':[110,10],
'hip_right_angle':[80,10],

'arm_left_angle':[45,10],
'arm_right_angle':[45,10],
'leg_left_angle':[30,10],
'leg_right_angle':[55,10]
}

渲染图:

分析图:

报告:

处理时长:0.82秒
person_num: 1
左肩:172.1,符合
右肩:79.0,符合
左髋:108.1,符合
右髋:81.9,符合
左臂:37.4,符合
右臂:36.9,符合
左腿:9.0,不符
右腿:48.2,符合
动作评分:87.5

4 关键代码

import numpy as np
#求角度
def GetCrossAngle(l1p1,l1p2,l2p1,l2p2):
    arr_0 = np.array([(l1p2['x'] - l1p1['x']), (l1p2['y'] - l1p1['y'])])
    arr_1 = np.array([(l2p2['x'] - l2p1['x']), (l2p2['y'] - l2p1['y'])])
    cos_value = (float(arr_0.dot(arr_1)) / (np.sqrt(arr_0.dot(arr_0)) * np.sqrt(arr_1.dot(arr_1))))   
    result = 180-(np.arccos(cos_value) * (180/np.pi))
    result = round(result,1)
    return result

#判断角度是否符合要求
def angle_if(d,beginkey,middlekey,endkey,draw,color,setFont,text='',required=None):
    total=0
    score=0
    if ((beginkey in d)&(endkey in d)&(middlekey in d)):
        total=1
        angle=GetCrossAngle(d[beginkey],d[middlekey],d[middlekey],d[endkey])
        result=text+str(angle)
        if required:
            #print(str(required[0]))
            if abs(angle-required[0])

5,测试结果及与竞品的对比

整体测试下来发现,百度人体关键点识别对人体关键点有较强的识别能力,在此基础上构建的人体姿态判定打分功能的效果很好,速度也很快。可以广泛的应用于体育健身及娱乐互动等方面。

现在国内做人体关键点产品的除了百度还有商汤和Face++,在这里也做一个简单的对比。

FACE++

Face++对应的功能名称是:人体骨骼关键点检测 API。效果为传入图片进行人体检测和骨骼关键点检测,定位并返回人体14个关键点(头、颈、肩、肘、手、臀、膝、脚)等部位。支持对图片中的所有人体进行骨骼检测

具体点位如下图所示:

分析效果如图:

商汤科技:

支持14 点人体关键点定位,通过 RGB 图像输入超实时给出人体头、肩、腰、腿等位置。分析效果如图所示:

通过对比可以发现,功能方面,Face++和商汤科技都是检测14个点,百度是21个点。百度多的点主要是在面部,这对于判定人脸的朝向和面部表情有很大帮助(大家可以对比一下渲染图,百度可以渲染出脸部朝向,其他的两个不行)这一点对于一些应用场景是很有用的。性价比方面,百度现在有50000次/天免费调用量,这对于测试和小型应用都足够了。对于商业应用的的价格也很低,所以百度性价比的优势也很大。

 

6,优化建议

就像手部有关键点识别和手势识别一样,建议百度直接建立一个人体姿态识别的新功能,直接返回人体的姿态识别的结果。可以在夹角的基础上增加更多的内容。对于有这方面需要的用户,用的也更方便。

作者: 才能我浪费99

Guess you like

Origin www.cnblogs.com/AIBOOM/p/12020109.html