Skip to content

Commit b26b950

Browse files
committed
update LICENSE. Update README with our results. We set a all_suites task to evaluate on all benchmarks. We had a link to the freezing issue when importing carla and torch. We removed the hack to destuck agent. We replace all print/exit with raise ValueError
1 parent 7819a0b commit b26b950

5 files changed

Lines changed: 92 additions & 64 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Dian Chen
3+
Copyright (c) 2020 Marin Toromanoff
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from which we just kept all the code related to the evaluation on the standard C
77
benchmark and on the new released No-Crash benchmark.
88

99
### Installation
10-
We provide a script here to install and download our weights:
10+
We provide a script to install every dependencies needed and download our weights.
1111

1212
```bash
1313
# Download CARLA 0.9.6
@@ -29,9 +29,9 @@ mv Town*.bin CarlaUE4/Content/Carla/Maps/Nav/
2929
conda env create -f environment.yml
3030
conda activate carla_RL_IAs
3131
# BE CAREFUL: you need to install pytorch according to your cuda version
32-
#conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
32+
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
3333
#conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
34-
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
34+
#conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
3535
pip install --upgrade pip
3636
pip install pygame
3737

@@ -41,15 +41,15 @@ rm carla-0.9.6-py3.5-linux-x86_64.egg
4141
wget http://www.cs.utexas.edu/~dchen/lbc_release/egg/carla-0.9.6-py3.5-linux-x86_64.egg
4242
easy_install carla-0.9.6-py3.5-linux-x86_64.egg
4343

44-
# Download model checkpoints trained only on Town01
44+
# Download model checkpoints trained only on Town01/training weathers
4545
wget https://github.com/marintoro/LearningByCheating/releases/download/v1.0/model_RL_IAs_only_town01_train_weather.zip
4646
unzip model_RL_IAs_only_town01_train_weather.zip
4747

48-
4948
# Download model checkpoints used for CARLA challenge
5049
cd ../../..
5150
wget https://github.com/marintoro/LearningByCheating/releases/download/v1.0/model_RL_IAs_CARLA_Challenge.zip
5251
unzip model_RL_IAs_CARLA_Challenge.zip
52+
5353
```
5454

5555
Then, open up a terminal, inside the carla directory run `./CarlaUE4.sh -fps=10 -benchmark`.
@@ -61,49 +61,63 @@ If you want to see our model used for the CARLA challenge you need to run instea
6161
`python benchmark_agent.py --suite=town2
6262
--max-run 100 --path-folder-model model_RL_IAs_CARLA_Challenge/ --render`
6363

64+
Note that the model we used for the CARLA challenge was trained on a way harder task and on another
65+
version of CARLA so the results on the benchmark are lower. On the other hand it handles all towns,
66+
including Town03, Town04 and Town05 with US traffic lights!
67+
6468

6569
## Detailed Benchmark Results
6670
### Only town01/train weather
71+
6772
```
68-
╔Performance of autopilot════════════╦═════════╦═══════╗
69-
║ Suite Name ║ Success Rate ║ Total ║ Seeds ║
70-
╠═════════════════════╬══════════════╬═════════╬═══════╣
71-
║ FullTown01-v1 ║ 100 ║ 100/100 ║ 2019 ║
72-
║ FullTown01-v2 ║ 100 ║ 50/50 ║ 2019 ║
73-
║ FullTown01-v3 ║ 100 ║ 100/100 ║ 2019 ║
74-
║ FullTown01-v4 ║ 100 ║ 50/50 ║ 2019 ║
75-
║ FullTown02-v1 ║ 99 ║ 99/100 ║ 2019 ║
76-
║ FullTown02-v2 ║ 96 ║ 48/50 ║ 2019 ║
77-
║ FullTown02-v3 ║ 98 ║ 98/100 ║ 2019 ║
78-
║ FullTown02-v4 ║ 92 ║ 46/50 ║ 2019 ║
79-
║ NoCrashTown01-v1 ║ 100 ║ 100/100 ║ 2019 ║
80-
║ NoCrashTown01-v2 ║ 24 ║ 12/50 ║ 2019 ║
81-
║ NoCrashTown01-v3 ║ 99 ║ 99/100 ║ 2019 ║
82-
║ NoCrashTown01-v4 ║ 26 ║ 13/50 ║ 2019 ║
83-
║ NoCrashTown01-v5 ║ 67 ║ 67/100 ║ 2019 ║
84-
║ NoCrashTown01-v6 ║ 14 ║ 7/50 ║ 2019 ║
85-
║ NoCrashTown02-v1 ║ 97 ║ 97/100 ║ 2019 ║
86-
║ NoCrashTown02-v2 ║ 18 ║ 9/50 ║ 2019 ║
87-
║ NoCrashTown02-v3 ║ 86 ║ 86/100 ║ 2019 ║
88-
║ NoCrashTown02-v4 ║ 14 ║ 7/50 ║ 2019 ║
89-
║ NoCrashTown02-v5 ║ 44 ║ 44/100 ║ 2019 ║
90-
║ NoCrashTown02-v6 ║ 14 ║ 7/50 ║ 2019 ║
91-
║ StraightTown01-v1 ║ 100 ║ 100/100 ║ 2019 ║
92-
║ StraightTown01-v2 ║ 100 ║ 50/50 ║ 2019 ║
93-
║ StraightTown02-v1 ║ 100 ║ 100/100 ║ 2019 ║
94-
║ StraightTown02-v2 ║ 100 ║ 50/50 ║ 2019 ║
95-
║ TurnTown01-v1 ║ 100 ║ 100/100 ║ 2019 ║
96-
║ TurnTown01-v2 ║ 100 ║ 50/50 ║ 2019 ║
97-
║ TurnTown02-v1 ║ 99 ║ 99/100 ║ 2019 ║
98-
║ TurnTown02-v2 ║ 100 ║ 50/50 ║ 2019 ║
99-
╚═════════════════════╩══════════════╩═════════╩═══════╝
73+
╔═══════════════════╦══════════════╦═════════╦═══════╗
74+
║ Suite Name ║ Success Rate ║ Total ║ Seeds ║
75+
╠═══════════════════╬══════════════╬═════════╬═══════╣
76+
║ FullTown01-v1 ║ 100 ║ 100/100 ║ 2020 ║
77+
║ FullTown01-v2 ║ 100 ║ 50/50 ║ 2020 ║
78+
║ FullTown01-v3 ║ 100 ║ 100/100 ║ 2020 ║
79+
║ FullTown01-v4 ║ 100 ║ 50/50 ║ 2020 ║
80+
║ FullTown02-v1 ║ 100 ║ 100/100 ║ 2020 ║
81+
║ FullTown02-v2 ║ 100 ║ 50/50 ║ 2020 ║
82+
║ FullTown02-v3 ║ 98 ║ 98/100 ║ 2020 ║
83+
║ FullTown02-v4 ║ 100 ║ 50/50 ║ 2020 ║
84+
║ NoCrashTown01-v1 ║ 100 ║ 100/100 ║ 2020 ║
85+
║ NoCrashTown01-v2 ║ 36 ║ 18/50 ║ 2020 ║
86+
║ NoCrashTown01-v3 ║ 96 ║ 96/100 ║ 2020 ║
87+
║ NoCrashTown01-v4 ║ 34 ║ 17/50 ║ 2020 ║
88+
║ NoCrashTown01-v5 ║ 70 ║ 70/100 ║ 2020 ║
89+
║ NoCrashTown01-v6 ║ 26 ║ 13/50 ║ 2020 ║
90+
║ NoCrashTown02-v1 ║ 99 ║ 99/100 ║ 2020 ║
91+
║ NoCrashTown02-v2 ║ 24 ║ 12/50 ║ 2020 ║
92+
║ NoCrashTown02-v3 ║ 87 ║ 87/100 ║ 2020 ║
93+
║ NoCrashTown02-v4 ║ 34 ║ 17/50 ║ 2020 ║
94+
║ NoCrashTown02-v5 ║ 42 ║ 42/100 ║ 2020 ║
95+
║ NoCrashTown02-v6 ║ 18 ║ 9/50 ║ 2020 ║
96+
║ StraightTown01-v1 ║ 100 ║ 100/100 ║ 2020 ║
97+
║ StraightTown01-v2 ║ 100 ║ 50/50 ║ 2020 ║
98+
║ StraightTown02-v1 ║ 100 ║ 100/100 ║ 2020 ║
99+
║ StraightTown02-v2 ║ 100 ║ 50/50 ║ 2020 ║
100+
║ TurnTown01-v1 ║ 100 ║ 100/100 ║ 2020 ║
101+
║ TurnTown01-v2 ║ 100 ║ 50/50 ║ 2020 ║
102+
║ TurnTown02-v1 ║ 100 ║ 100/100 ║ 2020 ║
103+
║ TurnTown02-v2 ║ 100 ║ 50/50 ║ 2020 ║
104+
╚═══════════════════╩══════════════╩═════════╩═══════╝
105+
100106
```
101107

102108
### CARLA Challenge (town02/04/05 with dynamic weather) (ONGOING)
103109

110+
The results there are way below the one above, but note that it was trained on much harder tasks and that
111+
it works also on US towns, i.e. Town03, Town04 and Town05.
112+
104113
```
105114
COMING SOON
106115
```
107116

108117
## License
109-
This repo is released under the MIT License (please refer to the LICENSE file for details). Part of the PythonAPI and the map rendering code is borrowed from the official [CARLA](https://github.com/carla-simulator/carla) repo, which is under MIT license. The image augmentation code is borrowed from [Coiltraine](https://github.com/felipecode/coiltraine) which is released under MIT license.
118+
This repo is released under the MIT License (please refer to the LICENSE file for details).
119+
Most of the code come from the repository
120+
[**Learning by Cheating**](https://github.com/dianchen96/LearningByCheating)
121+
which is under MIT license.
122+
Part of the PythonAPI and the map rendering code is borrowed from the official
123+
[CARLA](https://github.com/carla-simulator/carla) repo, which is under MIT license.

benchmark/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,30 @@ def _add(suite_name, *args, **kwargs):
244244

245245

246246
_aliases = {
247+
"all_suite": [
248+
"NoCrashTown02-v5", "NoCrashTown02-v6",
249+
"NoCrashTown01-v5", "NoCrashTown01-v6",
250+
"NoCrashTown02-v3", "NoCrashTown02-v4",
251+
"NoCrashTown01-v3", "NoCrashTown01-v4",
252+
"NoCrashTown02-v1", "NoCrashTown02-v2",
253+
"NoCrashTown01-v1", "NoCrashTown01-v2",
254+
"FullTown02-v1",
255+
"FullTown02-v2",
256+
"FullTown02-v3",
257+
"FullTown02-v4",
258+
"StraightTown02-v1",
259+
"StraightTown02-v2",
260+
"TurnTown02-v1",
261+
"TurnTown02-v2",
262+
"FullTown01-v1",
263+
"FullTown01-v2",
264+
"FullTown01-v3",
265+
"FullTown01-v4",
266+
"StraightTown01-v1",
267+
"StraightTown01-v2",
268+
"TurnTown01-v1",
269+
"TurnTown01-v2",
270+
],
247271
"town1": [
248272
"FullTown01-v1",
249273
"FullTown01-v2",

benchmark_agent.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import argparse
22
import time
33

4-
# print("test torchvision bug before!")
5-
# import torchvision.models as models
6-
# print("test torchvision bug after!")
4+
# There is a known issue with carla and torch (or torchvision)
5+
# https://www.google.com/url?q=https://github.com/carla-simulator
6+
# /carla/issues/2132&sa=D&source=hangouts&ust=1584205287893000&u
7+
# sg=AFQjCNHYKEjQVb0NQYvsQd3BNMw0smQbyg
8+
# That's why we import torchvision there before anything else
9+
# Note that we found this was freezing when using cuda9.0
10+
# Probably if you encounter freeze, you should comment next line
11+
import torchvision.models as models
712
from pathlib import Path
813

914
from benchmark import make_suite, get_suites, ALL_SUITES
@@ -50,7 +55,7 @@ def run(args, model_path, port, suite, seed, resume, max_run):
5055
)
5156
parser.add_argument("--port", type=int, default=2000)
5257
parser.add_argument("--suite", choices=ALL_SUITES, default="town1")
53-
parser.add_argument("--seed", type=int, default=2019)
58+
parser.add_argument("--seed", type=int, default=2020)
5459
parser.add_argument("--resume", action="store_true")
5560
parser.add_argument("--max-run", type=int, default=100)
5661

bird_view/models/agent_IAs_RL.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ def __init__(self, args=None, **kwargs):
2121
for file in os.listdir(path_to_model_supervised):
2222
if ".pth" in file:
2323
if path_model_supervised is not None:
24-
print(
25-
"There is multiple model supervised in folder ",
26-
path_to_model_supervised,
24+
raise ValueError(
25+
"There is multiple model supervised in folder " +
26+
path_to_model_supervised +
2727
" you must keep only one!",
2828
)
29-
exit(1)
3029
path_model_supervised = os.path.join(path_to_model_supervised, file)
3130
if path_model_supervised is None:
32-
print("We didn't find any model supervised in folder ", path_to_model_supervised)
33-
exit(1)
31+
raise ValueError("We didn't find any model supervised in folder " +
32+
path_to_model_supervised)
3433

3534
# All this magic number should match the one used when training supervised...
3635
model_supervised = Model_Segmentation_Traffic_Light_Supervised(
@@ -54,8 +53,7 @@ def __init__(self, args=None, **kwargs):
5453
tab_model.append(os.path.join(path_to_model_RL, file))
5554

5655
if len(tab_model) == 0:
57-
print("We didn't find any RL model in folder ", path_to_model_RL)
58-
exit(1)
56+
raise ValueError("We didn't find any RL model in folder "+ path_to_model_RL)
5957

6058
self.tab_RL_model = []
6159
for current_model in tab_model:
@@ -109,9 +107,6 @@ def __init__(self, args=None, **kwargs):
109107

110108
self.current_timestep = 0
111109

112-
self.nb_frame_stuck = 0
113-
self.speed_stuck = 5 / 3.6 # 5km/h
114-
115110
def act(self, state_buffer, RL_model):
116111
speeds = []
117112
order = state_buffer[-1].order
@@ -225,16 +220,6 @@ def run_step(self, observations):
225220
else:
226221
brake = brake / len(tab_action)
227222

228-
# This is a little hack to "destuck" agent, sometimes the image is
229-
# always the same and the agent never ever move...
230-
if speed < self.speed_stuck:
231-
self.nb_frame_stuck += 1
232-
else:
233-
self.nb_frame_stuck = 0
234-
if self.current_timestep < 15 or self.nb_frame_stuck > 1000:
235-
brake = 0
236-
throttle = 0.5
237-
238223
control = carla.VehicleControl()
239224
control.steer = np.clip(steer, -1.0, 1.0)
240225
control.throttle = np.clip(throttle, 0.0, 1.0)

0 commit comments

Comments
 (0)