hustvl / VAD

[ICCV 2023] VAD: Vectorized Scene Representation for Efficient Autonomous Driving
https://arxiv.org/abs/2303.12077
Apache License 2.0
729 stars 78 forks source link

"AttributeError: 'numpy.int64' object has no attribute 'intersects'" occurs in Eval VAD with 1 GPU. #29

Open h-enomoto opened 1 year ago

h-enomoto commented 1 year ago

Hello, I executed the command provided under the "Eval VAD with 1 GPU" section.

CUDA_VISIBLE_DEVICES=0 python tools/test.py projects/configs/VAD/VAD_tiny_stage_2.py ckpts/VAD_tiny.pth --launcher none --eval bbox --tmpdir tmp

Unfortunately, this resulted in an error.

(vad) user1@Dev-VAD1:~/VAD$ CUDA_VISIBLE_DEVICES=0 python tools/test.py projects/configs/VAD/VAD_tiny_stage_2.py ckpts/VAD_tiny.pth --launcher none --eval bbox --tmpdir tmp
projects.mmdet3d_plugin
WARNING!!!!, Only can be used for obtain inference speed!!!!
load checkpoint from local path: ckpts/VAD_tiny.pth
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 6019/6019, 4.3 task/s, elapsed: 1408s, ETA:     0s

-------------- Motion Prediction --------------
EPA_car: 0.5979698954582917
EPA_pedestrian: 0.2899953466728711
ADE_car: 0.7861005663871765
ADE_pedestrian: 0.7497814297676086
FDE_car: 1.0742214918136597
FDE_pedestrian: 0.9481362700462341
MR_car: 0.12110871647509579
MR_pedestrian: 0.09436777321894815

-------------- Planning --------------
gt_car:4.503418636452432
gt_pedestrian:2.099042781793319
cnt_ade_car:3.428990037116624
cnt_ade_pedestrian:1.1787458487985936
cnt_fde_car:3.2631373315100607
cnt_fde_pedestrian:1.0474702090252002
hit_car:2.867942957608908
hit_pedestrian:0.9486227778863059
fp_car:0.29537018949013477
fp_pedestrian:0.5645633912873608
ADE_car:2.779588460922241
ADE_pedestrian:0.9012919068336487
FDE_car:3.5053319931030273
FDE_pedestrian:0.9931445121765137
MR_car:0.3951943739011526
MR_pedestrian:0.09884743113889431
plan_L2_1s:0.46259508332890253
plan_L2_2s:0.7633048048435623
plan_L2_3s:1.1213415226114143
plan_obj_col_1s:0.0
plan_obj_col_2s:4.883766360617308e-05
plan_obj_col_3s:6.511688674886516e-05
plan_obj_box_col_1s:0.0020511818714592693
plan_obj_box_col_2s:0.0034674741160382887
plan_obj_box_col_3s:0.005860519728802172
fut_valid_flag:1.0

Formating bboxes of pts_bbox
Start to convert detection format...
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 6019/6019, 48.7 task/s, elapsed: 124s, ETA:     0s
data/nuscenes/nuscenes_map_anns_val.json exist, not update
Results writes to test/VAD_tiny_stage_2/Wed_Oct_18_08_58_40_2023/pts_bbox/results_nusc.pkl
Evaluating bboxes of pts_bbox
mAP: 0.2698                                                                                                                      
mATE: 0.7011
mASE: 0.2976
mAOE: 0.6341
mAVE: 0.6111
mAAE: 0.2085
NDS: 0.3896
Eval time: 37.8s

Per-class results:
Object Class    AP  ATE ASE AOE AVE AAE
car 0.528   0.447   0.155   0.061   0.579   0.293
truck   0.210   0.644   0.229   0.150   0.601   0.335
bus 0.373   0.728   0.267   0.104   0.702   0.168
trailer 0.017   0.987   0.324   1.146   0.815   0.090
construction_vehicle    0.110   0.955   0.511   1.480   0.283   0.361
pedestrian  0.322   0.644   0.298   0.631   0.476   0.208
motorcycle  0.150   0.701   0.251   0.778   1.217   0.208
bicycle 0.231   0.579   0.276   1.231   0.216   0.005
traffic_cone    0.412   0.604   0.362   nan nan nan
barrier 0.345   0.724   0.303   0.127   nan nan
Formating results & gts by classes
results path: /home/user1/VAD/test/VAD_tiny_stage_2/Wed_Oct_18_08_58_40_2023/pts_bbox/results_nusc.pkl
Formatting ...
Cls data formatting done in 100.399740s!! with /home/user1/VAD/test/VAD_tiny_stage_2/Wed_Oct_18_08_58_40_2023/pts_bbox/cls_formatted.pkl
-*-*-*-*-*-*-*-*-*-*use metric:chamfer-*-*-*-*-*-*-*-*-*-*
-*-*-*-*-*-*-*-*-*-*threshhold:0.5-*-*-*-*-*-*-*-*-*-*
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/user1/miniconda3/envs/vad/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/user1/miniconda3/envs/vad/lib/python3.8/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/home/user1/VAD/projects/mmdet3d_plugin/datasets/map_utils/tpfp.py", line 338, in custom_tpfp_gen
    matrix = custom_polyline_score(
  File "/home/user1/VAD/projects/mmdet3d_plugin/datasets/map_utils/tpfp_chamfer.py", line 257, in custom_polyline_score
    if o.intersects(pline):
AttributeError: 'numpy.int64' object has no attribute 'intersects'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "tools/test.py", line 294, in <module>
    main()
  File "tools/test.py", line 274, in main
    print(dataset.evaluate(outputs['bbox_results'], **eval_kwargs))
  File "/home/user1/VAD/projects/mmdet3d_plugin/datasets/nuscenes_vad_dataset.py", line 1821, in evaluate
    ret_dict = self._evaluate_single(result_files[name], metric=metric, map_metric=map_metric)
  File "/home/user1/VAD/projects/mmdet3d_plugin/datasets/nuscenes_vad_dataset.py", line 1706, in _evaluate_single
    mAP, cls_ap = eval_map(
  File "/home/user1/VAD/projects/mmdet3d_plugin/datasets/map_utils/mean_ap.py", line 256, in eval_map
    tpfp = pool.starmap(
  File "/home/user1/miniconda3/envs/vad/lib/python3.8/multiprocessing/pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/home/user1/miniconda3/envs/vad/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
AttributeError: 'numpy.int64' object has no attribute 'intersects'

I encountered difficulties while attempting to install the dependencies from requirements.txt using pip or conda in its original form. Consequently, I crafted an environment.yml file and successfully created the environment using conda. I have ensured that the version of numpy aligns with the one specified in requirements.txt.

(vad) user1@Dev-VAD1:~/VAD$ conda list -v numpy
# packages in environment at /home/user1/miniconda3/envs/vad:
#
# Name                    Version                   Build  Channel
numpy                     1.19.5                   pypi_0    pypi

I am reaching out for guidance on how to rectify this error, as my efforts to find a resolution have been unfruitful so far. Although there have been similar issue, it appears that they remain unresolved, prompting me to seek assistance through this issue.

I would greatly appreciate any advice or instructions you could provide to help resolve this issue.

Best regards.

talentCODE commented 1 year ago

I met the same problem as you. Have you solved this issue?

h-enomoto commented 1 year ago

It has not yet been resolved. It is not working properly very well.

talentCODE commented 1 year ago

for i, pline in enumerate(gt_lines_shapely): for o in tree.query(pline): if tree.geometries[o].intersects(pline): pred_id = index_by_id[id(tree.geometries[o])]
you can modify the code like above

buaazeus commented 1 year ago

for i, pline in enumerate(gt_lines_shapely): for o in tree.query(pline): if tree.geometries[o].intersects(pline): pred_id = index_by_id[id(tree.geometries[o])] you can modify the code like above

It works. Thanks.

h-enomoto commented 1 year ago

@talentCODE Your advice made it work correctly. Thank you for your help!

ZhouYC-X commented 7 months ago

May be is another solution: pip install Shapely==1.8.5