10000 GitHub - jdeduq/ml2scratch: 機械学習 x スクラッチ(Connect Machine Learning with Scratch)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jdeduq/ml2scratch

 
 

Repository files navigation

ML2Scratch(Scratch2ML)

ML2Scratchは機械学習(TensorFlow.js)をScratchとをつなげます。

他の言語で読む: English, 日本語, 简体中文.

ML2Scratch ホームページ

Demo Movie(デモ動画)

Licence(ライセンス)

  • ML2Scratchには Apache 2.0 License が適用されます。オープンソースで、誰でも自由に利用できます。授業やワークショップで使用でき、商用利用も認められています。あなたやあなたの生徒さんがML2Scratchを使用して何か面白いプロジェクトを作成したときは、ぜひハッシュタグ #ml2scratch を使用してSNSで共有するか、連絡先までお知らせください。以下の「活用例」に追加させていただきます。

Contacts(連絡先)

  • Twitter

  • WeChat

Examples of use(活用例)

Requirements(推奨環境)

  • OS
    • Windows 8
    • Windows 10
    • MacOS
  • ブラウザ
    • Chrome

How to use(使い方)

Setup(準備)

  1. https://champierre.github.io/scratch3/ をChromeで開きます。

  2. 「拡張機能を選ぶ」画面を開き、「ML2Scratch」を選びます。

  3. Chromeがカメラの使用の許可を求めるダイアログが表示されるので、「許可」をクリックします。

  4. 「 84C0 ラベル」、「ラベル1の枚数」、「ラベル2の枚数」、「ラベル3の枚数」の横のチェックボックスにチェックを入れます。

Training(学習)

  1. ジャンケンの「グー」のサインをカメラに映し、「ラベル1を学習する」ブロックをクリックします。この操作で、「グー」をラベル1として機械に学習させます。

  2. 撮った写真の枚数が20枚になるまで「ラベル1を学習する」ブロックをクリックし続けます。撮った写真の枚数はステージ上の「ラベル1の枚数」に表示されています。

  3. 次に「パー」をカメラに映し、同様に「ラベル2の枚数」が20になるまで、「ラベル2を学習する」ブロックをクリックし続けます。

  4. 「チョキ」をカメラに映し、「ラベル3の枚数」が20になるまで、「ラベル3を学習する」ブロックをクリックし続けます。

Recognition(認識)

  1. 学習を終えると、認識結果が常にステージ上の「ラベル」に表示されるようになります。「グー」を見せれば「1」に、「パー」を見せれば「2」に、「チョキ」を見せれば「3」と表示されます。

  2. 「ラベル◯◯を受け取ったとき」ブロックを使って、以下のようなサンプルプログラムを作ることができます。

For Developers - How to add ML2Scratch extension to your (customized) Scratch

  1. Prepare LLK/scratch-gui on your local machine.

    % git clone git@github.com:LLK/scratch-gui.git
    % cd scratch-gui
    % npm install
    
  2. Copy this repos' scratch-vm/src/extensions/scratch3_ml2scratch folder to scratch-gui/node_modules/scratch-vm/src/extensions/.

  3. Download https://unpkg.com/ml5@0.3.1/dist/ml5.min.js and move the file(ml5.min.js) to scratch-gui/node_modules/scratch-vm/src/extensions/.

  4. Edit scratch-gui/node_modules/scratch-vm/src/extension-support/extension-manager.js, add "ml2scratch" entry to builtinExtensions constant as follows:

    const builtinExtensions = {
        // This is an example that isn't loaded with the other core blocks,
        // but serves as a reference for loading core blocks as extensions.
        coreExample: () => require('../blocks/scratch3_core_example'),
        // These are the non-core built-in extensions.
        pen: () => require('../extensions/scratch3_pen'),
        wedo2: () => require('../extensions/scratch3_wedo2'),
        music: () => require('../extensions/scratch3_music'),
        microbit: () => require('../extensions/scratch3_microbit'),
        text2speech: () => require('../extensions/scratch3_text2speech'),
        translate: () => require('../extensions/scratch3_translate'),
        videoSensing: () => require('../extensions/scratch3_video_sensing'),
        ev3: () => require('../extensions/scratch3_ev3'),
        makeymakey: () => require('../extensions/scratch3_makeymakey'),
        boost: () => require('../extensions/scratch3_boost'),
        gdxfor: () => require('../extensions/scratch3_gdx_for'), // <= add comma
        ml2scratch: () => require('../extensions/scratch3_ml2scratch') // <= add this line
    };
    
  5. Edit scratch-gui/src/lib/libraries/extensions/index.jsx, add the following lines at the end of the file.

            ),
            helpLink: 'https://scratch.mit.edu/vernier'
        }, // <= add comma
        {                              // <= add this
            name: 'ML2Scratch',        // <= add this
            extensionId: 'ml2scratch'  // <= add this
        }
    ];
    
  6. Run Scratch, then go to http://localhost:8601/.

    % npm start
    

Tシャツ

ML2Scratchのロゴ入りTシャツ、こちらで販売しています -> https://suzuri.jp/is8r_/1251743/t-shirt/s/white

Reference(参考)

About

機械学習 x スクラッチ(Connect Machine Learning with Scratch)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 58.1%
  • CSS 41.3%
  • Other 0.6%
0