metadriverse / scenarionet

ScenarioNet: Scalable Traffic Scenario Management System for Autonomous Driving

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bugs met while converting nuscenes scnenarios

chrisgao99 opened this issue · comments

Hello,

I'm trying to convert nuscenes scenarios

python -m scenarionet.convert_nuscenes -d ../nuscenes --dataroot data/sets/nuscenes --split v1.0-mini --num_workers 1

However, an error is raised from

https://github.com/metadriverse/scenarionet/blob/main/scenarionet/converter/nuscenes/utils.py

The full error message is

Traceback (most recent call last):
  File "/p/yufeng/.conda/envs/convsenv/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/p/yufeng/INTP/scenarionet/scenarionet/converter/utils.py", line 154, in writing_to_directory_wrapper
    return write_to_directory_single_worker(
  File "/p/yufeng/INTP/scenarionet/scenarionet/converter/utils.py", line 223, in write_to_directory_single_worker
    sd_scenario = convert_func(scenario, dataset_version, **kwargs)
  File "/p/yufeng/INTP/scenarionet/scena
![Screenshot 2024-05-29 at 3 20 29 PM](https://github.com/metadriverse/scenarionet/assets/68575272/998ed9db-8678-48f9-9ece-f111f5798446)
![Screenshot 2024-05-29 at 3 20 29 PM](https://github.com/metadriverse/scenarionet/assets/68575272/998ed9db-8678-48f9-9ece-f111f5798446)
![Screenshot 2024-05-29 at 3 20 29 PM](https://github.com/metadriverse/scenarionet/assets/68575272/998ed9db-8678-48f9-9ece-f111f5798446)
rionet/converter/nuscenes/utils.py", line 481, in convert_nuscenes_scenario
    track_to_predict = result[SD.TRACKS][instance_token]
UnboundLocalError: local variable 'instance_token' referenced before assignment

I have tested the downloaded data with the nuscenes_tutorial.ipynb and here is how my data dir looks like:

/p/yufeng/INTP/scenarionet/data/sets/nuscenes$ ls
can_bus  nuScenes-map-expansion-v1  sweeps
maps     samples                    v1.0-mini

May I ask how to solve this error?

Besides, can I convert and replay a scenario from nuscenes with scene id or token specified?

For example, Here is the metadata of a scenario from nuscenes v1.0-trainval dataset

{
"token": "bebf5f5b2a674631ab5c88fd1aa9e87a",
"log_token": "6f7fe59adf984e55a82571ab4f17e4e2",
"nbr_samples": 41,
"first_sample_token": "5991fad3280c4f84b331536c32001a04",
"last_sample_token": "35833ae5808e4ef186d1fdebac3d9cf6",
"name": "scene-0655",
"description": "Parking lot, parked cars, jaywalker, bendy bus, gardening vehicles"
},

Can I use the token or name to convert a specified scenario and replay it with Scenarionet?

Hi @chrisgao99

I can not reproduce this problem from my side... I even redownload the nuscenes data. I suspect the scenarionet you are using is not the latest. I find the line raising bug is line 481 in nuscenes/utils.py, but this line should be an empty line in the latest version. Could you try reinstall everything or pull the latest main branch?

For the second qeustion, yes, you can do that with nuscenes/utils/convert_nuscenes_scenario. This function is repeatedly and parallelly called in python convert_nuscenes.py to convert many scenarios together. So you can call it for any specific nuscenes scenario to convert it to scenarioNet format.

Oh yes, thank you for the help.