DerrickXuNu / OpenCOOD

[ICRA 2022] An opensource framework for cooperative detection. Official implementation for OPV2V.
https://mobility-lab.seas.ucla.edu/opv2v/
Other
674 stars 100 forks source link

Error when running inference on OPV2V #132

Closed darkdevahm closed 4 months ago

darkdevahm commented 7 months ago

I'm getting this error when running the inference of OPV2V, any solutions?

024-04-23T02:49:00.507847590+02:00 Traceback (most recent call last): 2024-04-23T02:49:00.507892634+02:00 File "/OpenCOOD/opencood/tools/inference.py", line 208, in 2024-04-23T02:49:00.508219127+02:00 main() 2024-04-23T02:49:00.508255446+02:00 File "/OpenCOOD/opencood/tools/inference.py", line 103, in main 2024-04-23T02:49:00.508320422+02:00 for i, batch_data in tqdm(enumerate(data_loader)): 2024-04-23T02:49:00.508338101+02:00 File "/opt/conda/lib/python3.11/site-packages/tqdm/std.py", line 1181, in iter 2024-04-23T02:49:00.508542706+02:00 for obj in iterable: 2024-04-23T02:49:00.508582981+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 631, in next 2024-04-23T02:49:00.508686516+02:00 data = self._next_data() 2024-04-23T02:49:00.508700048+02:00 ^^^^^^^^^^^^^^^^^ 2024-04-23T02:49:00.508705197+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 1346, in _next_data 2024-04-23T02:49:00.508915519+02:00 return self._process_data(data) 2024-04-23T02:49:00.508927837+02:00 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-23T02:49:00.508933553+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 1372, in _process_data 2024-04-23T02:49:00.509141153+02:00 data.reraise() 2024-04-23T02:49:00.509156102+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/_utils.py", line 722, in reraise 2024-04-23T02:49:00.509260523+02:00 raise exception 2024-04-23T02:49:00.509378498+02:00 KeyError: Caught KeyError in DataLoader worker process 7. 2024-04-23T02:49:00.509399447+02:00 Original Traceback (most recent call last): 2024-04-23T02:49:00.509405903+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop 2024-04-23T02:49:00.509411838+02:00 data = fetcher.fetch(index) 2024-04-23T02:49:00.509417424+02:00 ^^^^^^^^^^^^^^^^^^^^ 2024-04-23T02:49:00.509423403+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch 2024-04-23T02:49:00.509428763+02:00 data = [self.dataset[idx] for idx in possibly_batched_index] 2024-04-23T02:49:00.509434024+02:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-23T02:49:00.509439057+02:00 File "/opt/conda/lib/python3.11/site-packages/torch/utils/data/_utils/fetch.py", line 51, in 2024-04-23T02:49:00.509444307+02:00 data = [self.dataset[idx] for idx in possibly_batched_index] 2024-04-23T02:49:00.509449184+02:00 ~~~~^^^^^ 2024-04-23T02:49:00.509453968+02:00 File "/OpenCOOD/opencood/data_utils/datasets/intermediate_fusion_dataset.py", line 57, in getitem 2024-04-23T02:49:00.509459167+02:00 base_data_dict = self.retrieve_base_data(idx, 2024-04-23T02:49:00.509463970+02:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-23T02:49:00.509469214+02:00 File "/OpenCOOD/opencood/data_utils/datasets/basedataset.py", line 236, in retrieve_base_data 2024-04-23T02:49:00.509474604+02:00 self.calc_dist_to_ego(scenario_database, timestamp_key) 2024-04-23T02:49:00.509479567+02:00 File "/OpenCOOD/opencood/data_utils/datasets/basedataset.py", line 335, in calc_dist_to_ego 2024-04-23T02:49:00.509484463+02:00 load_yaml(cav_content[timestamp_key]['yaml'])['lidar_pose'] 2024-04-23T02:49:00.509490850+02:00 ~~~^^^^^^^^^^^^^^^ 2024-04-23T02:49:00.509495720+02:00 KeyError: '000297'

RadetzkyLi commented 5 months ago

This means there is no recordings for given timestamp "000297" for given agent. Due to the data of OPV2V is streamed at 20Hz and saved at 10Hz, the minimum gap of two timestamps is 2. If I remember right, all timestamps are even numbers. You can check whether data of that timestamp "000297" exists first and then revise your code.

DerrickXuNu commented 4 months ago

@RadetzkyLi Thanks for helping answer the issue! I will close it for now.