Skip to content

Commit

Permalink
[Feature] #64 - Add ability to specify map in Dataset-Generator (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxJa4 authored Nov 20, 2023
1 parent 21e4ef8 commit e844735
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
17 changes: 12 additions & 5 deletions code/perception/src/dataset_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,26 +246,33 @@ def create_argparse():
help='set up an empty world and spawn ego vehicle',
default=False
)
argparser.add_argument(
'--town',
metavar='T',
default='Town12',
help='town to load'
)
return argparser


if __name__ == '__main__':
towns = ["Town01", "Town02", "Town03", "Town04", "Town05", "Town06",
"Town07", "Town10", "Town11", "Town12"]
town = towns[2]
towns = {"Town01", "Town02", "Town03", "Town04", "Town05", "Town06",
"Town07", "Town10", "Town11", "Town12"}
argparser = create_argparse()
args = argparser.parse_args()
town = args.town
output_dir = args.output_dir
host = args.host
port = args.port
use_empty_world = args.use_empty_world

client = carla.Client(host, port)
client.set_timeout(30)
world = client.load_world(town)
world = client.load_world(town) if use_empty_world else client.get_world()
world.wait_for_tick()

output_dir = os.path.join(output_dir, town[-2:])
output_dir = os.path.join(output_dir, world.get_map().name[-2:])
print("Saving images to {}".format(output_dir))

if use_empty_world:
ego_vehicle = setup_empty_world(client)
Expand Down
19 changes: 11 additions & 8 deletions doc/06_perception/01_dataset_generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Korbinian Stein

<!-- TOC -->

* [Dataset generator](#dataset-generator)
* [Author](#author)
* [Date](#date)
* [Necessary adjustments](#necessary-adjustments)
* [Dockerfile](#dockerfile)
* [docker-compose.yml](#docker-composeyml)
* [Usage](#usage)
* [Using with leaderboard](#using-with-leaderboard)
- [Dataset generator](#dataset-generator)
- [Author](#author)
- [Date](#date)
- [Necessary adjustments](#necessary-adjustments)
- [Dockerfile](#dockerfile)
- [docker-compose.yml](#docker-composeyml)
- [Usage](#usage)
- [Using with leaderboard](#using-with-leaderboard)

<!-- TOC -->

Expand Down Expand Up @@ -103,6 +103,9 @@ camera images in four directions: `[center, left, right, back]`.
We then store these images in the output directory can be specified with the `--output-dir`
flag.

Specify the desired map via `--town` and use `TownXX` with XX being 01, 02, ..., 07, 10, 11, 12.
Default value is `Town12` like used in leaderboard 2.0.

### Using with leaderboard

To use the dataset generator with the leaderboard, first start the leaderboard evaluation by adjusting the command in
Expand Down

0 comments on commit e844735

Please sign in to comment.