Files
scenarionet/scenarionet/scripts/convert_nuscenes.py

37 lines
1.5 KiB
Python
Raw Normal View History

2023-05-08 13:26:41 +01:00
import argparse
2023-05-06 16:59:17 +01:00
import os.path
2023-05-06 14:36:44 +01:00
2023-05-06 16:45:06 +01:00
from scenarionet import SCENARIONET_DATASET_PATH
2023-05-06 20:33:47 +01:00
from scenarionet.converter.nuscenes.utils import convert_nuscenes_scenario, get_nuscenes_scenarios
2023-05-06 16:45:06 +01:00
from scenarionet.converter.utils import write_to_directory
2023-05-06 14:12:10 +01:00
2023-05-08 13:26:41 +01:00
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--dataset_name", "-n", default="nuscenes",
help="Dataset name, will be used to generate scenario files")
parser.add_argument("--dataset_path", "-d", default=os.path.join(SCENARIONET_DATASET_PATH, "nuscenes"),
help="The path of the dataset")
2023-05-08 13:39:11 +01:00
parser.add_argument("--version", "-v", default='v1.0-mini', help="version")
2023-05-08 13:26:41 +01:00
parser.add_argument("--overwrite", action="store_true", help="If the dataset_path exists, overwrite it")
2023-05-08 16:26:26 +01:00
parser.add_argument("--num_workers", type=int, default=8, help="number of workers to use")
2023-05-08 13:26:41 +01:00
args = parser.parse_args()
force_overwrite = args.overwrite
dataset_name = args.dataset_name
output_path = args.dataset_path
version = args.version
2023-05-06 19:16:44 +01:00
2023-05-06 20:33:47 +01:00
dataroot = '/home/shady/data/nuscenes'
scenarios, nusc = get_nuscenes_scenarios(dataroot, version)
2023-05-06 16:59:17 +01:00
2023-05-06 22:10:58 +01:00
write_to_directory(
convert_func=convert_nuscenes_scenario,
scenarios=scenarios,
output_path=output_path,
dataset_version=version,
dataset_name=dataset_name,
force_overwrite=force_overwrite,
2023-05-08 16:26:26 +01:00
nuscenes=nusc,
num_workers=args.num_workers
2023-05-06 22:10:58 +01:00
)