다음과 같이 티쳐블머신을 사용하고 label의 내용을 달리 하고 싶다고요?????
그렇다면 코드 수정이 답입니다
늘 그랬듯 ^^
async function predict() {
// Prediction #1: run input through posenet
// estimatePose can take in an image, video or canvas html element
const { pose, posenetOutput } = await model.estimatePose(webcam.canvas);
// Prediction 2: run input through teachable machine classification model
const prediction = await model.predict(posenetOutput);
for (let i = 0; i < maxPredictions; i++) {
const classPrediction =
prediction[i].className + ": " + prediction[i].probability.toFixed(2);
if(prediction[0].probability.toFixed(2)==1.00){
labelContainer.childNodes[0].innerHTML = "바른 자세입니다. 지금 자세를 유지하세요.";
}
else if(prediction[1].probability.toFixed(2)==1.00){
labelContainer.childNodes[0].innerHTML = "얼굴이 오른쪽으로 기울었습니다. 바른 자세를 유지하세요.";
//alert('바른자세를 유지하세여');
}
else if(prediction[2].probability.toFixed(2)==1.00){
labelContainer.childNodes[0].innerHTML = "얼굴이 왼쪽으로 기울었습니다. 바른 자세를 유지하세요.";
}
else if(prediction[3].probability.toFixed(2)==1.00){
labelContainer.childNodes[0].innerHTML = "거북목 자세입니다. 바른 자세를 유지하세요.";
}
else if(prediction[4].probability.toFixed(2)==1.00){
labelContainer.childNodes[0].innerHTML = "오른쪽 어깨가 올라갔습니다. 바른 자세를 유지하세요.";
}
else if(prediction[5].probability.toFixed(2)==1.00){
labelContainer.childNodes[0].innerHTML = "왼쪽 어깨가 올라갔습니다. 바른 자세를 유지하세요.";
}
}
// finally draw the poses
drawPose(pose);
}