MCPcopy Index your code
hub / github.com/Rex-sys-hk/PlanScope

github.com/Rex-sys-hk/PlanScope @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
529 symbols 1,800 edges 64 files 189 documented · 36%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PlanScope

This is the official repository of

PlanScope: Learning to Plan Within Decision Scope Does Matter

Ren Xin, Jie Cheng, Hongji Liu and Jun Ma

arXiv PDF

PlanScopeConcept

TL;NR

Based on PLUTO, we study the integrating method of long and short-term decision making, and the Time Dependent Normalization achieves the most significant improvement to 91.32% in the nuPlan Val4 CLS-NR score.

Video

Performance Comparison with SOTA methods

w/o post-processing | Model Name | Val14 CLS-NR Score | Val14 CLS-R Score | | ---- | ---- | ---- | | PLUTO | 89.04 | 80.01 | | STR2-CPKS-800M| 65.16 | - | | Diffusion Planner | 89.87 | 82.80 | | PlanScope (ours) | 91.32 | 80.96 |

Setup Environment

Setup dataset

Setup the nuPlan dataset following the official-doc

Setup conda environment

conda create -n planscope python=3.9
conda activate planscope

# install nuplan-devkit
git clone https://github.com/motional/nuplan-devkit.git && cd nuplan-devkit
pip install -e .
pip install -r ./requirements.txt

# setup planscope
cd ..
git clone https://github.com/Rex-sys-hk/PlanScope && cd planscope
sh ./script/setup_env.sh

Feature Cache

Preprocess the dataset to accelerate training. It is recommended to run a small sanity check to make sure everything is correctly setup.

 python run_training.py \
    py_func=cache +training=train_pluto \
    scenario_builder=nuplan_mini \
    cache.cache_path=/nuplan/exp/sanity_check \
    cache.cleanup_cache=true \
    scenario_filter=training_scenarios_tiny \
    worker=sequential

Then preprocess the whole nuPlan training set (this will take some time). You may need to change cache.cache_path to suit your condition

 export PYTHONPATH=$PYTHONPATH:$(pwd)

 python run_training.py \
    py_func=cache +training=train_pluto \
    scenario_builder=nuplan \
    cache.cache_path=/nuplan/exp/cache_pluto_1M \
    cache.cleanup_cache=true \
    scenario_filter=training_scenarios_1M \
    worker.threads_per_node=40

Training

sh train_scope.sh
  • you can remove wandb related configurations if your prefer tensorboard.

Checkpoint

Copy your chekpoint path to sim_scope.sh or sim_pluto.sh and replace the value of CKPT_N to run the evaluation.

Model Download Download
Pluto-aux-nocil-m6-baseline OneDrive HuggingFace
PlanScope-Ih10-DWT OneDrive HuggingFace
PlanScope-Mh10-DWH OneDrive HuggingFace
PlanScope-Mh20-DWT OneDrive HuggingFace
---
PlanScope-Th20 OneDrive HuggingFace
PlanScope-timedecay OneDrive HuggingFace
PlanScope-timenorm OneDrive HuggingFace
---
Pluto-1M-aux-cil-m12-original OneDrive HuggingFace
PlanScope-timenorm-cil-m12 OneDrive HuggingFace

Run PlanScope-planner simulation

Run simulation for a random scenario in the nuPlan-mini split

sh ./sim_scope.sh

To Do

The code is under cleaning and will be released gradually.

  • [ ] improve docs
  • [x] training code
  • [x] visualization
  • [x] Scope-planner & checkpoint
  • [x] feature builder & model
  • [x] initial repo & paper

Citation

If you find this repo useful, please consider giving us a star 🌟 and citing our related paper.

@misc{planscope,
      title={{PlanScope:} Learning to Plan Within Decision Scope Does Matter}, 
      author={Ren Xin and Jie Cheng and Jun Ma},
      year={2024},
      eprint={2411.00476},
      archivePrefix={arXiv},
      primaryClass={cs.RO},
      url={https://arxiv.org/abs/2411.00476}, 
}

Thanks

Others

  • Please mind the common problem of nuPlan Dataset setup: https://github.com/motional/nuplan-devkit/issues/379
  • Advised NATTEN Version: 0.14.6+torch1121cu116
  • Please mind your Linux system version, Ubuntu 18.04.6 LTS is prefered. Debian may lead to some unexpected error in closed-loop simulation.
  • When training on the 20% dataset, the random selection of data splits during training possibly cause fluctuations of about 2% CLS-NR score on Random14, the training on partial dataset should only be used as reference during development.
  • This repo is updated on 5 March 2025, the previous version can be found by checkout branch archived_1.

Core symbols most depended-on inside this repo

to_tensor
called by 8
src/utils/utils.py
size
called by 8
src/post_processing/common/enum.py
get_route_roadblock_ids
called by 8
src/scenario_manager/scenario_manager.py
sort_predictions
called by 7
src/metrics/utils.py
to_numpy
called by 6
src/utils/utils.py
_within_bound
called by 6
src/post_processing/evaluation/comfort_metrics.py
normalize
called by 6
src/features/pluto_feature.py
with_pos_embed
called by 6
src/models/pluto/layers/transformer.py

Shape

Method 381
Function 78
Class 70

Languages

Python100%

Modules by API surface

src/post_processing/common/enum.py24 symbols
src/feature_builders/scope_feature_builder.py22 symbols
src/feature_builders/pluto_feature_builder.py22 symbols
src/models/pluto/layers/embedding.py21 symbols
src/models/pluto/layers/transformer.py18 symbols
src/feature_builders/nuplan_scenario_render.py17 symbols
src/models/pluto/scope_trainer.py16 symbols
src/scenario_manager/scenario_manager.py15 symbols
src/scenario_manager/route_manager.py15 symbols
src/post_processing/trajectory_evaluator.py15 symbols
src/models/pluto/pluto_trainer.py15 symbols
src/scenario_manager/occupancy_map.py14 symbols

For agents

$ claude mcp add PlanScope \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact