Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
shliang0603 opened this issue Aug 12, 2021 · 4 comments
Closed

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

shliang0603 opened this issue Aug 12, 2021 · 4 comments

Comments

@shliang0603
Copy link

@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 #17 (comment)

@Owen-Liuyuxuan
Copy link
Owner

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

@shliang0603
Copy link
Author

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

@Owen-Liuyuxuan
Copy link
Owner

Owen-Liuyuxuan commented Aug 12, 2021

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

@shliang0603
Copy link
Author

好的,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants