공태현

Count sqaurt good case and wrong case

......@@ -54,6 +54,10 @@
await predict();
window.requestAnimationFrame(loop);
}
// 상태
let status = "stand" ;
// 갯수 count
let count = 0;
async function predict() {
// Prediction #1: run input through posenet
......@@ -62,6 +66,27 @@
// Prediction 2: run input through teachable machine classification model
const prediction = await model.predict(posenetOutput);
if (prediction[0].probability.toFixed(2) > 0.9) // 서있는 상태
{
if (status == "squart")
{
count++;
}
status = "stand";
}
else if (prediction[1].probability.toFixed(2) == 1.00) // 스쿼트 자세
{
status = "squart";
}
else if (prediction[2].probability.toFixed(2) == 1.00) // 굽은 자세(잘못된 케이스)
{
if (status == "squart" || status == "stand") // 굽은 자세로 잘못 수행하면,
{
console.log("잘못된 경우 입니다.")
}
status = "bent";
}
for (let i = 0; i < maxPredictions; i++) {
const classPrediction =
prediction[i].className + ": " + prediction[i].probability.toFixed(2);
......