Ronny
    • 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
    --- layout: post comments: true title: Post Template author: Zhenghao Peng (Team 00) date: 2022-09-19 --- # Effects of Multi-agent Cooperation on Traffic Collision Avoidance ## Motivation In this project, we aim to study the effects of multi-agent and cooperation between multi-agent in avoiding real-world traffic collisions. While autonomous driving has become increasingly popular in the past decade, it also raised safety concerns about whether human and AI driven cars can safely share the road together without increasing number of collisions. In this project, we ask the following question: is it safer to fit agents into a human-dominant traffic environment, or to give agents full control of all traffic on road without human drivers involved? The former can be considered a *hybrid environment* where the agents learn policies that align with existing traffic rules. The latter, however, does not contain any human driver and hence places no constraints on the behaviors of the agents. One advantage of the multi-agent model is that it permits real-time communications among agents, which could potentially decreases the risk of accidents. In particular, we run a comparative study on the following three models: * **Single-agent Model (Baseline).** In a traffic environment, we randomly pick one driver from all drivers and make it a controllable agent. The agent needs to learn a policy such that it does not cause any collision with other human drivers. * **Hybrid Model.** We randomly pick half of the drivers to be controllable agents. In the case without cooperations, each agent delivers a policy based on its own state and observation. In the case with cooperations, the agents deliver policies that may depend on other agents' observations and actions. * **Agents-only Model.** All the drivers in the environment are controllable agents. Similar to the cases for Hybrid Model, the agents may or may not share information depending on whether cooperations are allowed. Different reward functions will be tuned to optimize the performance [Mataric]. We evaluate following metrics: * **Collision Avoidance/Task Completion:** Whether or not the agents can avoid collisions while reaching the expected final location within the timeframe for each episode. * **Training Resource:** Time/memory required for the RL training. ## Environment and Data The environment we will be using is Nocturne [Vinitsky et al.]. Nocturne is a 2D driving simulator built from traffic scenarios in the Waymo Open Dataset. The uniqueness of this simulator is that it can compute an agent's visible objects as shown in Figure 1, and can generate more than 2000 states for each agents for a single second timeframe. [add figure] Figure 1: A visual showing the traffic for a specific scene on the road (Left). And the obstructed view of the single viewing blue agent (Right). Currently, Nocturne generates environments based on a set of initial and final road object positions and (optionally) a set of trajectories for the road objects obtained from the Waymo Motion Dataset [Ettinger et al.] However, Nocturne currently does not support traffic lights, pedestrians or cyclists within the environment due to certain contraints and challenges within the Waymo Motion Dataset. So we will not be considering these within our exploration as well. For states representations, Nocturne provides two different ways: an image and a vectorized representation of the image. For ease of use, we will be mainly using the vectorized representation for training. <!-- Here we define the vehicle that is being trained and require observation from the environment as the traning vehicle agent (TVA). --> Based on the environment and states, we could be able to get a list of following **observable infomation** for each of the vehicle in the environment: * The speed of the vehicle * The distance and angle to goal position * The width and length of the vehicle * The relative speed and heading compared to the expert driver (human data) * The angle between the velocity vectors of a specific vehicle and all other vehicles in the environment * The angle and distance to a specific vehicle from all other vehicles in the environment * Other road objects' heading relative to the a specific vehicle And each vehicle in the environment can take the following **actions**: * acceleration: 6 actions from [-3, 2] $m/s^2$ * steering: 21 actions between [-0.7,0.7] radians * head tilt: 5 actions between [-1.6,1.6] radians Partial observability is achieved by setting a 120-degree view-cone for the training agent. Within the 120-degree view-cone, all vehicles that intersect with a single ray in the cone and is not blocked by other vehicles closer to the training agent is considered visible. During training, agents will only be able to obtain information from observable vehicles, and is able to use head tilt action to adjust the view-cone to obtain more information. <!-- And each **episode** is defined as follows: * 9 second per episode * each step is 0.1 second --> <!-- We will be using this generated environment for our Reinforcement Learning model training. --> ## RL Models For Single-agent model, we consider the Deep Q-learning algorithm [Watkins, Dayan], [Mnih et al.], which follows Q-learning but usese a neural network to map each state and observation into pairs of action and Q-value. The policy is improved when updating the weights of the neural network. For multi-agent model without cooperations, we simply create multiple agents and apply the Deep Q-learning algorithm for each agent independently. For multi-agent model with coorperations, we consider the MADDPG algorithm [Lowe et al.], where a centralized Q function is used to integrate information from other agents. We also consider a partial-observation environment. That is, at different time frames, an agent may only observe different portion of the environment. We apply the technique of Attention [Vaswani et al.] [Iqbal and Sha] to obtain embeddings with fixed lengths. ## Environments & Libraries We may use the following packages (subject to change): * Python3 * Nocturne and Waymo dataset packages * OpenAI - MADDPG * PyTorch * Other Python packages such as Numpy, Pandas, etc. ## Reference * Eugene Vinitsky, et al. Nocturne: a scalable driving benchmark for bringing multi-agent learning one step closer to the real world. 2022. https://arxiv.org/abs/2206.09889. Github: https://github.com/facebookresearch/nocturne * Waymo Open Dataset: https://github.com/waymo-research/waymo-open-dataset * Christopher J. C. H. Watkins, Peter Dayan. Q-learning. Mach Learn 8, 279–292 (1992). https://doi.org/10.1007/BF00992698 * Volodymyr Mnih et al. Human-level control through deep reinforcement learning. Nature. 2015. https://doi.org/10.1038/nature14236. * Ryan Lowe et al. Multi-Agent Actor-Critic for Mixed Cooperative-Competitive Environments. Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017. https://arxiv.org/abs/1706.02275. * Alexey Dosovitskiy et al. CARLA: An Open Urban Driving Simulator. Proceedings of Machine Learning Research. 2017. http://proceedings.mlr.press/v78/dosovitskiy17a/dosovitskiy17a.pdf. * Quanyi Li and Zhenghao Peng and Bolei Zhou. Efficient Learning of Safe Driving Policy via Human-AI Copilot Optimization. International Conference on Learning Representations (ICLR). 2022. https://openreview.net/forum?id=0cgU-BZp2ky * Maja J. Mataric. Reward Functions for Accelerated Learning. ICML 1994. https://www.sci.brooklyn.cuny.edu/~sklar/teaching/boston-college/s01/mc375/ml94.pdf * Ariel Rosenfeld and Matthew E. Taylor and Sarit Krau. Leveraging Human Knowledge in Tabular Reinforcement Learning: Study of Human Subjects. Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, {IJCAI} 2017, Melbourne, Australia. 2017. https://www.ijcai.org/proceedings/2017/534 * Ashish Vaswani et al. Attention is All you Need. Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017. https://arxiv.org/pdf/1706.03762.pdf * Shariq Iqbal and Fei Sha. Actor-Attention-Critic for Multi-Agent Reinforcement Learning. Proceedings of Machine Learning Research. 2019. http://proceedings.mlr.press/v97/iqbal19a/iqbal19a.pdf * J. Ho and S. Ermon, “Generative adversarial imitation learning,” in Advances in Neural Information Processing Systems, pp. 4565–4573, 2016. * Stanford Course Project: https://web.stanford.edu/~blange/data/Data-Driven%20Multi-agent%20Human%20Driver%20Modeling.pdfw * Ettinger, S., Cheng, S., Caine, B., Liu, C., Zhao, H., Pradhan, S., Chai, Y., Sapp, B., Qi, C. R., Zhou, Y., et al. Large scale interactive motion forecasting for autonomous driving: The waymo open motion dataset. In Proceedings of the IEEE/CVF International Conference on Computer Vision (2021), pp. 9710–9719. <!-- > This block is a brief introduction of your project. You can put your abstract here or any headers you want the readers to know. {: class="table-of-content"} * TOC {:toc} ## Main Content Your article starts here. You can refer to the [source code](https://github.com/lilianweng/lil-log/tree/master/_posts) of [lil's blogs](https://lilianweng.github.io/lil-log/) for article structure ideas or Markdown syntax. We've provided a [sample post](https://ucla-rlcourse.github.io/CS269-projects-2022fall/2017/06/21/an-overview-of-deep-learning.html) from Lilian Weng and you can find the source code [here](https://github.com/ucla-rlcourse/CS269-projects-2022fall/blob/main/_posts/2017-06-21-an-overview-of-deep-learning.md) ## Basic Syntax ### Image Please create a folder with the name of your team id under `/assets/images/`, put all your images into the folder and reference the images in your main content. You can add an image to your survey like this: ![YOLO]({{ '/assets/images/team00/object_detection.png' | relative_url }}) {: style="width: 400px; max-width: 100%;"} *Fig 1. YOLO: An object detection method in computer vision* [1]. Please cite the image if it is taken from other people's work. ### Table Here is an example for creating tables, including alignment syntax. | | column 1 | column 2 | | :--- | :----: | ---: | | row1 | Text | Text | | row2 | Text | Text | ### Code Block ``` # This is a sample code block import torch print (torch.__version__) ``` ### Formula Please use latex to generate formulas, such as: $$ \tilde{\mathbf{z}}^{(t)}_i = \frac{\alpha \tilde{\mathbf{z}}^{(t-1)}_i + (1-\alpha) \mathbf{z}_i}{1-\alpha^t} $$ or you can write in-text formula $$y = wx + b$$. ### More Markdown Syntax You can find more Markdown syntax at [this page](https://www.markdownguide.org/basic-syntax/). ## Reference Please make sure to cite properly in your work, for example: [1] Dwibedi, Debidatta, et al. "Counting out time: Class agnostic video repetition counting in the wild." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2020. [Peng, et al.] Peng, Zhenghao, et al. "Maybe you can also use other format for reference as you wish." Nature. 2022. --- ## Data Rich and Physics Certain | Experiment | Parameters | Results | Comments | | :--- | :----: | :---: | ---: | | **DL + Data** | | Predicting only velocity | Dataset size : 10000<br> Network : 2->5->5->1 <br> activation: ReLU | ~100% accurate | Generalises well over various initial velocities | | Predicting only displacement | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | Reasonable | Better prediction for $u_0 \in dataset$, average prediction outside | | Predicting both $v_t, s_t$ | Dataset size : 10000<br> Network : 2->16->16->2 <br> activation: tanh | Reasonable | Better prediction for $u_0 \in dataset$, poor prediction outside | ----- | **DL + Physics** | | Predicting both $v_t, s_t$, using Loss $L_{physics} = \|v_{predicted}^2-u_{initial}^2-2*g*s_{predicted}\|$ | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | ~0% accuracy | Expected result as no supervision of any kind is provided | | Predicting both $v_t, s_t$, using Loss $L_{velocity+phy} = (v_{predicted}-v_{actual})^2+\gamma*(v_{predicted}^2-u_{initial}^2-2*g*s_{predicted})^2$ | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | Reasonable | Prediction of $v_t$ is good. Was able to learn $s_t$ reasonably well without direct supervision | | Predicting both $v_t, s_t$, using Loss $L_{supervised+phy} = (v_{predicted}-v_{actual})^2+(s_{predicted}-s_{actual})^2+\gamma*(v_{predicted}^2-u_{initial}^2-2*g*s_{predicted})^2$ | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | Reasonable | Not a better result w.r.t direct supervision | **Observations :** - Physics equations are certain in this case and are the best to use. - Both DL, Hybrid(DL+Physics) methods performance are equivalent (actual accuracy/loss varies based on fine training, random dataset generation) Re running the above experiments with Dataset size of 200(Data Starvation), yielded the following observations - DL performance is comparable with 10000 dataset when trained on much mode epochs(5x) - Hybrid(DL+Physics) without direct supervision on $s_t$ has comparable/better closeness than DL only method for limited epochs($\sim$300) training. ## Data Rich and Physics Uncertain | Experiment | Parameters | Results | Comments | | :--- | :----: | :---: | ---: | | **DL + Data** |\ | Predicting both $v_t, s_t$ | Dataset size : 10000<br> Network : 2->16->16->2 <br> activation: tanh | Reasonable | Better prediction for $u_0 \in dataset$, poor prediction outside | | **DL + Physics** | | Predicting both $v_t, s_t$<br> using Loss $L_{physics} = \|v_{predicted}^2-u_{initial}^2-2*g*s_{predicted}\|$ | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | ~0% accuracy | Expected result as no supervision of any kind is provided | | Predicting both $v_t, s_t$<br> using Loss $L_{velocity+phy} = (v_{predicted}-v_{actual})^2+\gamma*(v_{predicted}^2-u_{initial}^2-2*g*s_{predicted})^2$ | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | Reasonable | Prediction of $v_t$ is good. Was able to learn $s_t$ reasonably well without direct supervision | | Predicting both $v_t, s_t$<br> using Loss $L_{supervised+phy} = (v_{predicted}-v_{actual})^2+(s_{predicted}-s_{actual})^2+\gamma*(v_{predicted}^2-u_{initial}^2-2*g*s_{predicted})^2$ | Dataset size : 10000<br> Network : 2->16->16->1 <br> activation: ReLU | Reasonable | Not a better result w.r.t direct supervision, but bettr than DL when $u0$ is out of dataset | **Observations :** - Both DL, Hybrid(DL+Physics) methods performance are similar, Hybrid(DL+Physics) is better when $u0$ is out of dataset, DL is better for $u0$ in dataset. - Physics equations are not certain in this case and the above methods are better to use than Physics. ## Data Starvation and Physics Uncertain - Similar observations as in data rich -->

    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