수업소개
남이 만든 모델을 이용하는 방법을 소개합니다.
강의
소스코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <!DOCTYPE html> < html > < body > <!-- Load TensorFlow.js. This is required to use MobileNet. --> <!-- Load the MobileNet model. --> <!-- Replace this with your image. Make sure CORS settings allow reading the image! --> < img id = "img" src = "dog.jpeg" ></ img > <!-- Place your code in the script tag below. You can also use an external .js file --> < script > // Notice there is no 'import' statement. 'mobilenet' and 'tf' is // available on the index-page because of the script tag above. const img = document.getElementById('img'); // Load the model. mobilenet.load().then(model => { // Classify the image. model.classify(img).then(predictions => { console.log('Predictions: '); console.log(predictions); }); }); </ script > </ body > </ html > |