3d-object-detection.pytorch icon indicating copy to clipboard operation
3d-object-detection.pytorch copied to clipboard

All keypoints are negative coefficients

Open datvuthanh opened this issue 2 years ago • 0 comments

Hi sovrasov,

I tested your file test_geometry.py with my keypoints (assume that I have keypoints without prediction from regression model)

"""The 9 3D box landmarks."""
  #
  #       3 + + + + + + + + 7
  #       +\                +\          UP
  #       + \               + \
  #       +  \              +  \        |
  #       +   4 + + + + + + + + 8       | y
  #       +   +             +   +       |
  #       +   +             +   +       |
  #       +   +     (0)     +   +       .------- x
  #       +   +             +   +        \
  #       1 + + + + + + + + 5   +         \
  #        \  +              \  +          \ z
  #         \ +               \ +           \
  #          \+                \+
  #           2 + + + + + + + + 6

0: (1038, 390),1: (1234, 494),2: (980, 440),3: (1234, 314),4: (980, 314),5: (1065, 494),6: (874, 440),7: (1065, 314),8: (874, 314)

Next step, this keypoints normalized with height and width of image (720, 1280, 3):

kps = [[0.8109375  0.54166667]
 [0.9640625  0.68611111]
 [0.765625   0.61111111]
 [0.9640625  0.43611111]
 [0.765625   0.43611111]
 [0.83203125 0.68611111]
 [0.6828125  0.61111111]
 [0.83203125 0.43611111]
 [0.6828125  0.43611111]]

car1 However, I obtained negative keypoints

Lift_2d [[ 0.01794817  0.13540009 -0.45965146]
 [ 0.07006411  0.17127108 -0.37073145]
 [ 0.05996544  0.14408154 -0.53975206]
 [-0.02449168  0.17091188 -0.36957619]
 [-0.03459034  0.14372234 -0.53859681]
 [ 0.07048668  0.12707785 -0.38070612]
 [ 0.06038802  0.09988831 -0.54972673]
 [-0.02406911  0.12671865 -0.37955086]
 [-0.03416777  0.09952911 -0.54857148]]
reprojected_kps [[ 0.07809469  0.58914245]
 [ 0.37797771  0.92396303]
 [ 0.22219626  0.53388045]
 [-0.13253926  0.92490741]
 [-0.12844615  0.53369176]
 [ 0.37029446  0.66759027]
 [ 0.21970194  0.36341078]
 [-0.12682942  0.66772949]
 [-0.12457     0.36286652]]

This is my next step:

x0,y0,x1,y1 = 874,314,1234,494 # (xmin,ymin,xmax,ymax) of my bounding box, i fixed it.
crop_shape = (x1-x0,y1-y0)
reprojected_kps [:,0] = reprojected_kps [:,0]*crop_shape[0]
reprojected_kps [:,1] = reprojected_kps [:,1]*crop_shape[1]
reprojected_kps [:,0] += x0
reprojected_kps [:,1] += y0

Is this wrong? Because I draw this reprojected_kps on my image failed, this is my output:

car2

I want to draw 3d bounding boxes from this keypoints, thank you.

datvuthanh avatar Sep 25 '21 16:09 datvuthanh