Showing
1 changed file
with
7 additions
and
3 deletions
... | @@ -58,6 +58,8 @@ | ... | @@ -58,6 +58,8 @@ |
58 | let status = "stand" ; | 58 | let status = "stand" ; |
59 | // 갯수 count | 59 | // 갯수 count |
60 | let count = 0; | 60 | let count = 0; |
61 | + // 잘못된 경우 count | ||
62 | + let wrong_count = 0; | ||
61 | 63 | ||
62 | async function predict() { | 64 | async function predict() { |
63 | // Prediction #1: run input through posenet | 65 | // Prediction #1: run input through posenet |
... | @@ -71,10 +73,11 @@ | ... | @@ -71,10 +73,11 @@ |
71 | if (status == "squart") | 73 | if (status == "squart") |
72 | { | 74 | { |
73 | count++; | 75 | count++; |
76 | + console.log(`올바른 스쿼트 : ${count}`) | ||
74 | } | 77 | } |
75 | status = "stand"; | 78 | status = "stand"; |
76 | } | 79 | } |
77 | - else if (prediction[1].probability.toFixed(2) == 1.00) // 스쿼트 자세 | 80 | + else if (prediction[1].probability.toFixed(2) > 1.00) // 스쿼트 자세 |
78 | { | 81 | { |
79 | status = "squart"; | 82 | status = "squart"; |
80 | } | 83 | } |
... | @@ -82,11 +85,12 @@ | ... | @@ -82,11 +85,12 @@ |
82 | { | 85 | { |
83 | if (status == "squart" || status == "stand") // 굽은 자세로 잘못 수행하면, | 86 | if (status == "squart" || status == "stand") // 굽은 자세로 잘못 수행하면, |
84 | { | 87 | { |
85 | - console.log("잘못된 경우 입니다.") | 88 | + wrong_count++; |
89 | + console.log(`잘못된 자세 : ${wrong_count}`) | ||
86 | } | 90 | } |
87 | status = "bent"; | 91 | status = "bent"; |
88 | } | 92 | } |
89 | - | 93 | + |
90 | for (let i = 0; i < maxPredictions; i++) { | 94 | for (let i = 0; i < maxPredictions; i++) { |
91 | const classPrediction = | 95 | const classPrediction = |
92 | prediction[i].className + ": " + prediction[i].probability.toFixed(2); | 96 | prediction[i].className + ": " + prediction[i].probability.toFixed(2); | ... | ... |
-
Please register or login to post a comment