이재호

Merge branch 'model' into 'master'

Model

update seconde model. training with scraped web picture

See merge request !5
...@@ -164,43 +164,40 @@ ...@@ -164,43 +164,40 @@
164 <script src="https://cdn.jsdelivr.net/npm/@teachablemachine/image@0.8/dist/teachablemachine-image.min.js"></script> 164 <script src="https://cdn.jsdelivr.net/npm/@teachablemachine/image@0.8/dist/teachablemachine-image.min.js"></script>
165 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 165 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
166 <script type="text/javascript"> 166 <script type="text/javascript">
167 - // More API functions here: 167 + // More API functions here:
168 - // https://github.com/googlecreativelab/teachablemachine-community/tree/master/libraries/image 168 + // https://github.com/googlecreativelab/teachablemachine-community/tree/master/libraries/image
169 169
170 - // the link to your model provided by Teachable Machine export panel 170 + // the link to your model provided by Teachable Machine export panel
171 - const URL = "https://teachablemachine.withgoogle.com/models/ujJHV9bKh/"; 171 + const URL = "https://teachablemachine.withgoogle.com/models/ujJHV9bKh/";
172 -
173 - let model, webcam, labelContainer, maxPredictions;
174 172
175 - //predic이전 값을 기억해주는 전역변수. -999로 초기화. 173 + let model, webcam, labelContainer, maxPredictions;
176 - var last_result_predict=-999;
177 174
178 - // Load the image model and setup the webcam 175 + // Load the image model and setup the webcam
179 - window.onload = async function init() { 176 + async function init() {
180 - const modelURL = URL + "model.json"; 177 + const modelURL = URL + "model.json";
181 - const metadataURL = URL + "metadata.json"; 178 + const metadataURL = URL + "metadata.json";
182 179
183 - // load the model and metadata 180 + // load the model and metadata
184 - // Refer to tmImage.loadFromFiles() in the API to support files from a file picker 181 + // Refer to tmImage.loadFromFiles() in the API to support files from a file picker
185 - // or files from your local hard drive 182 + // or files from your local hard drive
186 - // Note: the pose library adds "tmImage" object to your window (window.tmImage) 183 + // Note: the pose library adds "tmImage" object to your window (window.tmImage)
187 - model = await tmImage.load(modelURL, metadataURL); 184 + model = await tmImage.load(modelURL, metadataURL);
188 - maxPredictions = model.getTotalClasses(); 185 + maxPredictions = model.getTotalClasses();
189 186
190 - // Convenience function to setup a webcam 187 + // Convenience function to setup a webcam
191 - const flip = true; // whether to flip the webcam 188 + const flip = true; // whether to flip the webcam
192 - webcam = new tmImage.Webcam(550, 550, flip); // width, height, flip 189 + webcam = new tmImage.Webcam(200, 200, flip); // width, height, flip
193 - await webcam.setup(); // request access to the webcam 190 + await webcam.setup(); // request access to the webcam
194 - await webcam.play(); 191 + await webcam.play();
195 - window.requestAnimationFrame(loop); 192 + window.requestAnimationFrame(loop);
196 193
197 - // append elements to the DOM 194 + // append elements to the DOM
198 - document.getElementById("webcam-container").appendChild(webcam.canvas); 195 + document.getElementById("webcam-container").appendChild(webcam.canvas);
199 - labelContainer = document.getElementById("label-container"); 196 + labelContainer = document.getElementById("label-container");
200 - for (let i = 0; i < maxPredictions; i++) { // and class labels 197 + for (let i = 0; i < maxPredictions; i++) { // and class labels
201 - labelContainer.appendChild(document.createElement("div")); 198 + labelContainer.appendChild(document.createElement("div"));
199 + }
202 } 200 }
203 - }
204 201
205 async function loop() { 202 async function loop() {
206 webcam.update(); // update the webcam frame 203 webcam.update(); // update the webcam frame
......