GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - basiclab/TTSG: Traffic Scene Generation from Natural Language Description for Autonomous Vehicles with Large Language Models

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
agents
agents
 
 
diversity_test
diversity_test
 
 
docs
docs
 
 
graph
graph
 
 
manager
manager
 
 
maps
maps
 
 
misc
misc
 
 
prompt
prompt
 
 
safebench
safebench
 
 
scene_utils
scene_utils
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
ENVIRONMENT.md
ENVIRONMENT.md
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
text_to_scene.py
text_to_scene.py
 
 

Repository files navigation

TTSG: Text-to-Traffic-Scene Generation

A text-to-traffic-scene generation pipeline with the large language model

License: Apache2.0

Pipeline Image

Bo-Kai Ruan, Hao-Tang Tsui, Yung-Hui Li, Hong-Han Shuai

  • Contact: Bo-Kai Ruan
  • arXiv paper | Project Website

A. Installation πŸš€

First, download Carla from the official website. This codebase has been tested with version 0.9.15.

# Update the version number if necessary
conda create --name ttsg python=3.10
conda activate ttsg
conda install pytorch==2.2.2 torchvision==0.17.2 pytorch-cuda=12.1 -c pytorch -c nvidia -y
pip install carla==0.9.15  # Choose your specific Carla version
pip install -r requirements.txt
pip install shapely==2.0.4

Next, set up your GPT model key. Obtain the API key from OpenAI and save it to a .env file:

OPENAI_API_KEY=your_openai_key

B. Usage πŸ“¦

B-1. Text-to-Scene

This functionality allows users to generate a traffic scene from scratch based on a text prompt. There's no need to manually create an ego vehicleβ€”the scene, including the ego car, will be generated automatically 😊.

# Ensure the Carla server is running before executing this command. If --plan-only is given, no server is needed
python text_to_scene.py \
    --input_text "user's input prompt" \
    --save-dir "path/to/save/recorded/images" \
    --use-cache \
    --return-ego \ # Include this flag if you want the ego car in the output
    --plan-only \ # Use this flag if you only want to plan the scene withour rendering

The use-cache flag uses a pre-built graph if available in the cache directory; otherwise, it generates a new graph and stores it in the cache. To force a new graph generation, either delete the cache directory or omit the use-cache flag.

B-2. Diversity Test

To conduct the diversity test:

python misc/evaluate.py --path <path-to-scenarios>

Our reported results from the paper are available in the diversity_test directory.

To create a custom diversity test, you can use the text-to-scene command mentioned above to generate traffic scenarios.

B-3. Training and Evaluation on SafeBench

For training and evaluation, we follow the setup of ChatScene on the benchmark of SafeBench.

# Training, the scenario_id is range from 1 to 8
python scripts/run_train.py --agent_cfg=adv_text_to_scene.yaml --scenario_cfg=train_agent_text_to_scene.yaml --mode train_agent --scenario_id <scenario_id>

# Evaluation, choose the best epoch for evaluate, using the scenic configuration for fair comparison
python scripts/run_eval.py --agent_cfg=adv_text_to_scene.yaml --scenario_cfg=eval_scenic.yaml --mode eval --scenario_id <scenario_id> --test_epoch <epoch>

We provide the following example weights:

Scenario ID Scenario Name Path
1 Straight Obstacle safebench/agent/model_ckpt/adv_train/sac/text_to_scene/scenario_1/model.sac.-001.torch
3 Lane Changing safebench/agent/model_ckpt/adv_train/sac/text_to_scene/scenario_3/model.sac.-001.torch
6 Unprocted Left-turn safebench/agent/model_ckpt/adv_train/sac/text_to_scene/scenario_6/model.sac.-001.torch

To use the example weights, set the test_epoch flag to be -1.

C. Environment 🌍

Detailed information about the environment setup can be found here.

D. Known Issue 🚨

  • We have identified an issue with the current Carla version, where a segmentation fault occurs when setting the pedestrian’s relative position to at_the_sidewalk. This happens when calling the previous() function from the Carla API, causing the program to crash. We recommend retrying the process if you encounter this issue.

Citation

@article{ruan2024ttsg,
  title={Traffic Scene Generation from Natural Language Description for Autonomous Vehicles with Large Language Model},
  author={Ruan, Bo-Kai and Tsui, Hao-Tang and Li, Yung-Hui and Shuai, Hong-Han},
  journal={arXiv preprint arXiv:2409.09575},
  year={2024}
}

About

Traffic Scene Generation from Natural Language Description for Autonomous Vehicles with Large Language Models

basiclab.github.io/TTSG

Topics

autonomous-drivingcarla-simulatordataset-generationlarge-language-modelstext-to-traffic-scene

Resources

Readme
Activity
Custom properties

Stars

67 stars

Watchers

4 watching

Forks

9 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.