فهرست منبع

add ai/video analysis

张许妍 3 سال پیش
والد
کامیت
67b3d47e3f

+ 12 - 0
backend_refactor/service/ai/video/classify/balancebeam.py

@@ -0,0 +1,12 @@
+def classify_balancebeam(re):
+    ret=""
+    if float(re["1"]["total_score"]) > 90:
+        ret = ret + "The movement process and core strength are good. "
+    elif float(re["2"]["total_score"]) > 80:
+        ret = ret + "The movement process and core strength are not bad. "
+    elif float(re["2"]["total_score"]) > 70:
+        ret = ret + "The movement process needs to be improved. Need to do more to promote the core strength. The body_stability is not enough. Take some practice on the leg."
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. The core strength need to be improved. The body_stability is far from standard, see some relevant video to correct posture ."
+
+    return {"data": re, "advice": ret}

+ 2 - 2
backend_refactor/service/ai/video/classify/juanfu.py

@@ -6,14 +6,14 @@ def ad_juanfu(result):
         ret = "The neck and abdominal muscles are weak and the position needs to be improved. "
 
     if (result["core_strength"]["level"] == 3):
-        ret = ret + "The core strength need to be improved.See some relavent video to promote it. "
+        ret = ret + "The core strength need to be improved.See some relevent video to promote it. "
     elif result["core_strength"]["level"] == 4:
         ret = ret + "More practice to do to promote the core strength. "
 
     if (result["body_stability"]["level"] == 3):
         ret = ret + "The body_stability is not enough. Take some practice on the leg. "
     elif result["body_stability"]["level"] == 4:
-        ret = ret + "The body_stability is far from standard, see some relavant video to correct posture . "
+        ret = ret + "The body_stability is far from standard, see some relevant video to correct posture . "
     if (ret == ""):
         ret = "The abdominal campaign is good and keep it!"
     return ret

+ 53 - 0
backend_refactor/service/ai/video/classify/jump.py

@@ -0,0 +1,53 @@
+
+def classify_jump(re):
+    ret = ""
+
+    if float(re["5"]["total_score"]) > 82:
+        ret = ret + "The movement process is good.  "
+    elif float(re["5"]["total_score"]) > 70:
+        ret = ret + "The movement process is not bad. "
+    elif float(re["5"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. "
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. "
+
+    if re["1"]["is_prepared"]:
+        if float(re["1"]["first_score"]) > 85:
+            ret = ret + "Your upper and lower body movements are coordinated, and the setup position is perfect. "
+        elif float(re["1"]["first_score"]) > 75:
+            ret = ret + "Your upper and lower body movements are coordinated, but the setup position is not standard enough. "
+        elif float(re["1"]["first_score"]) > 65:
+            ret = ret + "The setup position is not standard enough. Take more practice."
+        else:
+            ret = ret + "The setup position is far from standard, see some relevant video to correct posture."
+    else:
+        ret = ret + "Lack the setup position. "
+
+    if float(re["2"]["second_score"]) > 85:
+        ret = ret + "The upper part of the body is slightly forward, and the push is fast and powerful. "
+    elif float(re["2"]["second_score"]) > 75:
+        ret = ret + "The upper part of the body is slightly forward, and the push is fast and powerful. "
+    elif float(re["2"]["second_score"]) > 65:
+        ret = ret + "There is no front drive on the upper body, and the push is fast and powerful. "
+    else:
+        ret = ret + "The upper body has no front drive, and the push-off is not fast and powerful. "
+
+    if float(re["3"]["third_score"]) > 85:
+        ret = ret + "The pedal and the hand swing are very harmonious. "
+    elif float(re["3"]["third_score"]) > 75:
+        ret = ret + "Pedal and hand swing are not in harmony. "
+    elif float(re["3"]["third_score"]) > 65:
+        ret = ret + "Foot pedal and hand swing are not coordinated. "
+    else:
+        ret = ret + "Foot pedal and hand swing are not coordinated. "
+
+    if float(re["4"]["forth_score"]) > 80:
+        ret = ret + "The air stretch is full.  "
+    elif float(re["4"]["forth_score"]) > 70:
+        ret = ret + "The air stretch is not sufficient. "
+    elif float(re["4"]["forth_score"]) > 60:
+        ret = ret + "The air stretch is insufficient. "
+    else:
+        ret = ret + "There is no stretch in the air. "
+
+    return {"data": re, "advice": ret}

+ 30 - 0
backend_refactor/service/ai/video/classify/jumpwithboth.py

@@ -0,0 +1,30 @@
+def classify_jumpwithboth(re):
+    ret = ""
+    if float(re["2"]["total_score"]) > 85:
+        ret = ret + "The movement process is good.  "
+    elif float(re["2"]["total_score"]) > 75:
+        ret = ret + "The movement process is not bad. "
+    elif float(re["2"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. "
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. "
+
+    if float(re["1"]["first_score"]) > 85:
+        ret = ret + "You did the good jump in the air.  "
+    elif float(re["1"]["first_score"]) > 75:
+        ret = ret + "Your jumping in the air is not up to standard. "
+    elif float(re["1"]["first_score"]) > 60:
+        ret = ret + "Your jumping in the air needs a lot of improvement. "
+    else:
+        ret = ret + "Your jumping in the air is far from standard, see some relevant video to correct posture. "
+
+    if float(re["2"]["second_score"]) > 85:
+        ret = ret + "You did the good landing action.  "
+    elif float(re["2"]["second_score"]) > 75:
+        ret = ret + "Your landing action is not up to standard. "
+    elif float(re["2"]["second_score"]) > 60:
+        ret = ret + "Your landing action needs a lot of improvement. "
+    else:
+        ret = ret + "Your landing action is far from standard, see some relevant video to correct posture. "
+
+    return {"data": re, "advice": ret}

+ 36 - 0
backend_refactor/service/ai/video/classify/pingban.py

@@ -0,0 +1,36 @@
+def classify_pingban(re):
+    ret = ""
+    if float(re["2"]["total_score"]) > 82:
+        ret = ret + "The movement process is good.  "
+    elif float(re["2"]["total_score"]) > 70:
+        ret = ret + "The movement process is not bad. "
+    elif float(re["2"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. "
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. "
+
+    if re["1"]["no_first_posture"] == "true":
+        ret = ret + "Lack the setup position. "
+    else:
+        if float(re["1"]["first_score"]) > 80:
+            ret = ret + "The setup position is good. "
+        elif float(re["1"]["first_score"]) > 70:
+            ret = ret + "The setup position is not bad. "
+        elif float(re["1"]["first_score"]) > 60:
+            ret = ret + "The setup position is not standard enough. Take more practice."
+        else:
+            ret = ret + "The setup position is far from standard, see some relevant video to correct posture."
+
+    if float(re["2"]["elbow_right_angle"]) > 120 or float(re["2"]["elbow_left_angle"]) > 120:
+        if float(re["2"]["second_score"]) > 84:
+            ret = ret + "The core strength is good. "
+        elif float(re["2"]["second_score"]) > 75:
+            ret = ret + "The core strength is not bad. "
+        elif float(re["2"]["second_score"]) > 65:
+            ret = ret + "Need to do more to promote the core strength. "
+        else:
+            ret = ret + "The core strength need to be improved. "
+    else:
+        ret = ret + "Your score is lower because your elbows are bent.Try changing positions. "
+
+    return {"data": re, "advice": ret}

+ 26 - 0
backend_refactor/service/ai/video/classify/sitforward.py

@@ -0,0 +1,26 @@
+def classify_sitforward(re):
+    ret = ""
+    if float(re["1"]["total_score"]) > 85:
+        ret = ret + "The movement process is good.  "
+    elif float(re["1"]["total_score"]) > 75:
+        ret = ret + "The movement process is not bad. "
+    elif float(re["1"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. "
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. "
+
+    if float(re["1"]["elbow_right_angle"]) > 170 or float(re["1"]["elbow_left_angle"]) > 170:
+        ret = ret + "Keep your arms together and straight out. "
+    elif float(re["1"]["elbow_right_angle"]) > 160 or float(re["1"]["elbow_left_angle"]) > 160:
+        ret = ret + "Your arms are not straight and need a lot of improvement. "
+    else:
+        ret = ret + "Your arms are far from standard, see some relevant video to correct posture. "
+
+    if float(re["1"]["knee_right_angle"]) > 170 or float(re["1"]["knee_left_angle"]) > 170:
+        ret = ret + "Keep your knees straight and hold them well. "
+    elif float(re["1"]["knee_right_angle"]) > 160 or float(re["1"]["knee_left_angle"]) > 160:
+        ret = ret + "Your legs are not straight and need a lot of improvement."
+    else:
+        ret = ret + "Your legs are far from standard, see some relevant video to correct posture. "
+
+    return {"data": re, "advice": ret}

+ 12 - 0
backend_refactor/service/ai/video/classify/standing.py

@@ -0,0 +1,12 @@
+def classify_standing(re):
+    ret=""
+    if float(re["1"]["total_score"]) > 90:
+        ret = ret + "The movement process and core strength are good. "
+    elif float(re["1"]["total_score"]) > 75:
+        ret = ret + "The movement process and core strength are not bad. "
+    elif float(re["1"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. Need to do more to promote the core strength. The body_stability is not enough. Take some practice on the leg."
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. The core strength need to be improved. The body_stability is far from standard, see some relevant video to correct posture. "
+
+    return {"data": re, "advice": ret}

+ 35 - 0
backend_refactor/service/ai/video/classify/tennisthrow.py

@@ -0,0 +1,35 @@
+def classify_tennisthrow(re):
+    ret = ""
+    if float(re["2"]["total_score"]) > 85:
+        ret = ret + "The movement process is good.  "
+    elif float(re["2"]["total_score"]) > 75:
+        ret = ret + "The movement process is not bad. "
+    elif float(re["2"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. "
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. "
+
+    if float(re["1"]["first_score"]) > 85:
+        ret = ret + "The setup position is good. "
+    elif float(re["1"]["first_score"]) > 75:
+        ret = ret + "The setup position is not bad. "
+    elif float(re["1"]["first_score"]) > 65:
+        ret = ret + "The setup position is not standard enough. Take more practice. "
+    else:
+        ret = ret + "The setup position is far from standard, see some relevant video to correct posture. "
+
+    if 130 < float(re["1"]["knee_right_angle"]) < 150 or 130 < float(re["1"]["knee_left_angle"]) < 150:
+        ret = ret + "Your knees are bent in place. Good job. "
+    else:
+        ret = ret + "Your knees are not bent in place and need some improvement. "
+
+    if float(re["2"]["second_score"])>85:
+        ret = ret + "When you throw the tennis ball, your action is standard. "
+    elif float(re["2"]["second_score"])>75:
+        ret = ret + "You don't throw the tennis ball very well. "
+    elif float(re["2"]["second_score"])>65:
+        ret = ret + "You need to improve your motion when you throw the tennis ball. "
+    else:
+        ret = ret + "When you throw the tennis ball, your action is far from standard, see some relevant video to correct posture. "
+
+    return {"data": re, "advice": ret}

+ 33 - 0
backend_refactor/service/ai/video/classify/turnaround.py

@@ -0,0 +1,33 @@
+def classify_turnaround(re):
+    ret = ""
+    if float(re["2"]["total_score"]) > 85:
+        ret = ret + "The movement process is good.  "
+    elif float(re["2"]["total_score"]) > 74:
+        ret = ret + "The movement process is not bad. "
+    elif float(re["2"]["total_score"]) > 60:
+        ret = ret + "The movement process needs to be improved. "
+    else:
+        ret = ret + "The movement process is terrible and needs to be improved. "
+    if float(re["1"]["elbow_right_angle"]) > 105 or float(re["1"]["elbow_left_angle"]) > 105:
+        ret = ret + "Pay attention to arm bending during running. "
+    else:
+        ret = ret + "Not bad arm posture during the run. "
+    if float(re["1"]["first_score"]) > 85:
+        ret = ret + "The leg muscle is good. "
+    elif float(re["1"]["first_score"]) > 75:
+        ret = ret + "The leg muscle is not bad, but still need to do more practise. "
+    elif float(re["1"]["first_score"]) > 60:
+        ret = ret + "Need to do more to promote leg muscle strength. "
+    else:
+        ret = ret + "The leg muscle is weak and the position needs to be improved. "
+
+    if float(re["2"]["second_score"]) > 88:
+        ret = ret + "Your movements when you touch the obstacles are very standard. "
+    elif float(re["2"]["second_score"]) > 78:
+        ret = ret + "The action when you touch the obstacle is not very standard. "
+    elif float(re["2"]["second_score"]) > 65:
+        ret = ret + "The way you touch the obstacles needs a lot of improvement. "
+    else:
+        ret = ret + "You may have questions about what to do when you touch an obstacle, see some relevant video to correct posture."
+
+    return {"data": re, "advice": ret}

+ 3 - 3
backend_refactor/service/ai/video/video_score/jumpwithboth.py

@@ -41,9 +41,9 @@ def cal_average_score(list, mode):
         if mode == 1:
             score = cal_ratio(
                 item["ankle_right_angle"],
-                155) * 20 + cal_ratio(
-                item["ankle_right_angle"], 155) * 20 + cal_ratio(item["knee_left_angle"], 170) * 30 + cal_ratio(
-                item["knee_right_angle"], 170) * 30
+                140) * 20 + cal_ratio(
+                item["ankle_right_angle"], 140) * 20 + cal_ratio(item["knee_left_angle"], 160) * 30 + cal_ratio(
+                item["knee_right_angle"], 160) * 30
 
         else:
             is_clean = check_elbow(item)

+ 1 - 1
backend_refactor/service/ai/video/video_score/pingban.py

@@ -76,7 +76,7 @@ def cal_pingban(result):
         re["1"]["first_score"] = round(first_score, 2)
         re["1"]["first_index"] = first_index
     else:
-        re["1"] = result_ig["1"]
+        re["1"] = result_ig[list(result.keys())[0]]
         re["1"]["no_first_posture"] = "true"
     # second posture
     max_knee_angle = float(result_ig[list(result.keys())[0]]["hip_right_angle"])

+ 4 - 4
backend_refactor/service/ai/video/video_score/sitforward.py

@@ -44,10 +44,10 @@ def cal_sitforward(result):
     is_zero(result_ig, highest_weist_index)
     total_score = cal_ratio(result_ig[highest_weist_index]["elbow_right_angle"], 180) * 20 + cal_ratio(
         result_ig[highest_weist_index]["elbow_left_angle"], 180) * 20 + cal_ratio(
-        result_ig[highest_weist_index]["knee_right_angle"], 180) * 20 + cal_ratio(
-        result_ig[highest_weist_index]["knee_left_angle"], 180) * 20 + cal_ratio(
-        result_ig[highest_weist_index]["ankle_right_angle"], 90) * 10 + cal_ratio(
-        result_ig[highest_weist_index]["ankle_left_angle"], 90) * 10
+        result_ig[highest_weist_index]["knee_right_angle"], 180) * 25 + cal_ratio(
+        result_ig[highest_weist_index]["knee_left_angle"], 180) * 25 + cal_ratio(
+        result_ig[highest_weist_index]["ankle_right_angle"], 100) * 5 + cal_ratio(
+        result_ig[highest_weist_index]["ankle_left_angle"], 100) * 5
 
     re["1"] = result[highest_weist_index]
     re["1"]["highest_wrist_x"] = highest_wrist_x

+ 27 - 12
backend_refactor/service/ai/video/video_score/standing.py

@@ -43,14 +43,14 @@ def cal_average_score(list, mode):
                 item["should_right_angle"],
                 180) * 5 + cal_ratio(
                 item["should_left_angle"], 180) * 5 + cal_ratio(item["neck_right_angle"], 65) * 10 + cal_ratio(
-                item["neck_left_angle"], 65) * 10 + cal_ratio(item["knee_left_angle"], 90) * 30 + cal_ratio(
-                item["knee_right_angle"], 180) * 30
+                item["neck_left_angle"], 65) * 10 + cal_ratio(item["knee_left_angle"], 90) * 20 + cal_ratio(
+                item["knee_right_angle"], 180) * 40
         else:
             score = cal_ratio(item["elbow_right_angle"], 180) * 5 + cal_ratio(item["elbow_left_angle"],
                                                                               180) * 5 + cal_ratio(
                 item["should_right_angle"], 180) * 5 + cal_ratio(item["should_left_angle"], 180) * 5 + cal_ratio(
                 item["neck_right_angle"], 65) * 10 + cal_ratio(item["neck_left_angle"], 65) * 10 + cal_ratio(
-                item["knee_right_angle"], 90) * 30 + cal_ratio(item["knee_left_angle"], 180) * 30
+                item["knee_right_angle"], 90) * 20 + cal_ratio(item["knee_left_angle"], 180) * 40
 
         sum_score = sum_score + score
     sum_score = round(sum_score / num, 2)
@@ -66,6 +66,8 @@ def cal_standing(result):
     highest_ankle_index = 0
     highest_ankle = 1000
     satisfied_pics = []
+    minest_knee_angle = 180
+    minest_knee_angle_index = 0
 
     for index in result:
         if float(result[index]["knee_right_angle"]) < 165:
@@ -82,16 +84,29 @@ def cal_standing(result):
         if float(result[index]["leg_right_heigh"]) < float(highest_ankle) and mode == "knee_right_angle":
             highest_ankle = result[index]["leg_right_heigh"]
             highest_ankle_index = index
+        if float(result_ig[index]["knee_right_angle"]) < float(minest_knee_angle) and mode == "knee_right_angle":
+            minest_knee_angle = result_ig[index]["knee_right_angle"]
+            minest_knee_angle_index = index
+        if float(result_ig[index]["knee_left_angle"]) < float(minest_knee_angle) and mode == "knee_left_angle":
+            minest_knee_angle = result_ig[index]["knee_left_angle"]
+            minest_knee_angle_index = index
 
-    total_score = cal_average_score(satisfied_pics, mode)
-    highest_ankle_score = cal_average_score([result[highest_ankle_index]], mode)
-    re["1"] = result[highest_ankle_index]
-    re["1"]["begin_index"] = begin_index
-    re["1"]["number_of_satisfied"] = len(satisfied_pics)
-    re["1"]["highest_ankle_height"] = highest_ankle
-    re["1"]["highest_ankle_index"] = highest_ankle_index
-    re["1"]["highest_ankle_score"] = highest_ankle_score
-    re["1"]["total_score"] = total_score
+    # total_score = cal_average_score(satisfied_pics, mode)
+    # highest_ankle_score = cal_average_score([result[highest_ankle_index]], mode)
+    minest_knee_score = cal_average_score([result[minest_knee_angle_index]], mode)
+
+    re["1"] = result[minest_knee_angle_index]
+    re["1"]["mode"] = mode
+    re["1"]["minest_knee_angle"] = minest_knee_angle
+    re["1"]["minest_knee_angle_index"] = minest_knee_angle_index
+    re["1"]["total_score"] = minest_knee_score
+
+    # re["1"]["begin_index"] = begin_index
+    # re["1"]["number_of_satisfied"] = len(satisfied_pics)
+    # re["1"]["highest_ankle_height"] = highest_ankle
+    # re["1"]["highest_ankle_index"] = highest_ankle_index
+    # re["1"]["highest_ankle_score"] = highest_ankle_score
+    # re["1"]["total_score"] = total_score
     print("finish capturing postures and calculating scores")
     print("result-----------")
     print(re)

+ 11 - 10
backend_refactor/service/ai/video/video_score/tennisthrow.py

@@ -27,13 +27,13 @@ def is_zero(result_ig, index):
 def cal_average_score(item, hand, mode):
     score = 0
     if hand == "elbow_left_angle" and mode == 1:
-        score = cal_ratio(item[hand], 85) * 50 + cal_ratio(
-            item["hip_right_angle"], 160) * 20 + cal_ratio(item["knee_right_angle"], 135) * 15 + cal_ratio(
-            item["knee_left_angle"], 145) * 15
+        score = cal_ratio(item[hand], 100) * 50 + cal_ratio(
+            item["hip_right_angle"], 160) * 20 + cal_ratio(item["knee_right_angle"], 145) * 15 + cal_ratio(
+            item["knee_left_angle"], 155) * 15
     elif hand == "elbow_right_angle" and mode == 1:
-        score = cal_ratio(item[hand], 85) * 50 + cal_ratio(
-            item["hip_left_angle"], 160) * 20 + cal_ratio(item["knee_left_angle"], 135) * 15 + cal_ratio(
-            item["knee_right_angle"], 145) * 15
+        score = cal_ratio(item[hand], 100) * 50 + cal_ratio(
+            item["hip_left_angle"], 160) * 20 + cal_ratio(item["knee_left_angle"], 145) * 15 + cal_ratio(
+            item["knee_right_angle"], 155) * 15
     elif hand == "elbow_left_angle" and mode == 2:
         score = cal_ratio(item[hand], 135) * 70 + cal_ratio(item["knee_right_angle"], 135) * 15 + cal_ratio(
             item["knee_left_angle"], 160) * 15
@@ -119,10 +119,11 @@ def cal_tennisthrow(result):
     re["1"]["farrest_distance"] = farrest_distance
     re["1"]["first_score"] = first_score
 
-    re["3"] = result_ig[highest_wrist_index]
-    re["3"]["highest_wrist_index"] = highest_wrist_index
-    re["3"]["highest_wrist"] = highest_wrist
-    re["3"]["third_score"] = third_score
+    re["2"] = result_ig[highest_wrist_index]
+    re["2"]["highest_wrist_index"] = highest_wrist_index
+    re["2"]["highest_wrist"] = highest_wrist
+    re["2"]["second_score"] = third_score
+    re["2"]["total_score"] = round(first_score * 0.3 + third_score * 0.7, 2)
 
     print("finish capturing postures and calculating scores")
     print("result-----------")

+ 25 - 8
backend_refactor/service/ai/video/video_score/turnaround.py

@@ -52,20 +52,37 @@ def cal_average_score(list, mode):
         if mode == 1:
             is_clean = check_elbow(item)
             if (is_clean):
-                score = cal_ratio(item["elbow_right_angle"], 95) * 20 + cal_ratio(item["elbow_left_angle"],
-                                                                                  95) * 20 + cal_ratio(
-                    item["ankle_right_angle"],
-                    95) * 10 + cal_ratio(
-                    item["ankle_right_angle"], 95) * 10 + cal_ratio(item["knee_left_angle"], 165) * 20 + cal_ratio(
-                    item["knee_right_angle"], 165) * 20
+                if abs(float(item["ankle_right_angle"])-float(item["ankle_left_angle"]))>60:
+                    if abs(float(item["ankle_right_angle"])-110)>abs(float(item["ankle_left_angle"])-110):
+                        item["ankle_right_angle"]=item["ankle_left_angle"]
+                        score = cal_ratio(item["elbow_right_angle"], 95) * 20 + cal_ratio(item["elbow_left_angle"],
+                                                                                          95) * 20 + cal_ratio(
+                            item["ankle_left_angle"],
+                            120) * 20 + cal_ratio(item["knee_left_angle"], 165) * 20 + cal_ratio(
+                            item["knee_right_angle"], 165) * 20
+                    else:
+                        item["ankle_left_angle"] = item["ankle_right_angle"]
+                        score = cal_ratio(item["elbow_right_angle"], 95) * 20 + cal_ratio(item["elbow_left_angle"],
+                                                                                          95) * 20 + cal_ratio(
+                            item["ankle_right_angle"],
+                            120) * 20 + cal_ratio(item["knee_left_angle"], 165) * 20 + cal_ratio(
+                            item["knee_right_angle"], 165) * 20
+                else:
+                    score = cal_ratio(item["elbow_right_angle"], 95) * 20 + cal_ratio(item["elbow_left_angle"],
+                                                                                      95) * 20 + cal_ratio(
+                        item["ankle_right_angle"],
+                        120) * 10 + cal_ratio(
+                        item["ankle_left_angle"], 120) * 10 + cal_ratio(item["knee_left_angle"], 165) * 20 + cal_ratio(
+                        item["knee_right_angle"], 165) * 20
+
             else:
                 num = num - 1
                 score = 0
         else:
             score = cal_ratio(item["knee_left_angle"], 165) * 15 + cal_ratio(
-                item["knee_right_angle"], 165) * 35 + cal_ratio(item["ankle_small_left_angle"],
+                item["knee_right_angle"], 165) * 35 + cal_ratio(item["ankle_left_angle"],
                                                                 90) * 15 + cal_ratio(
-                item["ankle_small_right_angle"], 90) * 35
+                item["ankle_right_angle"], 90) * 35
 
         sum_score = sum_score + score
     sum_score = round(sum_score / num, 2)

+ 24 - 8
backend_refactor/service/video_analyzer.py

@@ -11,6 +11,14 @@ from service.ai.util.util import draw_bodypose
 from service.ai.video.classify.gaotaitui import classify_gaotaitui
 from service.ai.video.classify.juanfu import classify_juanfu
 from service.ai.video.classify.shendun import classify_shendun
+from service.ai.video.classify.turnaround import classify_turnaround
+from service.ai.video.classify.standing import classify_standing
+from service.ai.video.classify.pingban import classify_pingban
+from service.ai.video.classify.balancebeam import classify_balancebeam
+from service.ai.video.classify.jump import classify_jump
+from service.ai.video.classify.jumpwithboth import classify_jumpwithboth
+from service.ai.video.classify.sitforward import classify_sitforward
+from service.ai.video.classify.tennisthrow import classify_tennisthrow
 from service.ai.video.inner_analyze import analyse_npy_side_jump, analyse_npy_side_juanfu, analyse_npy_side_shendun, \
     analyse_npy_side_gaotaitui
 from service.ai.video.video_score.balancebeam import cal_balancebeam
@@ -97,13 +105,15 @@ class BaseVideoAnalyzer:
 class JumpVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_jump(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_jump(self.results)[1]
+        return {"raw": raw, "analysis": classify_jump(raw)}
 
 
 class PingbanVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_pingban(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_pingban(self.results)[1]
+        return {"raw": raw, "analysis": classify_pingban(raw)}
 
 
 class JuanfuVideoAnalyzer(BaseVideoAnalyzer):
@@ -130,34 +140,40 @@ class GaotaituiVideoAnalyzer(BaseVideoAnalyzer):
 class TurnaroundVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_turnaround(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_turnaround(self.results)[1]
+        return {"raw": raw, "analysis": classify_turnaround(raw)}
 
 
 class TennisthrowVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_tennisthrow(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_tennisthrow(self.results)[1]
+        return {"raw": raw, "analysis": classify_tennisthrow(raw)}
 
 
 class JumpwithbothVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_jumpwithboth(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_jumpwithboth(self.results)[1]
+        return {"raw": raw, "analysis": classify_jumpwithboth(raw)}
 
 
 class SitforwardVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_sitforward(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_sitforward(self.results)[1]
+        return {"raw": raw, "analysis": classify_sitforward(raw)}
 
 
 class BalancebeamVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_balancebeam(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_balancebeam(self.results)[1]
+        return {"raw": raw, "analysis": classify_balancebeam(raw)}
 
 
 class StandingVideoAnalyzer(BaseVideoAnalyzer):
     def _do_analyze(self):
         self.results = {k: analyse_npy_side_jump(v) for k, v in self.results.items()}
-        return {"raw": cal_standing(self.results)[1], "analysis": "AI组说还没写完"}
+        raw = cal_standing(self.results)[1]
+        return {"raw": raw, "analysis": classify_standing(raw)}