caizhongang / waymo_kitti_converter

A toolkit for Waymo Open Dataset <-> KITTI conversions
152 stars 30 forks source link

AttributeError: num_lidar_points_in_box #1

Closed xjjs closed 4 years ago

xjjs commented 4 years ago

Hi,

there is a line in conver.py: if filter_empty_3dbox and obj.num_lidar_points_in_box < 1 And the error is as follows: File "converter.py", line 360, in save_label if filter_empty_3dbox and obj.num_lidar_points_in_box < 1: AttributeError: num_lidar_points_in_box

The attribute "num_lidar_points_in_box" is not given in https://github.com/waymo-research/waymo-open-dataset/blob/master/waymo_open_dataset/label.proto

caizhongang commented 4 years ago

Thank you for your feedback. This project is still in development and it will get better.

However, the converter runs fine on my side.

num_lidar_points_in_box can be found at https://github.com/waymo-research/waymo-open-dataset/blob/master/waymo_open_dataset/label.proto#L83

Can you try the following script?

import tensorflow as tf
from waymo_open_dataset import dataset_pb2 as open_dataset

tfrecord_file_name = ''  # give one tfrecord here

def read_tfrecord():
    dataset = tf.data.TFRecordDataset(tfrecord_file_name, compression_type='')
    for data in dataset:
        frame = open_dataset.Frame()
        frame.ParseFromString(bytearray(data.numpy()))
        for obj in frame.laser_labels:
             print(obj.num_lidar_points_in_box)

if __name__ == '__main__':
    read_tfrecord()
xjjs commented 4 years ago

Thank you for your feedback. This project is still in development and it will get better.

However, the converter runs fine on my side.

num_lidar_points_in_box can be found at https://github.com/waymo-research/waymo-open-dataset/blob/master/waymo_open_dataset/label.proto#L83

Can you try the following script?

import tensorflow as tf
from waymo_open_dataset import dataset_pb2 as open_dataset

tfrecord_file_name = ''  # give one tfrecord here

def read_tfrecord():
    dataset = tf.data.TFRecordDataset(tfrecord_file_name, compression_type='')
    for data in dataset:
        frame = open_dataset.Frame()
        frame.ParseFromString(bytearray(data.numpy()))
        for obj in frame.laser_labels:
             print(obj.num_lidar_points_in_box)

if __name__ == '__main__':
    read_tfrecord()

Thanks for your prompt reply. May I know you how to configure the "waymo-open-dataset"? I check the "label.proto" file in my folder, and the line " optional int32 num_lidar_points_in_box = 7;" is missed. I think we have different version of "waymo-open-dataset". Did you adopt the tensorflow 1.14 or > 2.0?

caizhongang commented 4 years ago

1.AttributeError: 'Tensor' object has no attribute 'numpy', and this can be solved by adding " tf.enable_eager_execution()"

Yes, the script is for TensorFlow version >= 2.

May I know you how to configure the "waymo-open-dataset"? I check the "label.proto" file in my folder, and the line " optional int32 num_lidar_points_in_box = 7;" is missed. I think we have different version of "waymo-open-dataset". Did you adopt the tensorflow 1.14 or > 2.0?

My TensorFlow version is 2.1.0. I guess that is the problem. You may want to upgrade to TensorFlow 1.15.0, 2.0.0, 2.1.0 and install the precompiled packages accordingly:

pip3 install waymo-open-dataset-tf-<your-tf-version>==1.2.0 --user

See details on the official page: https://github.com/waymo-research/waymo-open-dataset/blob/master/docs/quick_start.md I am not sure if they support other TensorFlow versions but I'd prefer following their system requirement list.

xjjs commented 4 years ago

1.AttributeError: 'Tensor' object has no attribute 'numpy', and this can be solved by adding " tf.enable_eager_execution()"

Yes, the script is for TensorFlow version >= 2.

May I know you how to configure the "waymo-open-dataset"? I check the "label.proto" file in my folder, and the line " optional int32 num_lidar_points_in_box = 7;" is missed. I think we have different version of "waymo-open-dataset". Did you adopt the tensorflow 1.14 or > 2.0?

My TensorFlow version is 2.1.0. I guess that is the problem. You may want to upgrade to TensorFlow 1.15.0, 2.0.0, 2.1.0 and install the precompiled packages accordingly:

pip3 install waymo-open-dataset-tf-<your-tf-version>==1.2.0 --user

See details on the official page: https://github.com/waymo-research/waymo-open-dataset/blob/master/docs/quick_start.md I am not sure if they support other TensorFlow versions but I'd prefer follow their system requirement list.

thanks for your reply, the branch "r1.0" didn't not include the line " optional int32 num_lidar_points_in_box = 7;" https://github.com/waymo-research/waymo-open-dataset/blob/r1.0/waymo_open_dataset/label.proto, And I need update my tensorflow and waymo-open-dataset, thanks

caizhongang commented 4 years ago

Thank you for your feedback. I will add precautions in the README as soon as I have time.

caizhongang commented 4 years ago

Follow-ups, see https://github.com/caizhongang/waymo_to_kitti_converter/issues/2.