Triệu Huy
    • 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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: COTAI LHP --- # Lecture Notes DL4AI 2021 ## Session 1 -- DCNNs #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1R9ClYcSS05RZwRo-5tQLb2wRQ859bZuc) * [Assignment](https://colab.research.google.com/drive/1GbFG4bdmUXL9jEa4lF3Lrt9ICBsXC---?usp=sharing) [Slides](https://hackmd.io/@CoTAI/DL4AI-02-2022-S1#/16) ### Note: * weight-sharing in space: dùng 1 filter với những trọng số không đổi để dùng cho tất cả các điểm input * weight-sharing in time: nếu trải RNN ra thành nhiều NLP thì weight RNN ở từng time step là như nhau ### AlexNet (2012) * **Structure**: ![](https://i.imgur.com/4VlqIQq.png) ![](https://i.imgur.com/GDniFLY.png) * 5 layers of {convolution + [ReLU](https://paperswithcode.com/method/relu) + [max-pooling](https://paperswithcode.com/method/max-pooling)} $\rightarrow$ 3 fully connected (dense) layers $\rightarrow$ softmax ### Grouped Convolution * [Khái niệm](https://paperswithcode.com/method/grouped-convolution) ![](https://i.imgur.com/VCLrB9R.png) ### Local Response Normalization (LRN) * Tư tưởng: sau mỗi filter thì sẽ normalization trên từng pixel để tránh giá trị quá lớn của filter trước khi đưa vào hàm activation (ở bài này là ReLU) ### VGG Net (2014) * Tất cả các lớp CNN trong VGG đều có kích thước 3x3 filter thay vì 5x5 filter $\rightarrow$ hiệu suất không đổi nhưng số params và flops của mạng noron ít hơn * Mặc dù kiến trúc này có nhiều params nhưng uniformity của các params lại khá tốt * Điểm yếu: kiến trúc này yêu cầu GPU mạnh hơn yêu cầu của AlexNet rất nhiều $\rightarrow$ làm tăng chi phí, tổng thể params nhiều hơn AlexNet ### Dilated (atrous) convolution (Tích chập giãn nở) * Đây là cách để làm tăng receptive field và giảm bớt sự tính toán * Integrating thông tin từ những không gian khác nhau và cân bằng 2 properties * local, pixel-level fine details, such as precise detection of edges, vs. * integrating knowledge of the wider, global context * E.g.: [Google's WaveNet](https://paperswithcode.com/method/wavenet) ### GoogLeNet (Inception v1) * (1) Aggressively down-sampling input: sử dụng inexpensive 1x1 convolution + ReLU for dim reductions * (2) Sử dụng global average pooling: trung bình cộng tất cả các feature map **$\rightarrow$ Làm giảm đáng kể params còn 5 triệu, ít hơn 27 lần so với VGG-16** * (3) Sử dụng Inception modules * (4) Sử dụng [Auxiliary Classifier](https://paperswithcode.com/method/auxiliary-classifier), LRN và dropout ### 1x1 Convolution ### Auxiliary losses * Thay vì chờ tới output cuối, ta lấy output presentation để tính loss ở giữa * Giúp cải thiện việc dự đoán những bài toán phụ ### Global average pooling * Có feature map, mỗi map avg lại ra 1 con số * Thay vì Fully connected layers, thì ta sử dụng GAP rồi đưa ra prediction (đỡ tốn tham số) ### Ý tưởng giúp mô hình sâu hơn với hàng nghìn layers * Skip connections: lấy input + output: $y = H(x) + x$ ### Resnet * Mặc dù có rất nhiều layers những complexity giảm đi so với VGG ### Separable convolutions * Depthwise convolution: mỗi filter -> 1 channel -> 1 feature-map ## Session 2 -- Object detection (using YOLOv5) #### Colab Notebook * [Lab](https://colab.research.google.com/drive/13zEEvnORErMONWxsN_wsowxRmVnLRScn?usp=sharing) * [Assignment](https://colab.research.google.com/drive/1fc8GEz1S2MAyj8IXcYjH7J8HCoHHzAAY?usp=sharing) #### Nội Dung * Chuẩn đánh giá IoU ![](https://i.imgur.com/ebUo1Qc.png) ##### Non-Max Suppression * Hiện tượng 1 output có rất nhiều bounding box cho object, gây nên sự dư thừa vì ta chỉ cần 1 bounding box cho 1 object * Non-Max Suppression sinh ra để giải quyết vấn đề này * [Link tham khảo](https://viblo.asia/p/tim-hieu-va-trien-khai-thuat-toan-non-maximum-suppression-bJzKmr66Z9N#_=_) ## Session 3 -- Deep Language Models #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1ztkCVxTjj1I49uyee2jRQrNGwZAU47yz?usp=sharing) * [Assignment](https://colab.research.google.com/drive/1f3_NaBBRS3APlnRbZLTNkjNhEfGSfF0I?usp=sharing) #### Nội dung * Word embedding: chỉ dự đoán các từ xung quanh (không quan tâm tới chuỗi câu) * Generate dựa vào xác suất * Language Model là khi nhìn vào chuỗi các từ có thể đoán được từ tiếp theo (dựa vào xác suất) -> luôn cho softmax prediction của dictionary (100 từ sẽ cho 100 xác suất) -> phụ thuộc vào cả câu * Evaluate language model: tính tổng tất cả xác suất đầu ra so với từ thực tế so với câu training #### n-gram * Xấp xỉ xác suất của 1 câu dài bằng n từ * Nếu có câu mới có các cặp chưa bao giờ xuất hiện trong training dictionary thì xác suất bằng 0 -> Neural Language Model ## Session 4 -- Natural language understanding (NLU) #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1558If0fGW4xr2HcZoTU_fOy3sKLzX-aN) * [Assignment](https://colab.research.google.com/drive/182DXeQt2bkPuY4VkqPhyLwzgqQRoMj8d?usp=sharing) #### * loss = -log(p) * $\Sigma$ loss = loss của hàm ##### Attention mechanisms * Trong mô hình seq2seq với RNN, nếu như chuỗi dài sẽ bị vanishing gradient, khi này LSTM sẽ khắc phục nhược điểm đó nhưng việc sử dụng LSTM có những hạn chế sau: * Khó huấn luyện, thời gian huấn luyện lâu do gradient path rất dài (chuỗi 100 từ có gradient như là mạng 100 lớp) * Transfer learning không hoạt động với LSTM, điều đồng nghĩa với một bài toán mới thì ta cần huần luyện lại mô hình với bộ dữ liệu riêng biệt cho nhiệm vụ đề ra (tốn kém) * Trong mô hình seq2seq với RNN, encoder sẽ phải nén toàn bộ chuỗi đầu vào thành một vector duy nhất - việc này rất khó, khi mà chuỗi đủ dài và encoder buộc phải đưa toàn bộ thông tin vào 1 vector biểu diễn duy nhất này thì chắc chắn nó sẽ quên thông tin nào đó (bottleneck)! Ngoài ra, decoder chỉ nhìn thấy một vector biểu diễn đầu vào duy nhất, mặc dù tại mỗi time-step thì các phần khác nhau của chuỗi vào có thể có ích hơn các phần khác. Nhưng đối với mô hình hiện tại thì decoder sẽ phải trích các thông tin liên quan này từ một vector biểu diễn duy nhất - việc này cũng vô cùng khó. * Attention đã được ra đời với mục đích giải quyết vấn đề kể trên. Với cơ chế này, tại mỗi time-step khác nhau, mô hinh sẽ tập trung vào các phần khác nhau của đầu vào. Ý tưởng là sử dụng một vector bối cảnh có thể tương tác với toàn bộ vector trạng thái ẩn của encoder thay vì chỉ sử dụng vector trạng thái ẩn cuối cùng để tạo ra vector biểu diễn cho decoder * Sơ đồ biểu diễn với khối xanh là encoder và đỏ là decoder: ![](https://i.imgur.com/Kxz80kQ.jpg) #### Contextual embedding * Contextual embedding methods are used to learn sequence-level semantics by considering the sequence of all words in the documents. Thus, such techniques learn different representations for polysemous words, e.g. "**left**" in example "I **left** my phone on the **left** side of the table.", based on their context. #### Convex combination: tổ hợp lồi * Một điểm được gọi là convex combination (tổ hợp lồi) của các điểm $x_{1}, x_{2},..., x_{k}$ nếu nó có thể viết dưới dạng $x= \theta_{1}x_{1}+\theta_{2}x_{2}+...+\theta_{k}x_{k}$, với $\theta_{1}+\theta_{2}+...+\theta_{k}=1$ ## Session 5 -- Deep learning for audio #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1OquNFkHo-OxjIYX55YwrXDDYKjG6K7bK) * [Assignment](https://colab.research.google.com/drive/1K7rOkghvuhv7lV8DHx3fsBONdavMgv0n?usp=sharing) #### Nội dung * Phân tích tần số âm thanh -> phổ metrix: Word error rate (WER): đánh giá độ chính xác khi dự đoán * Accuracy = 100% - WER% * Phân tích 1 từ thành từng âm -> từng phổ -> Spectrogram -> tính xác suất của từng âm * Phương pháp khác: eliminating alignment problem * Tính xác suất của chuỗi đầu ra để chọn chuỗi nào có xác suất lớn nhất #### CTC 1 chuỗi âm được cắt ra sẽ được dự đoán thành chuỗi kí tự, người ta sự dụng các âm đệm để loại bỏ các từ bị lặp giữa các âm đệm #### CTC & Beam Search Tính xác suất từng chữ rồi chọn ra từng chữ có xác suất cao ## Session 7 -- Speech understanding #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1B5Q6150Rfiix99w2GeO9O1VhK3fRUMCt) ## Session 8 -- Deep reinforcement learning (DRL) #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1aXnL8yAerAZXYLQovT_Sd1m2Q39NfuSs) #### Review: MDP Input: state, action Output: xác suất lớn nhất Để biết plan tốt hay ko -> tổng Reward rồi chia trung bình (ra value fuction) để tìm hiệu xuất của hành động nào tốt nhất * Công thức bellman: tìm kiếm hàm Q tối ưu. Nhưng nếu không có R, P => phải học => Reinforcement Learning #### Reinforcement Learning * Regression: Input: Đặc trưng Z hoặc x Ouput: q Học 1 hàm theta -> $\hat{q}$ -> minimize loss mean-square error MQE Label là $q^*$ -> mà Reinforcement Learning tìm q nên không có q -> người ta nghĩ đến cách xấp xỉ q (lấy R, hoặc G, hoặc $\hat{q}$) Ta tính G -> tổng G -> lấy trung bình cộng ~ $q^*$ Gradient của hàm linear = const Fix $\theta$ lại để label ổn định ## Session 9 -- DRL for robotics & control #### Colab Notebook * [Lab](https://colab.research.google.com/drive/1jdvoQSU4qo2ODAGHwpQk0gktaW_ITRai#scrollTo=RbK-5XGLoWln) ## Session 10 -- Deep generative models #### Colab Notebook * [Lab](https://colab.research.google.com/drive/16CPSFj4uzioCrWzaLZWIjvA_zWbT_ct0) ### Autoencoders * Là mô hình có khả năng học mà input không cần label (Unsupervised Learning) * Cấu trúc: Input $X \rightarrow$ Encoder $\rightarrow Z \rightarrow$ Decoder $\rightarrow \hat{Y} \simeq X$ * Loss: MSE * Vd: PCA #### VAE Text, input -> Hình vẽ Coi xác suất là niềm tin Từ X, learn encoder -> Z Từ Z, hàm decoder, p -> X https://viblo.asia/p/tan-man-ve-generative-models-part-1-cac-mo-hinh-autoencoder-vaes-4P856rw35Y3 ## Session 11 -- Relational Reasoning #### Colab Notebook * [Lab](https://colab.research.google.com/drive/17SguGiETrHbyNOl2CGKfgL08qyjIMyVG) Input: non-space và query Output: câu trả lời #### Relational Network * Trả lời các câu hỏi về object, relation * Input là hình ảnh -> object detection -> pixel -> pair các pixel lại và pair với câu hỏi -> độ liên quan càng cao thì hằng số càng lớn #### Neural Symbolic VQA B1: Phân tích tấm hình đưa vào -> knowledge space B2: Phân tích câu hỏi -> chuỗi mệnh lệnh cần làm B3: Áp filter vào tấm hình Relational: các object liên quan nhau Non-relational: chỉ hỏi 1 object

    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