songdejia / Siamese-RPN-pytorch

This is a re-implementation of Siamese-RPN with pytorch, which is CVPR2018 spotlight.
MIT License
379 stars 87 forks source link

I have a trouble about np.log #28

Open mshmoon opened 5 years ago

mshmoon commented 5 years ago

Thank you for you to contribute your code. I have a question ask for you help. When use your code_1.0 to train vot2016 dataset. I meet an error. I print the values of relate code -0.99 [ 35.960415 44.26483 63.01 ... 63.01 89.51967 109.86125 ] [[-0.14122681 -0.14122681 -0.00901137 -0.02753027] [-0.14122681 -0.14122681 -0.01105902 -0.02236539] [-0.14122681 -0.14122681 -0.01571179 -0.01571179]] /home/xiaoma/Siamese-RPN-pytorch/code_v1.0/data_loader.py:60: RuntimeWarning: invalid value encountered in log diff[:,3] = np.log((gt[3] + eps)/(anchors[:,3] + eps))

I think the reason is np.log meet negative values. So how to solve the trouble about negative values

mshmoon commented 5 years ago

For solve this error. I have add this code x1, y1, x2, y2 = cords_in_cropped_resized_detection cx, cy, w, h = (x1+x2)//2, (y1+y2)//2, x2-x1, y2-y1 cx,cy,w,h = max(0,cx),max(0,cy),max(0,w),max(0,h)#### This code is mine