Page 298 - MDP2022-2
P. 298

prediction[i].probability.toFixed(2);
                                labelContainer.childNodes[i].innerHTML  =  classPrediction;
                        }
                          }


                          let  job_state,  pro_state,  eng_state,  math_state;


                          async  function  predict()  {
                                  const  prediction  =  await  model.predict(webcam.canvas);
                        var  max_probability  =  0,  max_label  =  "";
                        var  now_probability  =  0,  list_probability  =  "";
                                  for  (let  i  =  0;  i  <  maxPredictions;  i++)  {
                              now_probability  =  prediction[i].probability.toFixed(2);
                              if  (max_probability  <  now_probability  &&  now_probability  >  0.95)  {
                                    max_probability  =  now_probability;
                                    max_label  =  prediction[i].className;
                              }

                              list_probability   +=   prediction[i].className    +      ":     "      +
                  prediction[i].probability.toFixed(2)  +  "<br>";
                        }

                        labelContainer.innerHTML  =  list_probability  +  "<p>Max  :  "  +  max_label;
                        list_probability  =  "";

                        //1  :  대출
                        //0  :  반납


                        connect("job");
                        connect("math");
                        connect("english");
                        connect("programming");

                        if(max_label  ==  "성공적인  직업생활")  {
                              if(job_state  ==  0)  {
                                    park_job(0);
                                    run(1);
                                    alert('성공적인  직업생활을  대출합니다');
                              }
                              else  if(job_state  ==  1)  {
                                    park_job(1);
   293   294   295   296   297   298   299   300   301   302   303