dougsm / ggcnn

Generative Grasping CNN from "Closing the Loop for Robotic Grasping: A Real-time, Generative Grasp Synthesis Approach" (RSS 2018)
BSD 3-Clause "New" or "Revised" License
484 stars 138 forks source link

fix angle difference calculation (close to pi/2 and -pi/2) for iou re… #15

Closed lwohlhart closed 4 years ago

lwohlhart commented 4 years ago

Hello Doug, first of all thank you for your amazing work.

I think there's a hiccup in the IoU calculation for grasps. Your implementation currently returns 0.0 IoU when comparing grasps with groudtruth_angles close to pi/2 or -pi/2 if the estimated_grasp_angle is close to -pi/2 or pi/2 respectively. If I'm not mistaken those estimated grasps should be accepted since they are essentially encoding the same (just mirrored) grasp configuration.

e.g.:

ground_truth_angle = 1.57                                                                                                                         
estimated_angle = -1.57                                                                                                                           

abs(ground_truth_angle - estimated_angle) % np.pi                                                                                                 
3.14

abs((ground_truth_angle - estimated_angle + np.pi/2) % np.pi - np.pi/2)                                                                           
0.0015926535897925476

hth :-) I hope you, continue your great efforts

dougsm commented 4 years ago

Hi Lucas, great catch and thanks for fixing! :+1: