Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get detection boxes from detection_3d_vehicle_detection_train.bin? #142

Closed
seoho-kang opened this issue Apr 24, 2020 · 12 comments
Closed

Comments

@seoho-kang
Copy link

Hi, I'm doing 3D tracking and I wanted to get prediction_boxes form this file
detection_3d_vehicle_detection_train.bin

How can I get position and orientation, size of the boxes from the file?

@peisun1115
Copy link
Contributor

peisun1115 commented Apr 24, 2020

It is the same format as our submission proto.

You can read it with:

f = open("you_file_path")
proto_str = f.read()
submission_proto = waymo_open_dataset.Submission()
CHECK(submission_proto.ParseFromString(proto_str))
// Then find boxes in submission_proto

@seoho-kang
Copy link
Author

I quickly followed the snippet. It said waymo_open_dataset doesn't have Submission attribute. Do I have to use create_prediction_file_example.py ??? If not, can you please explain bit more?

@peisun1115
Copy link
Contributor

it is waymo_open_dataset.protos.Submission.

@seoho-kang
Copy link
Author

seoho-kang commented Apr 25, 2020

I get the 959522292 output.
submission_proto.ParseFromString(proto_str)
print(submission_proto)
#959522292

However, if I print inference_results I get empty list. I didn't understand what the pretrained object detection binary file exactly does. Do I have to import each frame(dataset = tf.data.TFRecordDataset(FILENAME, compression_type='')
) and then run the code you mentioned not to get empty array?

Or do you think it's the problem of compile??

@peisun1115
Copy link
Contributor

@droneRL2020 I am sorry. It is actually of proto waymo_open_dataset.protos.Objects.

I've just tried it on my own and it worked.

@Nuri-benbarka
Copy link

it is waymo_open_dataset.protos.Submission.

@peisun1115 I am also trying to get the detections, and I ran the code you wrote above but in every case, it tells me:
AttributeError: module 'waymo_open_dataset.protos' has no attribute 'Objects'
AttributeError: module 'waymo_open_dataset.protos' has no attribute 'Submission'
what did I do wrong?

@bilalsattar
Copy link

bilalsattar commented Apr 25, 2020

Here is a code snippet to read boxes and other attributes

  from waymo_open_dataset.protos import metrics_pb2
  objects = metrics_pb2.Objects()

  f = open('detection_3d_vehicle_detection_validation.bin', 'rb')
  objects.ParseFromString(f.read())
  f.close()

  for object in objects.objects:
    type = __type_list[object.object.type]
    height = object.object.box.height
    width = object.object.box.width
    length = object.object.box.length
    score = object.score
    x = object.object.box.center_x
    y = object.object.box.center_y
    z = object.object.box.center_z
    rotation_z = object.object.box.heading
    beta = math.atan2(x, z)
    alpha = (rotation_z + beta - math.pi / 2) % (2 * math.pi)

@Nuri-benbarka
Copy link

it is waymo_open_dataset.protos.Submission.

@peisun1115 I am also trying to get the detections, and I ran the code you wrote above but in every case, it tells me:
AttributeError: module 'waymo_open_dataset.protos' has no attribute 'Objects'
AttributeError: module 'waymo_open_dataset.protos' has no attribute 'Submission'
what did I do wrong?

to solve my problem, I saw issue #35 then I ran the following commands:
protoc ./waymo_open_dataset/protos/metrics.proto --python_out=.
protoc ./waymo_open_dataset/protos/breakdown.proto --python_out=.
protoc ./waymo_open_dataset/protos/submission.proto --python_out=.

then I tried the code provided by @bilalsattar and it worked.

@jiangzhengkai
Copy link

@bilalsattar What's your meaning for rotation_y?

@bilalsattar
Copy link

bilalsattar commented Apr 30, 2020

Actually it is rotation along z-axis not along the y-axis (I have changed it). This is the heading direction of the vehicle or how much the bounding box is rotated along z.

@bilalsattar
Copy link

@peisun1115 can we call it yaw of the box?

@peisun1115
Copy link
Contributor

yes, it is yaw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants