Owen-Liuyuxuan / visualDet3D

Official Repo for Ground-aware Monocular 3D Object Detection for Autonomous Driving / YOLOStereo3D: A Step Back to 2D for Efficient Stereo 3D Detection
https://owen-liuyuxuan.github.io/papers_reading_sharing.github.io/3dDetection/GroundAwareConvultion/
Apache License 2.0
362 stars 77 forks source link

测试多个类别的时候报错 #31

Closed shliang0603 closed 2 years ago

shliang0603 commented 2 years ago

@Owen-Liuyuxuan 你好,我在测试只有Car一个类别的时候没有问题,然后我想测试3个类别,就按照你上面的提示,在Yolo3D_example.py文件中修改了对应的三行代码,然后报错如下:

(yolov4) shl@zhihui-mint:~/Disk2/3_proj/visualDet3D$ ./launchers/eval.sh config/Yolo3D_example.py 0 workdirs/Mono3D/checkpoint/GroundAware_pretrained.pth test
CUDA available: True
Traceback (most recent call last):
  File "scripts/eval.py", line 55, in <module>
    fire.Fire(main)
  File "/home/shl/anaconda3/envs/yolov4/lib/python3.6/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/shl/anaconda3/envs/yolov4/lib/python3.6/site-packages/fire/core.py", line 471, in _Fire
    target=component.__name__)
  File "/home/shl/anaconda3/envs/yolov4/lib/python3.6/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "scripts/eval.py", line 37, in main
    detector = DETECTOR_DICT[cfg.detector.name](cfg.detector)
  File "/media/shl/2b7567a9-ed41-40af-8673-4d47b46a0f32/home/zhihui/Disk2/3_proj/visualDet3D/visualDet3D/networks/detectors/yolomono3d_detector.py", line 65, in __init__
    self.build_head(network_cfg)
  File "/media/shl/2b7567a9-ed41-40af-8673-4d47b46a0f32/home/zhihui/Disk2/3_proj/visualDet3D/visualDet3D/networks/detectors/yolomono3d_detector.py", line 137, in build_head
    **(network_cfg.head)
  File "/media/shl/2b7567a9-ed41-40af-8673-4d47b46a0f32/home/zhihui/Disk2/3_proj/visualDet3D/visualDet3D/networks/heads/detection_3d_head.py", line 32, in __init__
    self.anchors = Anchors(preprocessed_path=preprocessed_path, readConfigFile=read_precompute_anchor, **anchors_cfg)
  File "/media/shl/2b7567a9-ed41-40af-8673-4d47b46a0f32/home/zhihui/Disk2/3_proj/visualDet3D/visualDet3D/networks/heads/anchors.py", line 36, in __init__
    self.anchors_mean_original[i]  = np.load(npy_file) #[30, 2, 6] #[z,  sinalpha, cosalpha, w, h, l,]
ValueError: could not broadcast input array from shape (16,2,6) into shape (16,3,6)
(yolov4) shl@zhihui-mint:~/Disk2/3_proj/visualDet3D$ 

请问这个错误是需要修改anchor_mean_Car.npyanchor_std_Car.npy 这两个文件吗,我目前不知道怎么解决这个问题,还希望你可以抽空帮忙一下,谢谢啦

Originally posted by @shliang0603 in https://github.com/Owen-Liuyuxuan/visualDet3D/issues/17#issuecomment-897407923

Owen-Liuyuxuan commented 2 years ago

您是用我1.0给的两个npy文件吗?这两个npy文件设定的是专供车子的anchor 配置, ratios只有两个。您的代码报错说的似乎是Config里面用了不一样的anchor配置。这样需要重跑 det_precompute甚至重新训练?

shliang0603 commented 2 years ago

非常感谢你的及时回复。是的,我用的是1.0中的两个npy文件,修改类别相关的3行代码后,重新跑了det_precompute,然后报的错误。我现在想要检测pedestrian必须要重新训练吗,如果不需要重新训练,需要做哪些调整可以运行起来

Owen-Liuyuxuan commented 2 years ago

新增分类的话,是需要重新训练的。

shliang0603 commented 2 years ago

好的,谢谢