GOTOH Shunsuke
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: ブログ記事, 研究会 slideOptions: transition: slide theme: white --- Deep Learning: Exploring High Level APIs of Knet.jl and Flux.jl in comparison to Tensorflow-Keras === <!-- .element: style="font-size:100%" --> 2019/06/20 Al-Ahmadgaid B. Asaad <!-- .element: style="font-size:80%" --> [Blog Post](https://estadistika.github.io//julia/python/packages/knet/flux/tensorflow/machine-learning/deep-learning/2019/06/20/Deep-Learning-Exploring-High-Level-APIs-of-Knet.jl-and-Flux.jl-in-comparison-to-Tensorflow-Keras.html) (まとめ:[@antimon2](https://github.com/antimon2)) --- ## どんなもの? + 数値計算に傾倒している [Julia](https://julialang.org) の DeepLearning ライブラリを調査し、TF-Keras と比較してみた ---- + 結論: + Julia は十分に投資する価値がある + Julia は `for` ループ速い + Knet.jl は Julia + littleelse(ナットとボルト) + Flux.jl は入門・移行向けであり柔軟性を兼備 --- ## どうやって有効だと検証した? + [Flux.jl](https://github.com/FluxML/Flux.jl), [Knet.jl](https://github.com/denizyuret/Knet.jl) と TF-Keras で使用方法・学習速度・学習曲線を比較 + データセットは [Iris](https://en.wikipedia.org/wiki/Iris_flower_data_set) を使用 + その他、Python と Julia で同条件となるようコーディング --- ## 技術や手法の肝は? ---- ### データセットの準備 + TF-Keras: 教師トラベルのデータを 訓練用 と 検証用 に分ければ準備終わり + ミニバッチ分割・データ流し込みは自動 + Knet.jl: (分割した)データから `minibatch` オブジェクトを生成し訓練に利用 + Flux.jl: ラベルデータに one-hot エンコーディングが必要 + バッチ生成等は独自実装できる柔軟性を残している ---- ### モデル構築 + 3層MLP + TF-Keras, Knet.jl, Flux.jl ともに実装方法については大差はなし + 内部実装 + TF-Keras: 53% は C++実装 + Knet.jl/Flux.jl: いずれも 100% Julia ---- ### 訓練 + TF-Keras: `model.compile()` → `model.fit()` + `.fit()` で訓練データ・検証データ・バッチサイズ・エポック数を指定 + Knet.jl: `adam!(model, repeat(dtrn, 100))` + 検証を含むには `for x in adam(model, repeat(dtrn, 100)) ~` のようにしてループ内で処理 + Flux.jl: `Flux.@epochs 100 Flux.train!(loss, Flux.params(model), minibatches, Flux.ADAM(), cb=callback)` + `callback` に無引数関数を指定、検証やログ出力はその中で実行(もしくは `for` ループにしてその中で) <!-- .element: style="font-size:80%" --> ---- ![Loss比較](https://i.imgur.com/a55jxh6.png) ---- ### 評価 + 詳細略 ---- ![Accuracy比較](https://i.imgur.com/889wASU.png) ---- ### ベンチマーク + 詳細略 ---- ![ベンチマーク](https://i.imgur.com/1EEdtbt.png) --- ## 議論はある? + コードが全体的に不公平 + TFは内部で毎エポックシャッフルが走る(はず)だが、Julia側のコードは単純なデータ分割+シャッフル最初の1回だけの模様 + よく見るとそれぞれでバッチサイズ合ってない、1エポック辺りの事例数も合ってない + 100エポックとは言え Iris データセット(事例数合計150、入力4次元出力3次元)なので性能検査するには小さすぎる + ⇒Julia側の各結果は「バッチ(再)生成時間が含まれていないために速かった」「データが偏っていたためにたまたま精度が良かった」可能性が高い <!-- .element: style="font-size:75%" --> ---- ### 独自再検証 + (別件のデモのために)[Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) で(主に速度を)再検証 + 速度重視、精度軽視(バッチ生成手抜き、バッチサイズと1エポック辺りの事例数は同等になるよう処理) + 結果 → [Knet.jl](https://nbviewer.jupyter.org/gist/antimon2/2939e75f2620112ac0525c677beab41c/FashionMNIST_Knet_Sample.jl.ipynb) / [Flux.jl](https://nbviewer.jupyter.org/gist/antimon2/2939e75f2620112ac0525c677beab41c/FashionMNIST_Flux_Sample.jl.ipynb) / [TF-Keras](https://nbviewer.jupyter.org/gist/antimon2/2939e75f2620112ac0525c677beab41c/FashionMNIST_TfKeras_Sample.py.ipynb) ---- + CNN(Conv層)を含めた学習は TF-Keras が圧倒的に速い + GPU不使用、CPU上の Conv の実装の問題かもしれない --- ## 先行研究と比べて何がすごい? + 《特になし》 --- ## 次に読むべき ~~論文~~ 記事は? + 「GPUを利用したモデル訓練に今後取り組みたい」と言っているので、その記事が上がったらそれ。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully