HKUST-Aerial-Robotics / Stereo-RCNN

Code for 'Stereo R-CNN based 3D Object Detection for Autonomous Driving' (CVPR 2019)
MIT License
690 stars 177 forks source link

type error in mono #17

Closed shammmmmless closed 5 years ago

shammmmmless commented 5 years ago

when I run demo in mono version, the error is shown as following:

Traceback (most recent call last): File "demo.py", line 261, in calib, alpha, dim, box_left, cls_kpts[detect_idx]) File "/home/user/Cworkspace/Stereo-RCNN-mono/lib/model/utils/box_estimator.py", line 212, in solve_x_y_z_theta_from_kpt alpha = kpt2alpha(kpt_pos, kpt_type, box_left) File "/home/user/Cworkspace/Stereo-RCNN-mono/lib/model/utils/box_estimator.py", line 159, in kpt2alpha alpha = -m.pi/2 - m.asin(clamp((kpt_pos-box[0])/box_width,-1,1)) # 0 -> -90, 1 -> -180 TypeError: sub() received an invalid combination of arguments - got (numpy.float32), but expected one of:

It was running with python=2.7.6 and pytorch=0.3.0.

PeiliangLi commented 5 years ago

I haven't meet this issue before, could you try to change the line calib, alpha, dim, box_left, cls_kpts[detect_idx]) to calib, alpha, dim, box_left, cls_kpts[detect_idx].cpu().numpy())

shammmmmless commented 5 years ago

It work, but I got a new type error about dense_align now,

Traceback (most recent call last): File "demo.py", line 277, in boxes_all[:,0:4], kpts_all, poses_all[:,0:7]) File "/home/user/Cworkspace/Stereo-RCNN-mono/lib/model/dense_align/dense_align.py", line 264, in align_parallel dis_init = f*bl/poses[:,2] RuntimeError: Expected object of type torch.DoubleTensor but found type torch.cuda.FloatTensor for argument #2 'other'

shammmmmless commented 5 years ago

what the version of torchvision should I use?

PeiliangLi commented 5 years ago

Change f and bl to float Tensor. According to my experience, this error only happens when using pytorch1.0 but not for pytorch0.3.0.post4. Can you print your torch.__version__?

shammmmmless commented 5 years ago

Thanks a lot! The problem is the version of pytorch, the demo was running in the env of conda, but got the pytorch of system, it fixed.