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

NameError: free variable 'gfk' referenced before assignment #18

Closed cxzhou95 closed 5 years ago

cxzhou95 commented 5 years ago

I train stereo rcnn with my customized train.txt and test with customized val.txt.

Everything seems ok and i can see the predicted 3D results and predicted txts in dir 'result'

But when testing 002160.png, error occurs:

Traceback (most recent call last):, solve time 0.23s (Press Esc to exit!) File "test_net.py", line 294, in calib, alpha, dim, box_left, box_right, cls_kpts[detect_idx]) File "/media/yazhou/data_drive2/zcx/Stereo-RCNN/lib/model/utils/box_estimator.py", line 381, in solve_x_y_z_theta_from_kpt res = minimize(f_kpt, [init_x,init_y,init_z, init_theta], method ='Newton-CG', jac=j_kpt, options={'disp': False}) File "/usr/local/lib/python2.7/dist-packages/scipy/optimize/_minimize.py", line 447, in minimize **options) File "/usr/local/lib/python2.7/dist-packages/scipy/optimize/optimize.py", line 1538, in _minimize_newtoncg return terminate(3, msg) File "/usr/local/lib/python2.7/dist-packages/scipy/optimize/optimize.py", line 1458, in terminate result = OptimizeResult(fun=fval, jac=gfk, nfev=fcalls[0], NameError: free variable 'gfk' referenced before assignment in enclosing scope

And my scipy version is 0.19.0

PeiliangLi commented 5 years ago

Sorry, I forgot to mention this. This is probably a bug in /usr/local/lib/python2.7/dist-packages/scipy/optimize/optimize.py. Adding gfk = None before this line result = OptimizeResult(fun=fval, jac=gfk, nfev=fcalls[0], in your python2.7/dist-packages/scipy/optimize/optimize.py should solve this.

cxzhou95 commented 5 years ago

Sorry, I forgot to mention this. This is probably a bug in /usr/local/lib/python2.7/dist-packages/scipy/optimize/optimize.py. Adding gfk = None before this line result = OptimizeResult(fun=fval, jac=gfk, nfev=fcalls[0], in your python2.7/dist-packages/scipy/optimize/optimize.py should solve this.

Thanks for your reply! I find that scipy (version 0.12.0) solves this problem.