fuenwang / 3D-BoundingBox

PyTorch implementation for 3D Bounding Box Estimation Using Deep Learning and Geometry
130 stars 39 forks source link

a bad result, training loss erro #4

Closed Patickk closed 6 years ago

Patickk commented 6 years ago

thank you so much for your code, but the loss is always not convergent,

and i test the result , its still bad,

so ...may i know how many epochs you have trained and the change of the loss?

that will be very helpful

fuenwang commented 6 years ago

Actually I forgot the setting, but my evaluation error for angle is about only 6 degree. My pytorch version is 0.3.0, do you use 0.4.0? because I haven't test on the new version.

Patickk commented 6 years ago

@fuenwang Thank you so much for answering me so quickly!!! thank god!
my test angle_error is about 70, emmmmm.....forget it.. I used 0.4 and made some code upgrades. Thanks for reminding me, I'll try 0.3. Recently, I have tried several codes in implementing Multibin-3DBB. I think your code should be the best and implement the multibin method. I've tried the code of tensorflow in your Readme. But the definition of angle is hard for me to understand.And i trained his code , the oriention loss is not good.I also wrote some code to visualize his result, its still bad. (https://github.com/smallcorgi/3D-Deepbox) In his issues, many people and i do not understand his definition of angle. Can I ask you about that?

fuenwang commented 6 years ago

I'm not sure what angle you mean, could you point out which angle in that repo?

In my implementation, there are two kind of angle. The first is the orientation of object and the second one is the angle need to be added to the reference angle of each bin.

Patickk commented 6 years ago

in his data_processing.py https://github.com/smallcorgi/3D-Deepbox/blob/master/data_processing.py here are some question:

  1. line 14-27, def compute anchors(angle) ... ;the author said , the angle is the local orientation (https://github.com/smallcorgi/3D-Deepbox/issues/12) but chek his code, this angle is only the Alpha + pi/2 (Alpha = kitti_label(line[3]) . code line 43-46 I really cant understand what his is talking about, i also asked him ,but he just disappear. Help me ......

  2. Let us suppose the angle = LocalAngle, which should be LocalAngle = 360 - (ThetaRay + Ry): I thinke the fuction def compute anchors() is same as your code in Dataset.py line 112 - 122. why we need to compute wedge/2 or intervalAngle /2 ... so, what his function means?? And can you also explain your code? thank you so much for your help!

fuenwang commented 6 years ago
  1. According to the document of KITTI, alpha is observation angle, but I never use it and not sure what exactly this is. For the anchors ([l_index, angle - l_index*wedge]), I think he wants to find which bin the local orientation is located at. So he will find the index and the angle which need to be added to the center of bins.

  2. Because we need to calculate the relative angle to the center of bin. So if the interval of bins is 90 degree. We will need to divide by 45 degree to make sure the relative angle is larger or smaller than the bin center. I think the overall idea is this. According to the paper, ThetaRay + Ry is the local angle. I subtract it by 360 just for changing the sign.

fuenwang commented 6 years ago

After I train the model with pytorch 0.4.0 and use my default config.yaml, I got the eval result. I think there is nothing wrong. image

This is my model, could you try to load it and run Eval.py? Link

Patickk commented 6 years ago

You are so nice ! I will try the model and read your code again. I really appreciated your timely help! And I think i will need your help next week , have a nice weekend bro : )

Patickk commented 6 years ago

hi~ I tried your model ,and i got the same result, thank you ~ And, here is my new question:

  1. At the first time I tried to train last week, I only trained 1 epoch, because your orientition loss is not convergence, and that model got a bad result, you know ... haha... So ,after I got your model , I got the same result. And I trained 15 epoches, but the orientition loss is still not convergence... the confidence loss is convergence very well~ Why the o_loss not?
  2. I check your code, and what is the definition of your Localangle? You said : According to the paper, ThetaRay + Ry is the local angle. cos( θ_l ) = cos( θ_ray + R(θ) ) But ,I only find orientation car theta is equal theta_ray + thet_loacal in Figure 3. I think the formual is : cos( R(θ) ) = cos ( θ_ray + θ_l ) according to the paper R(θ) = the global orientation, kitti_lable,line[14] θ_ray = arctan2(z/x) , θ_l = theta_local
  3. thank you my friend, and are you a student?
fuenwang commented 6 years ago
  1. That is weird, because I can converge. Are you sure you didn't change my code and download the correct data? Btw my environment is Ubuntu16.04 Python 2.7.14 Pytorch 0.4.0

  2. According to KITTI document, Ry is theta in Fig.3. And LocalAngle is theta_l. So -theta_l = theta_ray - Ry, but the y-axis is from top to bottom so I need to add minus sign to the Ry. So -theta_l = theta_ray + Ry and then i inverse the direction of theta_l by 360 - theta_l. It's not elegant coding haha.

  3. Yes, I am studying master degree now.

fuenwang commented 6 years ago

BTW, the minimum loss will be -1 not 0 because I use cosine distance. You can try to evaluate it maybe the result is reasonable.

Patickk commented 6 years ago

为了表示感谢,我用中文来感谢你,你太棒了!amazing! I have already got your code. So, do you have a job now?

fuenwang commented 6 years ago

You're welcome! No, any recommend job? haha

Patickk commented 6 years ago

Because I'm also looking for a job, so... Hahahahaah Your skill is very good. I know that in China, if you go to Beijing, such as Alibaba and Tencent, you will get an annual salary of 400-600,000RMB as an algorithm engineer in first year. I went to Taiwan 5 years ago, and I like Kenting very much. My college roommate is a Taiwanese, too. He often says 干你娘, I really miss the college time~ Thank you again, and wish you a good job!