ラベル

AI Forecast 8306MUFG (214) Social (75) life (70) Financial (62) IT (57) Proposal (56) idea (50) Fund Management (48) Trading (43) economics (42) Covid-19 (40) AI (38) Hedge Fund (36) Risk (36) Culture (31) BOJ (29) Science (26) hobby (24) accounting (17) Apps (16) career (11) job (7) Travel (6) Hiking (5) emotion (5) music (3) Statarb (2) piano (2)

2019年10月5日土曜日

ブログスポットの中でのMobileNet利用 Using MobileNet inside BlogSpot

ブログスポットの中での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).

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'videomodelReady);
    resultsP = createP('Loading model and video...');
    resultsP.parent('myContainer')
  }

                --- Skipped so pls see GitHub for complete source --

  // When we get a result
  function gotResult(errresults) {
    // The results are in an array ordered by confidence.
    resultsP.html(results[0].label + ' ' + nf(results[0].confidence02));
    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 :)