GithubHelp home page GithubHelp logo

opendilab / interfuser Goto Github PK

View Code? Open in Web Editor NEW
482.0 12.0 42.0 39.11 MB

[CoRL 2022] InterFuser: Safety-Enhanced Autonomous Driving Using Interpretable Sensor Fusion Transformer

License: Apache License 2.0

Shell 0.25% Python 95.10% JavaScript 0.05% Ruby 0.04% HTML 0.72% SCSS 0.01% Dockerfile 0.07% CSS 0.07% XSLT 3.69%
autonomous-driving bird-view-image transformer

interfuser's Introduction

InterFuser: Safety-Enhanced Autonomous Driving Using Interpretable Sensor Fusion Transformer

pipeline

Hao Shao, Letian Wang, RuoBing Chen, Hongsheng Li, Yu Liu

CoRL 2022

PWC

This repository contains code for the paper Safety-Enhanced Autonomous Driving Using Interpretable Sensor Fusion Transformer. This work fully processes and fuses information from multi-modal multi-view sensors for achieving comprehensive scene understanding. Besides, intermediate interpretable features are generated from our framework, which provides more semantics and is exploited to better constrain actions to be within the safe sets. Our method achieved new state-of-the-art on CARLA AD Leaderboard by June 11 2022.

News

[12/21] Now, a similar dataset can be found in here, hugging face or openxlab. The only difference is the sample rate is 10Hz in that repo, instead of 2Hz of InterFuser.

Demo Video

Contents

  1. Setup
  2. Dataset
  3. Data Generation
  4. Training
  5. Evaluation
  6. Acknowledgements

Setup

Install anaconda

wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
bash Anaconda3-2020.11-Linux-x86_64.sh
source ~/.profile

Clone the repo and build the environment

git clone https://github.com/opendilab/InterFuser.git
cd InterFuser
conda create -n interfuser python=3.7
conda activate interfuser
pip3 install -r requirements.txt
cd interfuser
python setup.py develop

Download and setup CARLA 0.9.10.1

chmod +x setup_carla.sh
./setup_carla.sh
easy_install carla/PythonAPI/carla/dist/carla-0.9.10-py3.7-linux-x86_64.egg

Note: we choose the setuptools==41 to install because this version has the feature easy_install. After installing the carla.egg you can install the lastest setuptools to avoid No module named distutils_hack.

Dataset

The data is generated with leaderboard/team_code/auto_pilot.py in 8 CARLA towns using the routes and scenarios files provided at leaderboard/data on CARLA 0.9.10.1

The collected dataset is structured as follows:

- TownX_{tiny,short,long}: corresponding to different towns and routes files
    - routes_X: contains data for an individual route
        - rgb_{front, left, right, rear}: multi-view camera images at 400x300 resolution
        - seg_{front, left, right}: corresponding segmentation images
        - depth_{front, left, right}: corresponding depth images
        - lidar: 3d point cloud in .npy format
        - birdview: topdown segmentation images required for training LBC
        - 2d_bbs_{front, left, right, rear}: 2d bounding boxes for different agents in the corresponding camera view
        - 3d_bbs: 3d bounding boxes for different agents
        - affordances: different types of affordances
        - measurements: contains ego-agent's position, velocity and other metadata
        - other_actors: contains the positions, velocities and other metadatas of surrounding vehicles and the traffic lights

Data Generation

Data Generation with multiple CARLA Servers

In addition to the dataset, we have also provided all the scripts used for generating data and these can be modified as required for different CARLA versions. The dataset is collected by a rule-based expert agent in differnet weathers and towns.

Running CARLA Servers

# start 14 carla servers: ip [localhost], port [20000 - 20026]
cd carla
CUDA_VISIBLE_DEVICES=0 ./CarlaUE4.sh --world-port=20000 -opengl &
CUDA_VISIBLE_DEVICES=1 ./CarlaUE4.sh --world-port=20002 -opengl &
...
CUDA_VISIBLE_DEVICES=7 ./CarlaUE4.sh --world-port=20026 -opengl &

Instructions for setting up docker are available here. Pull the docker image of CARLA 0.9.10.1 docker pull carlasim/carla:0.9.10.1.

Docker 18:

docker run -it --rm -p 2000-2002:2000-2002 --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 carlasim/carla:0.9.10.1 ./CarlaUE4.sh --world-port=2000 -opengl

Docker 19:

docker run -it --rm --net=host --gpus '"device=0"' carlasim/carla:0.9.10.1 ./CarlaUE4.sh --world-port=2000 -opengl

If the docker container doesn't start properly then add another environment variable -e SDL_AUDIODRIVER=dsp.

Run the Autopilot

Generate scripts for collecting data in batches.

cd dataset
python init_dir.py
cd ..
cd data_collection
python generate_yamls.py # You can modify fps, waypoints distribution strength ...

# If you don't need all weather, you can modify the following script
python generate_bashs.py
python generate_batch_collect.py 
cd ..

Run batch-run scripts of the town and route type that you need to collect.

bash data_collection/batch_run/run_route_routes_town01_long.sh
bash data_collection/batch_run/run_route_routes_town01_short.sh
...
bash data_collection/batch_run/run_route_routes_town07_tiny.sh

Note1: If you don't need all 14 kinds of weather in your dataset, you can modify the above code and scripts.

Note2: We also provide 7 kinds of night weather conditions in leaderboard/team_code/auto_pilot.py, you can modify the above code and scripts to collect the night dataset.

Data Generation with a single CARLA Server

With a single CARLA server, rollout the autopilot to start data generation.

carla/CarlaUE4.sh --world-port=2000 -opengl
./leaderboard/scripts/run_evaluation.sh

The expert agent used for data generation is defined in leaderboard/team_code/auto_pilot.py. Different variables which need to be set are specified in leaderboard/scripts/run_evaluation.sh.

Some Useful tools

We provide some useful python scripts in tools/data, for example:

  • batch_merge_data.py: merge several fragmented data items into one item, and then interfuser/timm/data/carla_dataset.py can be modified to reduce IO time.
  • batch_stat_data.py: get statistical results of collected data
  • batch_preload.py: compute the waypoints of all frames in one route and save to one file
  • batch_stat_blocked_data.py and batch_recollect_blocked_data.py: find and delete the frames that the ego-vehicle is blocked for a long time

Training

cd interfuser
bash scripts/train.sh
GPU_NUM=8
DATASET_ROOT='dataset/'

./distributed_train.sh $GPU_NUM $DATASET_ROOT  --dataset carla --train-towns 1 2 3 4 6 7 10  --val-towns 5 \
    --train-weathers 0 1 2 3 4 5 6 7 8 9  --val-weathers 10 11 12 13 \
    --model interfuser_baseline --sched cosine --epochs 25 --warmup-epochs 5 --lr 0.0005 --batch-size 16  -j 16 --no-prefetcher --eval-metric l1_error \
    --opt adamw --opt-eps 1e-8 --weight-decay 0.05  \
    --scale 0.9 1.1 --saver-decreasing --clip-grad 10 --freeze-num -1 \
    --with-backbone-lr --backbone-lr 0.0002 \
    --multi-view --with-lidar --multi-view-input-size 3 128 128 \
    --experiment interfuser_baseline \
    --pretrained
    

The DATASET_ROOT needs a file dataset_index.txt to list the traing/evaluation data. The format should be like the follow:

route_path_dir data_frames_in_this_dir

route_path_dir needs to be a relative path to DATASET_ROOT, the training code will concat the DATASET_ROOT and route_path_dir as the full path to load the data

for example:

weather-7/data/routes_town06_long_w7_11_28_18_28_35/ 1062

weather-2/data/routes_town01_short_w2_11_16_08_27_10/ 1785

weather-2/data/routes_town01_short_w2_11_16_09_55_05/ 918

weather-2/data/routes_town02_short_w2_11_16_22_55_25/ 134

weather-2/data/routes_town01_short_w2_11_16_11_44_08/ 569 ...

1062 is the number of the frames in weather-7/data/routes_town06_long_w7_11_28_18_28_35/rgb or weather-7/data/routes_town06_long_w7_11_28_18_28_35/rgb_front etc.

Evaluation

Spin up a CARLA server (described above) and run the required agent. The adequate routes and scenarios files are provided in leaderboard/data and the required variables need to be set in leaderboard/scripts/run_evaluation.sh. Update leaderboard/scripts/run_evaluation.sh to include the following code for evaluating the model on Town05 Long Benchmark.

export CARLA_ROOT=/path/to/carla/root
export ROUTES=leaderboard/data/evaluation_routes/routes_town05_long.xml
export TEAM_AGENT=leaderboard/team_code/interfuser_agent.py
export TEAM_CONFIG=leaderboard/team_code/interfuser_config.py
export CHECKPOINT_ENDPOINT=results/interfuser_result.json
export SCENARIOS=leaderboard/data/scenarios/town05_all_scenarios.json

CUDA_VISIBLE_DEVICES=0 ./leaderboard/scripts/run_evaluation.sh

Use ROUTES=leaderboard/data/42routes/42routes.xml and SCENARIOS=leaderboard/data/42routes/42scenarios.json to run CARLA 42 routes Benchmark.

Pretrain weights

We also provide examplery model weights for direct evaluation which can be downloaded at here. The model needs to be moved to leaderboard/team_code/.

Note: The model is trained on the part of the full dataset with several towns and weathers.

Acknowledgements

This implementation is based on code from several repositories.

Citation

If you find our repo, dataset or paper useful, please cite us as

@article{shao2022interfuser,
 title={Safety-Enhanced Autonomous Driving Using Interpretable Sensor Fusion Transformer},
 author={Hao Shao and Letian Wang and RuoBing Chen and Hongsheng Li and Yu Liu},
 journal={arXiv preprint arXiv:2207.14024},
 year={2022},
}

License

All code within this repository is under Apache License 2.0.

interfuser's People

Contributors

deepcs233 avatar paparazz1 avatar robinc94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

interfuser's Issues

Data generation in different weathers

Hi. I am trying to generate data in different weathers. For example 3 to 5. And I edit the data_collection/batch_run/run_route_routes_town01_long.sh to:

bash data_collection/bashs/weather-3/routes_town01_long.sh &
bash data_collection/bashs/weather-4/routes_town01_long.sh &
bash data_collection/bashs/weather-5/routes_town01_long.sh &

But it doesn't start to generate the dataset.But if it starts from weather-0,1,2 and then 3 to 5 it works. How should I change it to other weathers, so I can generate the dataset from different weathers randomly?

Thank You

Question about position of ego vehicle relative to waypoints

Hi, I am experimenting with different lateral and longitudinal controllers and some require the x and y position of the ego vehicle. I know that in the object density map the position of the ego vehicle is (0,0). Are these waypoints of the same coordinate system as the object density map, meaning the x,y of the ego vehicle is (0,0) relative to these waypoints? Or am I mistaken?

Thanks for any help you can provide

More details regarding training

Great work!

From the paper "The backbone for encoding information from multi-view RGB images is Resnet-50 pretrained on ImageNet [56], and the backbone for processing LiDAR BEV representations is ResNet-18 trained from scratch."

Could you please provide more details regarding training these backbones? How long did you train? How large is the dataset? Did you use the same 8 V100 GPU? Which dataset are you using to train ResNet-18? After pre-training, did you do any further fine-tuning for these two backbone or you just used the pretrained directly?

Thank you very much! :)

about image input settings

Hi ~author, I wanna ask is the foucs view image input really useful for perception(e.g. traffic light detection)? have you done some ablation study about that? I'm curious about how much is the impact to light state perception if the focus view input is removed.

I'll thanks for your reply~

would you please provide the Dockerfile?

sorry for bother again and thanks to your help
My tutor has asked me to reproduce your experimental result,and i want finish this task by submit interfuser agent to carla leaderboard,but the leaderboard_evaluator.py seems not work normally in docker,I'm not sure if it's due to I'm not able to configure the "Dockerfile.master" file,and here is the log

(base) hxa@hxa-Nitro-AN515-58:~/InterFuser$ docker run -it --net=host --gpus all leaderboard-user /bin/bash
root@hxa-Nitro-AN515-58:/workspace# ./leaderboard/scripts/run_evaluation.sh
WARNING: Version mismatch detected: You are trying to connect to a simulator that might be incompatible with this API 
WARNING: Client API version     = 784d9b9f 
WARNING: Simulator API version  = 0.9.10.1 
Traceback (most recent call last):
  File "leaderboard/leaderboard/leaderboard_evaluator.py", line 480, in main
    leaderboard_evaluator = LeaderboardEvaluator(arguments, statistics_manager)
  File "leaderboard/leaderboard/leaderboard_evaluator.py", line 98, in __init__
    self.module_agent = importlib.import_module(module_name)	#import导入所需的模型agent文件
  File "/opt/conda/envs/python37/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "leaderboard/team_code/interfuser_agent.py", line 7, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'
Exception ignored in: <function LeaderboardEvaluator.__del__ at 0x7fc30a2e6680>
Traceback (most recent call last):
  File "leaderboard/leaderboard/leaderboard_evaluator.py", line 125, in __del__
    self._cleanup()
  File "leaderboard/leaderboard/leaderboard_evaluator.py", line 137, in _cleanup
    if self.manager and self.manager.get_running_status() \
AttributeError: 'LeaderboardEvaluator' object has no attribute 'manager'
Traceback (most recent call last):
  File "leaderboard/leaderboard/leaderboard_evaluator.py", line 490, in <module>
    main()
  File "leaderboard/leaderboard/leaderboard_evaluator.py", line 486, in main
    del leaderboard_evaluator
UnboundLocalError: local variable 'leaderboard_evaluator' referenced before assignment



once i run the run_evaluation.sh in terminal ,it seems working normally like that

(interfuser) hxa@hxa-Nitro-AN515-58:~/InterFuser$ ./leaderboard/scripts/run_evaluation.sh
WARNING: Version mismatch detected: You are trying to connect to a simulator that might be incompatible with this API 
WARNING: Client API version     = 784d9b9f 
WARNING: Simulator API version  = 0.9.10.1 
leaderboard/leaderboard/leaderboard_evaluator.py:92: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(dist.version) < LooseVersion('0.9.10'):
pygame 2.1.2 (SDL 2.0.16, Python 3.7.16)
Hello from the pygame community. https://www.pygame.org/contribute.html

========= Preparing RouteScenario_16 (repetition 0) =========
> Setting up the agent
load model: leaderboard/team_code/interfuser.pth.tar
routes_town05_long_03_02_17_25_56
> Loading the world
load
load
load
load
load
load
load
Skipping scenario 'Scenario4' due to setup error: list index out of range
> Running the route

2023-03-02 17-30-06 的屏幕截图

thanks for your help.

Some questions about the tables in the paper

Hi, thanks for your wonderful work. I have got one small question.

I find that, Table 2, Table 3, Table 4 are all the evaluation on Town05 benchmark. But why in Table 2 and Table 3, InterFuser derive 51.6 driving score on Town 05 Long, while in Table 4, InterFuser derive 68.31 driving score ?

I'm looking forward for your reply !

Details of the pretrained weights

Hello, thank you so much for sharing the code and data. Could you tell me the training details of the pretrained weights? Is it trained based on the scripts (14 weathers and 22 routes) in this repository?

Data generation at 2 fps

I saw in the paper that it says you are collecting data at 2 fps and I was wondering what that meant exactly. Do you let the simulation run at higher fps, let's say for example 20 fps and then only collect data for 2 frames each second? Or is everything just running at 2 fps including the simulation itself? I can imagine you would do the former to avoid having many frames that are very similar to each other. What is your opinion on this? If it is the latter, then why would you set it at 2 fps? Is that just the fastest you can get?

Baseline comparison

1690183923502

May I ask if these experimental results were directly run from the training weight files of other papers? Or would you like to retrain using the data you collected?

ValueError: num_samples should be a positive integer value, but got num_samples=0

Thank you for your amazing work!
I have encountered some error like #8, I'm not sure if there are something wrong in my data generation process or my "dataset_index.txt",could you please give me some hints?

here is the log when i run "bash scripts/train.sh"

(interfuser) hxa@hxa-Nitro-AN515-58:~/InterFuser/interfuser$ bash scripts/train.sh
/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py:188: FutureWarning: The module torch.distributed.launch is deprecated
and will be removed in future. Use torchrun.
Note that --use_env is set by default in torchrun.
If your script expects `--local_rank` argument to be set, please
change it to read from `os.environ['LOCAL_RANK']` instead. See 
https://pytorch.org/docs/stable/distributed.html#launch-utility for 
further instructions

  FutureWarning,
Training with a single process on 1 GPUs.
Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth)
Model interfuser_baseline created, param count:52935567
Data processing configuration for current model + dataset:
	input_size: (3, 224, 224)
	interpolation: bicubic
	mean: (0.485, 0.456, 0.406)
	std: (0.229, 0.224, 0.225)
	crop_pct: 0.875
CNN backbone and transformer blocks using different learning rates!
165 weights in the cnn backbone, 274 weights in other modules
AMP not enabled. Training in float32.
Scheduled epochs: 35
Sub route dir nums: 0
Sub route dir nums: 0
Traceback (most recent call last):
  File "train.py", line 1844, in <module>
    main()
  File "train.py", line 1140, in main
    pin_memory=args.pin_mem,
  File "/home/hxa/InterFuser/interfuser/timm/data/carla_loader.py", line 118, in create_carla_loader
    loader = loader_class(dataset, **loader_args)
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 344, in __init__
    sampler = RandomSampler(dataset, generator=generator)  # type: ignore[arg-type]
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 108, in __init__
    "value, but got num_samples={}".format(self.num_samples))
ValueError: num_samples should be a positive integer value, but got num_samples=0
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 7489) of binary: /home/hxa/anaconda3/envs/interfuser/bin/python3
Traceback (most recent call last):
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py", line 195, in <module>
    main()
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py", line 191, in main
    launch(args)
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py", line 176, in launch
    run(args)
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/run.py", line 756, in run
    )(*cmd_args)
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/home/hxa/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launcher/api.py", line 248, in launch_agent
    failures=result.failures,
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
train.py FAILED
------------------------------------------------------------
Failures:
  <NO_OTHER_FAILURES>
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
  time      : 2023-02-23_10:39:25
  host      : hxa-Nitro-AN515-58
  rank      : 0 (local_rank: 0)
  exitcode  : 1 (pid: 7489)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
============================================================

here is my train.sh

GPU_NUM=1
DATASET_ROOT='/home/hxa/InterFuser/dataset/'

./distributed_train.sh $GPU_NUM $DATASET_ROOT  --dataset carla --train-towns 1 2 3 4 6 7 10  --val-towns 5 \
    --train-weathers 0 1 2 3 4 5 6 7 8 9  --val-weathers 10 11 12 13 \
    --model interfuser_baseline --sched cosine --epochs 25 --warmup-epochs 5 --lr 0.0005 --batch-size 16  -j 16 --no-prefetcher --eval-metric l1_error \
    --opt adamw --opt-eps 1e-8 --weight-decay 0.05  \
    --scale 0.9 1.1 --saver-decreasing --clip-grad 10 --freeze-num -1 \
    --with-backbone-lr --backbone-lr 0.0002 \
    --multi-view --with-lidar --multi-view-input-size 3 128 128 \
    --experiment interfuser_baseline \
    --pretrained

and my "dataset_index.txt" is like

/home/hxa/InterFuser/data/eval/routes_town05_long_02_22_10_54_29/ 940

I have noticed that my path of generated dataset is

/home/hxa/InterFuser/data/eval/routes_town05_long_02_22_10_54_29/

not like

weather-7/data/routes_town06_long_w7_11_28_18_28_35/

my path haven't prefix like "weather-7" so I'm not sure if there are something wrong in my dataset generation.

Having problem setting up the project

Thank you for your work.
I am trying to run evaluation locally, but always fail to set up the environment after following instructions in README.md on main branch (https://github.com/opendilab/InterFuser#setup).

Also the git url https://gitlab.bj.sensetime.com/shaohao/interfuser.git doesn't exist any more, I am using this github repo.

It seems like problem with easy_install

EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.

After running python setup.py develop, the easy_install command is not found.

I tried many different methods but always have problems setting it up.

Could you update the instruction?

collect data from the CARLA leaderboard benchmark

Thank you. May I ask how to modify the content in leaderboard/scripts/run_evaluation.sh if I want to collect data from the CARLA leaderboard benchmark?

1688436601887

Is it correct to only modify SCENARIOS and ROUTES?as shown in the figure.

Script for collecting data

1688107655607
When we collect data, we run the leaderboard_ evaluator.py, this process will also result in the evaluation of the data, right? Because when I generated the data, I obtained the results shown in the figure. If I only performed data generation without evaluation, what would I do?

Evaluation Statistics (Driving Route, Infraction Score, Completion Score)

Dear Author, I have successfully ran your evaluation code CUDA_VISIBLE_DEVICES=0 ./leaderboard/scripts/run_evaluation.sh

At the end of the process I did not see the Evaluation Statistics (Driving Route, Infraction Score, Completion Score). But I noticed there is sample_result.jason file generated.

I was wondering how do I generate the statistics? Thank you!

question about model

Hi~ author, it's a great job~ and I have three questions~
(1) I haven't found the detailed network structure python script in your code, I wanna ask have you open source this file? I'll thanks for your reply~

(2) I notice interfuser also learn traffic light state, does it only consider the one traffic light appeared in front-view image? If so, is it possible that the model output error results if two traffic lights appear in front-view? (e.g. when ego_car's yaw is not parallel to lane when running close to junction area, it may see not only one traffic light, right?)

(3) How much will the traffic light detection impact on the final planning metric? In my opinion, transfuser first need to imitate expert trajectory by valid imitation training(i.e. equip implicitly understanding ability to traffic light, see green -> continue running, see red -> tends to slow down), then through explicit traffic light detection result, the safety will be further improved, right? Have you ever done an ablation experiment on traffic light detection? (i.e. only rely on implicitly imitation training,
while remove the "detect red light --> brake" logical behavior)

Model cannot be created

Thanks for your work. I want to make an evaluation but the model cannot be created. How do I load the model?
self.net = create_model(self.config.model)

RuntimeError: Unknown model (interfuser_baseline_seperate_all)

Would the work of Reasonet be released?

Thank you for your great work. I noticed that a new work of Reasonet was presented in CVPR 2023. I'd like to know if your team plans to release the code?

Dataset generation

The scenario could not be loaded:

rpc::timeout: Timeout of 2000ms while calling RPC function 'register_vehicle'

We run multithreaded scripts
bash data_ Collection/batch_ Run/run_ Route_ Routes_ Town01_ Long.sh
The above error has been reported. Have you encountered it before?

weather

May I ask what the 14 types of weather are like? Can you summarize them, please

Lightweight docker

Hi, thank you for making the code available!

I would like to run the trained InterFuser model on a small set of pre-collected CARLA data. Can I download such data from somewhere without collecting them myself? How would you go about setting up such a lightweight setting?

How to use tensorboard

Hello

I am using one GPU to train a model and you mentioned to me before that I need to change the args.distributed to False. In another issue you have mentioned it causes the tensorboard not to collect the data. But I need that. My question is if I change the args.distributed from False to True in the loss function updates sections and change the args.world_size to 1, would this solve the problem and could I get the results in the tensorboard while keeping the original structure of the code in correct format?

Thank You

training with one GPU, error

Hello

Thank you for this repo. I am trying to train the model with one GPU and I am receiving this error. Do you know how to fix it?

/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py:188: FutureWarning: The module torch.distributed.launch is deprecated
and will be removed in future. Use torchrun.
Note that --use_env is set by default in torchrun.
If your script expects `--local_rank` argument to be set, please
change it to read from `os.environ['LOCAL_RANK']` instead. See 
https://pytorch.org/docs/stable/distributed.html#launch-utility for 
further instructions

  FutureWarning,
Training with a single process on 1 GPUs.
Loading pretrained weights from url (https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth)
Model interfuser_baseline created, param count:52935567
Data processing configuration for current model + dataset:
	input_size: (3, 224, 224)
	interpolation: bicubic
	mean: (0.485, 0.456, 0.406)
	std: (0.229, 0.224, 0.225)
	crop_pct: 0.875
Traceback (most recent call last):
  File "train.py", line 1847, in <module>
    main()
  File "train.py", line 972, in main
    print(torch.distributed.get_world_size())
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/distributed_c10d.py", line 1067, in get_world_size
    return _get_group_size(group)
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/distributed_c10d.py", line 453, in _get_group_size
    default_pg = _get_default_group()
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/distributed_c10d.py", line 585, in _get_default_group
    "Default process group has not been initialized, "
RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 120559) of binary: /home/mohammad/anaconda3/envs/interfuser/bin/python3
Traceback (most recent call last):
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py", line 195, in <module>
    main()
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py", line 191, in main
    launch(args)
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launch.py", line 176, in launch
    run(args)
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/run.py", line 756, in run
    )(*cmd_args)
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/home/mohammad/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/launcher/api.py", line 248, in launch_agent
    failures=result.failures,
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
train.py FAILED
------------------------------------------------------------
Failures:
  <NO_OTHER_FAILURES>
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
  time      : 2022-12-29_16:44:22
  host      : mohammad
  rank      : 0 (local_rank: 0)
  exitcode  : 1 (pid: 120559)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html

Generating Data on GPU servers

Hello

You previously mentioned you have tried to generate the dataset on headless machines. I am trying to do the same on a GPU server and I have tried following commands:

CUDA_VISIBLE_DEVICES=0 ./CarlaUE4.sh --world-port=20000 -opengl &
CUDA_VISIBLE_DEVICES=0 ./CarlaUE4.sh --world-port=20000 -opengl -carla-server &
DISPLAY= ./CarlaUE4.sh --world-port=20000 -opengl -carla-server &

But non of them works and I get following error. Do you know what the problem is? Thank You

Disabling core dumps.
error: XDG_RUNTIME_DIR not set in the environment.
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
terminating with uncaught exception of type std::__1::system_error: thread constructor failed: Resource temporarily unavailable
Signal 6 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554 
CommonUnixCrashHandler: Signal=6
Malloc Size=65535 LargeMemoryPoolOffset=131119 
Malloc Size=124960 LargeMemoryPoolOffset=256096 
Engine crash handling finished; re-raising signal 6 for the default handler. Good bye.

Long,short or tiny

Hello

I was wondering which length is better suited for training the models? Long, short or tiny bash files? Which was did you use for training your model?

Thank You

Reproducing issue about ego Vehicle stop permanently for false positive objects

Dear Author, I am currently reproducing your work and I am seeing following issue.
When there is false positive of objects (most likely wrongly recognised as Pedestrian), the ego Vehicle permanently stops. According to the figure below, the the safety control mechanism think the false positive has velocity and will crash with vehicle.

I think the root of cause might be that Pedestrian in dataset always has constant velocity, therefore false positive objects always has velocity when neural network wrongly classify object as Pedestrian. However, I am confused as I also read your paper you have tracking code to further calculate the correct velocity.

I was wondering did you have this problem? Or this is my reproducing issue. Any hints will be helpful. Thank you!

Screenshot from 2023-03-12 10-21-13

Deactivate safty controller

Is there anyway to deactivate the safty controller directly?
Can you also provide the ckpt of the model without safty controller of your ablation study?

weather used

In the paper, I did not see how many types of weather were used in the dataset. Is it the same as the code, using 14 types of weather?

Errors when running tools/data scripts and train.py

Thanks for the great work. However, there were some error encountered and I would be grateful if you can help with it.
error 1:
command: python tools/data/batch_merge_data.py '/media/avt/InterFuser/dataset/'
error:

Traceback (most recent call last):
File "tools/data/batch_merge_data.py", line 52, in
for line in open(list_file, "r").readlines():
IsADirectoryError: [Errno 21] Is a directory: '/media/avt/4TB/InterFuser/dataset/'
It seems like batch_merge_data.py needs data directory as input. however, it has strange error. What kind of input does it take?

error 2:
command: python timm/data/carla_dataset.py
error:

Traceback (most recent call last):
File "timm/data/carla_dataset.py", line 12, in
from .base_io_dataset import BaseIODataset
ImportError: attempted relative import with no known parent package
BTW, I did run python setup.py develop.

error 3 is distributed training related, I changed GPU_NUM=1 since i have only one gpu.
command: bash scripts/train.sh
error:

Traceback (most recent call last):
File "train.py", line 1844, in
main()
File "train.py", line 971, in main
args.lr * args.batch_size * torch.distributed.get_world_size() / 512.0
File "/home/avt/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/distributed_c10d.py", line 1067, in get_world_size
return _get_group_size(group)
File "/home/avt/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/distributed_c10d.py", line 453, in _get_group_size
default_pg = _get_default_group()
File "/home/avt/anaconda3/envs/interfuser/lib/python3.7/site-packages/torch/distributed/distributed_c10d.py", line 585, in _get_default_group
"Default process group has not been initialized, "
RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.

torch.distributed.get_world_size() does not seems to be initialized with gpu_num= 1. Can i just replace it with value 1?

Datagen AutoPilot agent getting stuck

Hi!

Thank you for the open source project :)

We are trying to generate data for training using your data generation scripts. Note that we have upgraded to CARLA version 0.9.14 and thus had to change some code in our InterFuser fork, but no changes were done to the auto pilot agent. We are also using another car than the default lincoln mkz 2017 (they have similar dimensions).

While inspecting the data it generates, we see that the ego vehicle sometimes gets stuck when trying to do a turn. After a while it either despawns the incoming vehicle, or the scenario ends with a "Failed - Agent timed out"-error.

See videos below showcasing the problem. Would it for example be possible to change som variables in the code to increase the distance threshold between the ego vehicle and incoming cars during a turn?

stuck_1.mp4
stuck_2.mp4
stuck_3.mp4

single server error

1688116815132

1688116876895

1688116900592

I use a single server,
Carla/CarlaUE4. sh -- world port=2000 opengl
./leaderboard/scripts/run_ Evaluation.sh,
I commented out the window code of pygame and reported an error. Do you know what the reason is?Please!

Porting InterFuser to BeamNG.tech

Dear All,

I am a student working on a project involving testing ADAS/AV and scenario synthesis using BeamNG.tech and would love to run (test) your driving agent in that simulator. I know CARLA is kind of a de facto standard, but IMHO BeamNG.tech is superior when it comes to physic simulation, content, and flexibility. Further, BeamNG.tech is free for research, offers a python API, just like CARLA, and implements a wide range of sensors.

So I wonder how technically difficult it would be to port InterFuser to BeamNG.tech and whether anyone of you could support me (and my colleagues) in doing so. Hope to hear from you soon,

Thanks!

-- Benedikt Steininger

Car Stopping way ahead for Red Light

Hi, I was able to setup Interfuser and got it running with CARLA 0.9.10 with pre-trained weights given in the evaluation section. I noticed that for a red a light, the car stops probably 50-60 meters before it. Any reason why ?

Screenshot from 2023-06-16 12-36-40-fotor-20230620164637

Thanks in advance

Standalone code

Hi,
First of all thanks for sharing the code for Interfuser.

Here while using Interfuser many other dependencies such as leaderboard and scenario runner involved. Is there any Interfuser code available as a standalone so that i can directly plug Interfuser into CARLA for my own custom scenario ? Or any way to do it ?

Thanks in advance !

Training

Hi,when training,I see parameters:
--dataset carla --train-towns 1 2 3 4 6 7 10 --val-towns 5 --train-weathers 0 1 2 3 4 5 6 7 8 9 --val-weathers 10 11 12 13
But For each town, it is divided into long, short, and tiny. Do all three need to collect data and use it? And why is the weather for training not 21, but the top 14?

Data Generation with a single CARLA Server

Thanks for your work.
May I know how to generate the dataset with a single server?
Every time I run the code provided in the section Data Generation with a single CARLA Server, it just outputs


pygame 2.1.2 (SDL 2.0.16, Python 3.7.15)
Hello from the pygame community. https://www.pygame.org/contribute.html
> Registering the global statistics

and the Carla server has no response.
Have you met this issue?
Looking forward to your reply.

dataset_ Index.txt file?

May I ask if you can provide the training for your dataset_ Index.txt file? Thank you very much!

Questions on data efficiency / ablation study on same dataset for other methods

Thanks for your work.

I have one question on the experiment part, I notice that here:

Dataset collection We ran a rule-based expert agent on all 8 kinds of towns and weather with 2 FPS, to collect an expert dataset of 3M frames (410 hours).

As I knew that in [CVPR'21 Transfuser], [TPAMI'22 Transfuser], [CVPR'22 LAV] and [Arxiv'22 TCP] dataset sizes are all around 200-400K frames. [1M=1,000 K]

I didn't find the result table in the paper with the same dataset training but only the online leaderboard. Maybe you have some insights that didn't point out in the paper, so I propose this issue.

This 3M=3000K with 200-400K which makes it unclear whether it's the model or the extra data that brings the boost to the performance. Have you done any experiments on the data efficiency of your model?

Update: 2022/11/1, adding the discussion link here: Kin-Zhang/carla-expert#4

Questions about details of the network

Hi,

Thank you for your great work! I have some questions about details of the network.

  1. For CNN backbone, input images from different cameras are scaled to different size and cropped to different size (e.g. front: 800x600 => scale to 256x256 => crop to 224x224, left/right: 800x600 => scale to 160x160 => crop to 128x128, focus: 800x600 => crop to 128x128), are there any special reasons for different operations and choosing different size?
  2. For backbone, in the paper "We set C = 2048 and (H;W) = (H0/32 ; W0/32 ) in experiments.", any special reason for choosing 2048 and dividing by 32?
  3. After resnet, a convoluation is used to reduce channel from 2048 to 256, any special reason for choosing 256?

Thank you! :)

Network details

  1. I see that the network is dependent on actor details json as input for predicting the velocity. Am i correct?
  2. Can i skip using the actor details for predicting the velocity.

Waypoint loss function

In the Waypoint loss function, the waypoints generated by the expert agent are the waypoints used during data collection. Is that right?

How to run train.py on single GPU PC?

Because of my finite conditions, I have only one GPU which can train it. I modified train.sh GPU_NUM=1 but there is an error: "Default process group has not been initialized,"
Some information shows that I should change SyncBN to BN, is it possible in the code?
Thank you very much

pygame.error: No available video device

Hello

May i know why it will have this issue, thanks!

File "leaderboard/leaderboard/leaderboard_evaluator.py", line 269, in _load_and_run_scenario
self.agent_instance = getattr(self.module_agent, agent_class_name)(args.agent_config)
File "/media/changquan/data0/sty/InterFuser/leaderboard/leaderboard/autoagents/autonomous_agent.py", line 45, in init
self.setup(path_to_conf_file)
File "leaderboard/team_code/interfuser_agent.py", line 162, in setup
self._hic = DisplayInterface()
File "leaderboard/team_code/interfuser_agent.py", line 50, in init
(self._width, self._height), pygame.HWSURFACE | pygame.DOUBLEBUF
pygame.error: No available video device

Registering the route statistics

========= Preparing RouteScenario_25 (repetition 0) =========

Setting up the agent

Could not set up the required agent:

No available video device

Traceback (most recent call last):
File "leaderboard/leaderboard/leaderboard_evaluator.py", line 269, in _load_and_run_scenario
self.agent_instance = getattr(self.module_agent, agent_class_name)(args.agent_config)
File "/media/changquan/data0/sty/InterFuser/leaderboard/leaderboard/autoagents/autonomous_agent.py", line 45, in init
self.setup(path_to_conf_file)
File "leaderboard/team_code/interfuser_agent.py", line 162, in setup
self._hic = DisplayInterface()
File "leaderboard/team_code/interfuser_agent.py", line 50, in init
(self._width, self._height), pygame.HWSURFACE | pygame.DOUBLEBUF
pygame.error: No available video device

Registering the route statistics
Registering the global statistics

town 6 doesn't work

Hi. I am trying to generate dataset from town 6 and it doesn't work.I run "bash data_collection/batch_run/run_route_routes_town06_short.sh" and this what I am seeing:


leaderboard/leaderboard/leaderboard_evaluator.py:91: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if LooseVersion(dist.version) < LooseVersion('0.9.10'):

========= Preparing RouteScenario_0 (repetition 0) =========
> Setting up the agent
{'destory_hazard_actors': True, 'rgb_only': False, 'save_skip_frames': 10, 'waypoint_disturb': 0.2, 'waypoint_disturb_seed': 2020, 'weather': 0}
10
routes_town06_short_w0_01_04_16_03_36
> Loading the world
load

After that it stops and the carla simulator gives the following error:

Screenshot from 2023-01-04 16-06-13

Do you know what the reason is? (By the way I have tested it with different PCs and get the same result. The other towns are OK!)

Some issues about data size and loss in training

Hello,

Thanks for your interesting and great work. I have got some problems in training.

I uniformly collected around 300,000 frames from town01-short, town02-tiny and town03-long in 21 kinds of weathers. Then, I used these data to train Interfuser and obtain a final loss around 0.03.

However, when I evaluated the performance of the trained model in Town05-Long, the model got bad performance as shown in the following figure (please ignore the [system time/game time] since our server is busy these days).

89e0c1e5db1c9881974a02caa8cbba0

I want to ask the following questions:

  1. I only collect 1/10 dataset compared to your original paper. Is this bad performance caused by the small size of my collected datasets? Or are there some other reasons?
  2. How much is the final loss you can get when using 3,000,000 frames for training as in the original paper? Is my obtained loss reasonable?
  3. Our GPU-resource is limited. Could I tune up the learning rate and decade the number of epochs to accelerate training? Is the warm up epochs important? Could I decrease the number of warm up epochs?

I'm looking forward for your reply and thanks again for your great work !

Town05 Benchmark

In the file you provided, I found the long route of 05town (routes_town05_long.xml), but there is no short route in the same folder. I found routes_town05_short.xml in the validation_routes folder, but it is mentioned in your paper The short route file consists of 10 routes, while routes_town05_short.xml consists of 32 routes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.