ブログスポットの中でのMobileNet利用
Using MobileNet inside BlogSpot
Googleが運営する無料ブログサービスであるブログスポット(このサイト)に、カメラに映った映像を分類するMobileNetという実験プログラムを組み込んでみた。既に学習済みのネットを利用するだけで、学習は行わない。映し出された窓にはカメラの映像が、その下に画像判定結果とその可能性(0から1の範囲)が示される。ライオンやシマウマなど簡単なもので試してください。動作しない場合、ハードウエアアクセラレーションをOFFにしてみてください。計算負荷が大きいため処理が遅くなります。実行したくない人はカメラアクセス要求を拒否してください。
Installed MobileNet on this site, blogspot, i.e., Google's free blog service. This only classifies object based on pre-educated neural net but no new learning is done. Under the camera video shown, object name and possibilities(0-1) are shown. Pls try out for simple objects such as lion or zebra. If does not work, pls try turning off hardware acceleration. Due to heavy computation, reactions will be slow. Pls deny camera access request if you do not wish to run.
なお、BlogSpotの記事の場所に結果を表示するには、下のようにparentメソッドを利用します。ソース全体(GitHub)はこちら。 To display the result on blog body, use parent method as below. Complete Source is here(GitHub).
Installed MobileNet on this site, blogspot, i.e., Google's free blog service. This only classifies object based on pre-educated neural net but no new learning is done. Under the camera video shown, object name and possibilities(0-1) are shown. Pls try out for simple objects such as lion or zebra. If does not work, pls try turning off hardware acceleration. Due to heavy computation, reactions will be slow. Pls deny camera access request if you do not wish to run.
なお、BlogSpotの記事の場所に結果を表示するには、下のようにparentメソッドを利用します。ソース全体(GitHub)はこちら。 To display the result on blog body, use parent method as below. Complete Source is here(GitHub).
body
div id='myContainer'/div
body
--- Skipped so pls see GitHub for complete source --
script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js" /script>
function setup() {
// Create a camera input
video = createCapture(VIDEO);
video.parent('myContainer')
video.size(200,300)
// Initialize the Image Classifier method with MobileNet and the video as the second argument
classifier = ml5.imageClassifier('MobileNet', video, modelReady);
resultsP = createP('Loading model and video...');
resultsP.parent('myContainer')
}
--- Skipped so pls see GitHub for complete source --
// When we get a result
function gotResult(err, results) {
// The results are in an array ordered by confidence.
resultsP.html(results[0].label + ' ' + nf(results[0].confidence, 0, 2));
resultsP.parent('myContainer')
classifyVideo();
}
/script
..Code shown from simple Cut and Pasted from Visual Studio Code
(pls delete, "white-space: pre;" after cut and paste. also pls correct for bracket for script and body since brackets are deleted to make output looks nicer :)
(pls delete, "white-space: pre;" after cut and paste. also pls correct for bracket for script and body since brackets are deleted to make output looks nicer :)