洪愷尹
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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 No publishing access yet

        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.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    #### SDC Assignment 6 - 2022/11/24 ## 12/8更新 上傳結報即可! # Motion Prediction <!-- TABLE OF CONTENTS --> <details> <summary>Table of Contents</summary> <ol> <li>About Trajectory Prediction</li> <li>Getting Started</li> <li>Part 1 : 熟悉Motion Dataset</li> <li>Part 2 : 實做Motion Prediction Model </li> <li>Part 3 Bonus: 驗證在光復路的Data上</li> <li>Part 4: Report </li> <li>FAQ</li> </ol> </details> <!-- ABOUT THE PROJECT --> ## About Motion Prediction 前言 > 先前的作業與競賽中, 大家對Prediction這個名詞應該不陌生,Kalman Filter裡的Predict Step可以用來預測本車下一個時刻的位姿,協同量測讓估姿態更加準確。但自駕車除了估測本車的位姿以外,估測身旁移動物體的位姿對於自駕車的控制與安全性也是及其重要的。估測周遭物體過去的姿態,我們稱為追蹤; 預估周遭移動物未來一段的路徑,我們稱為路徑預測,這兩項主題將會是接下來作業以及競賽的主軸。 路徑預測 > 預測存在多種可能性以及不確定性,單單設下幾個簡單的判斷是不足已處裡複雜的交通場景,但我們能透過蒐集大量資料進行分析以及學習,讓預測這件事得以掌握。 本次Assignment目標 * 熟悉Motion Dataset -> 將待預測物的歷史軌跡以及道路線透過Matplotlib視覺化。 * 實做Motion Prediction Model -> 觀測過去五秒的歷史,並預測未來六秒的軌跡。 * (Bonus) 驗證在光復路的Data上 <!-- GETTING STARTED --> ## Getting Started _Programming Language : Python, Pytorch_ 1. Download [motion-prediction repository](https://drive.google.com/file/d/1DRNjpKYVWDznyNZYhU271EOvaMzSY7OO/view?usp=share_link) 2. Enter **Container** (change `~/motion_prediction` to wherever you put the `motion_prediction folder`) ```bash= xhost +local: docker run \ -it \ --env="DISPLAY" \ --env="QT_X11_NO_MITSHM=1" \ --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ --rm \ --name prediction \ --user root \ -e GRANT_SUDO=yes \ -v ~/motion_prediction:/root/motion_prediction \ softmac/sdc-course-docker:prediction \ bash ``` <!-- Dataset --> ## Dataset [1] Argoverse 2 Dataset Validation Set provides 25K scenarios. The trajectories of agents are sampled at 10Hz, with (0, 5] seconds used as observation and (6, 11] seconds for prediction. Each scenario carries its local map region. [more details](https://www.argoverse.org/av2.html) - [Download Argoverse 2 Dataset - Validation](https://drive.google.com/file/d/1MkTVnHw8Xt9h3sTtjjOedSQl5cFt4awY/view?usp=share_link) - 額外延伸可參考 [Argoverse 2 API](https://github.com/argoai/av2-api) [2] Bonus Part 光復路的資料: - [Download kung-fu-motion-dataset](https://drive.google.com/file/d/1zPj2_MnP62KJTHCKhwckFGSWrq4eWfsg/view?usp=share_link) 兩個都需要先下載好! ``` motion_prediction/ ├── data/ ├── argo-motion-dataset/ └── kung-fu-motion-dataset/ ├── models/ ├── weights/ ├── config.yaml ├── ... └── utils.py ``` <!-- Part 1 --> ## Part 1 - 熟悉Motion Dataset _透過Matplotlib視覺化_ - [ ] 歷史軌跡 - [ ] 未來軌跡 - [ ] 道路中線 - [ ] (Bonus) 道路邊線, 斑馬線 ... - [ ] (Bonus) 周遭物體的軌跡 in ```dataset.py``` -> 完成 ```plt.plot(...)``` ``` py def plot_scenario(sample): ax = fig.add_subplot(111) ax.set_facecolor('#2b2b2b') ''' History Trajectory ''' x = sample['x'].reshape(_OBS_STEPS, 6) #plt.plot(...) ''' Future Trajectory ''' y = sample['y'].reshape(_PRED_STEPS, 5) #plt.plot(...) ''' Lane Centerline ''' lane = sample['lane_graph'].reshape(-1, 10, 2) #plt.plot(...) plt.axis('equal') plt.xlim((-30, 30)) plt.ylim((-30, 30)) plt.show() check_interrupt() ``` ``` bash python dataset.py ``` ![Example](https://i.imgur.com/XbrniPC.png) <!-- Part 2 --> ## Part 2 - 實做Motion Prediction Model 同學可以自行設計模型, 簡易的等速、等加速模型都可以。 唯一要求**觀測5秒**利用Model預測出**未來6秒**的軌跡。 in ```model/baseline.py``` -> 若參考Baseline,尚須完成comment掉的部份。 ``` py class Baseline(pl.LightningModule): def __init__(self): super(Baseline, self).__init__() ''' [1] history state (x, y, vx, vy, yaw, object_type) * 5s * 10Hz ''' #self.history_encoder = MLP(..., 128, 128) self.lane_encoder = MapNet(2, 128, 128, 10) self.lane_attn = MultiheadAttention(128, 8) trajs = [] confs = [] ''' we predict 6 different future trajectories to handle different possible cases.''' for i in range(6): ''' [2] future state (x, y, vx, vy, yaw) * 6s * 10Hz ''' trajs.append( # MLP(128, 256, ...) ) ''' we use model to predict the confidence score of prediction ''' confs.append( nn.Sequential( MLP(128, 64, 1), nn.Sigmoid() ) ) self.future_decoder_traj = nn.ModuleList(trajs) self.future_decoder_conf = nn.ModuleList(confs) def forward(self, data): ''' [3] In deep learning, data['x'] means input, data['y'] means groundtruth ''' #x = data['x'].reshape(-1, ...) x = self.history_encoder(x) lane = data['lane_graph'] lane = self.lane_encoder(lane) x = x.unsqueeze(0) lane = lane.unsqueeze(0) lane_mask = data['lane_mask'] lane_attn_out = self.lane_attn(x, lane, lane, attn_mask=lane_mask) x = x + lane_attn_out x = x.squeeze(0) trajs = [] confs = [] for i in range(6): trajs.append(self.future_decoder_traj[i](x)) confs.append(self.future_decoder_conf[i](x)) trajs = torch.stack(trajs, 1) confs = torch.stack(confs, 1) return trajs, confs ``` - [ ] (Bonus) 考量周遭動態物體,可使用助教已經Preprocess完的資料 in ```dataset.py - sample['neighbor_graph']```。 **Training** - in``` config.yaml``` 可以調整 ```max_epochs``` - 至少50 epochs以上效果才會比較好 ``` bash python train.py --train ``` (optional) 中斷後若要接續上個checkpoint train ``` bash python train.py --train --ckpt epoch=01-train_loss=10.96.ckpt ``` **Inference and Visualize Argo** ``` bash python train.py --viz --argo --ckpt epoch=01-train_loss=10.96.ckpt ``` <!-- Bonus --> ## Part 3 Bonus: 驗證在光復路的Data上 光復路101條軌跡中,包含直線,轉彎,換車道,減速停止等等場景... **Inference and Visualize Kung Fu Road** ``` bash python train.py --viz --kungfu --ckpt epoch=01-train_loss=10.96.ckpt ``` <!-- Part 4 --> ## Part 4 - Report - Part 1 30% - [x] dataset 視覺化的截圖 - [x] (Bonus +2% per attribute) 視覺化 道路邊線, 斑馬線... - [x] (Bonus +5%) 視覺化 周遭物體的軌跡 - Part 2 70% + bonus - [ ] Argo 軌跡預測的截圖 - [ ] 描述Model的設計方法 - [ ] Case Study - 哪些場景成功? - 哪些場景失敗?可能的成因是?若有方法可以解,你嘗試了哪些方法? - [ ] (Bonus +10%) 考量周遭動態物體 - (Bonus Part +10%) - [ ] Kung Fu 成功預測轉彎以及減速的截圖 - [ ] Case Study : - 哪些場景成功? - 觀察Cross Dataset的效果,哪些場景失敗?可能的成因是?若有方法可以解,你嘗試了哪些方法? ### *Deadline : 2022/12/8 !!!* ## FAQ 1. What is Pytorch Lightning? - PyTorch Lightning 為 PyTorch 提供了更友善的界面。 - [更多參考](https://www.pytorchlightning.ai/) 2. Argo Motion Dataset - 為了讓同學熟悉Motion Dataset,本次只使用官方 Argoverse 2 motion dataset validation set 當作本次作業的training set, 若同學想使用完整 [Argoverse 2 motion dataset training set](https://s3.amazonaws.com/argoai-argoverse/av2/tars/motion-forecasting/train.tar)可自行下載。 3. Prediction Model 額外補充 - [LaneGCN](https://arxiv.org/pdf/2007.13732.pdf) - [VectorNet](https://arxiv.org/pdf/2005.04259.pdf) 4. Motion Prediction 常見的Metric - Average Displacement Error (ADE) 平均的距離誤差。 - Final Displacemnet Error (FDE) 末端點的距離誤差。 - minADE ex: 預測6條軌跡,取ADE最小的那個。 - minFDE ex: 預測6條軌跡,取FDE最小的那個。 - [更多參考](https://eval.ai/web/challenges/challenge-page/1719/evaluation)

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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