Skip to content

[CoRL 2024 Oral] FREA: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality

License

Notifications You must be signed in to change notification settings

CurryChen77/FREA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FREA: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality

Custom badge Custom badge

✨ News

  • 2024-09-05 Exciting news! FREA is accepted by CoRL 2024 for Oral PresentationπŸŽ‰πŸŽ‰!
  • 2024-08-10 Explore our project page, now live hereπŸ”—!
  • 2024-08-10 Codes are now release!
  • 2024-06-05 Our paper is available on ArxivπŸ“„!

This repository contains the implementation of the paper.

FREA: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality

Keyu Chen1 , Yuheng Lei2, Hao Cheng1, Haoran Wu1, Wenchao Sun1, Sifa Zheng1

1School of Vehicle and Mobility, Tsinghua University 2The University of Hong Kong

If you find our work useful, Please give us a star 🌟!

πŸ’« FREA incorporates feasibility as guidance to generate adversarial yet AV-feasible, safety-critical scenarios.

πŸ“ƒ Outline

πŸ”§ Setup

Recommended system: Ubuntu 20.04 or 22.04

Step 1: Install Carla (0.9.13 recommended)

Step 2: Setup conda environment

conda create -n frea python=3.8
conda activate frea

Step 3: Clone this git repo in an appropriate folder

git clone [email protected]:CurryChen77/FREA.git

Step 4: Enter the repo root folder and install the packages:

cd FREA
pip install -r requirements.txt
pip install -e .

πŸ“š Usage

πŸ“‚ Collect Offline Data

Collect data from specific AV and CBV

# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000

# Launch in another terminal
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg standard_train.yaml --mode collect_feasibility_data

Merge all data from different AV and CBV

# Merge data
python frea/feasibility/unify_offline_data.py

To use the offline dataset in our paper download from here (data.zip) put them into the feasibility folder.

πŸ”₯ Train optimal feasible value function of AV

# Train optimal feasible value function of AV
python train_feasibility.py

πŸ”₯ Train adversarial policy of CBV

Train FREA (need well-trained LFR)

# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000

# Train FREA
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg fppo_adv_train.yaml --mode train_scenario

Train FPPO-RS (need well-trained LFR)

# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000

# Train FPPO-RS
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg fppo_rs_train.yaml --mode train_scenario

Train PPO

# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000

# Train PPO
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg ppo_train.yaml --mode train_scenario

πŸ”₯ Train AV (optional)

Train PPO AV based on FREA scenarios

# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000

# Train FREA
python scripts/run.py --agent_cfg ppo.yaml --scenario_cfg fppo_adv_train.yaml --mode train_agent

Train PPO AV based on standard scenarios

# Launch CARLA
./CarlaUE4.sh -prefernvidia -RenderOffScreen -carla-port=2000

# Train FREA
python scripts/run.py --agent_cfg ppo.yaml --scenario_cfg standard_train.yaml --mode train_agent

❄️ Evaluation

To use the learning-based method PlanT, you need to extract the checkpoint of PlanT from here (PlanT_medium.zip) and put the them here.

Evaluation for data analysis (recording results)

# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000

# Evaluation FREA
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg FPPO_adv_eval.yaml --mode eval --eval_mode analysis

Evaluation for video visualization

# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000

# Evaluation FREA
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg FPPO_adv_eval.yaml --mode eval --eval_mode render

πŸ“ˆ Results Analysis

Results analysis of the paper

Generate your own results analysis

Make sure the Evaluation has finished and the result are saved in folder.

# Process the recorded data
python eval_analysis/process_data/process_all_data.py

# Plot the evaluation result
python eval_analysis/plot_data/plot_evaluation_result.py

🎬 Visualization

World spectator

# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000

# Set world spectator
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg standard_eval.yaml --mode eval -sp

AV route

# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000

# Visualize AV route
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg standard_eval.yaml --mode eval -viz_route

BEV map

# Launch CARLA
./CarlaUE4.sh -prefernvidia -windowed -carla-port=2000

# Visualize BEV map
python scripts/run.py --agent_cfg expert.yaml --scenario_cfg FPPO_adv_eval.yaml --mode eval --eval_mode render

πŸ”– Citation

If you find our paper useful, please kindly cite us via:

@inproceedings{
  chen2024frea,
  title={{FREA}: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality},
  author={Keyu Chen and Yuheng Lei and Hao Cheng and Haoran Wu and Wenchao Sun and Sifa Zheng},
  booktitle={8th Annual Conference on Robot Learning},
  year={2024},
  url={https://openreview.net/forum?id=3bcujpPikC}
}

πŸ“‹ Acknowledgement

This implementation is based on code from several repositories. We sincerely thank the authors for their awesome work.

About

[CoRL 2024 Oral] FREA: Feasibility-Guided Generation of Safety-Critical Scenarios with Reasonable Adversariality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published