Open inf19150 opened 2 years ago
In your sample code you are parsing the string into a Frame proto. The Frame proto does not contain map information. Currently, only the motion dataset contains map information which is stored as Scenario protos.
In your sample code you are parsing the string into a Frame proto. The Frame proto does not contain map information. Currently, only the motion dataset contains map information which is stored as Scenario protos.
The snippet I posted only outlines the methodology, in the actual code I am using open_dataset.RoadLine()
for instance, which should be referring to map.proto
Given the function
def parse_proto_objects(path_to_waymo: str, obj) -> list:
"""
Parses objects of protobuf-declaration within waymo-dataset
:param path_to_waymo: str of path, where *.tfrecord-files are placed
:param obj: class-type of desired objects returned by this function within waymo_open_dataset.protos
:return list of desired objects within all filed tfrecord-files
"""
DO_DEBUG_PRINTS=True
parsed_objects = []
for f in os.listdir(path_to_waymo):
dataset = tf.data.TFRecordDataset(
os.path.join(path_to_waymo, f), compression_type=""
)
for data in dataset:
parsed_object = obj()
parsed_object.ParseFromString(bytes(data.numpy()))
# print(parsed_object)
parsed_objects.append(parsed_object)
if DO_DEBUG_PRINTS:
for item in parsed_object.polyline:
print(item)
return parsed_objects
Calling parse_proto_objects
in such a snippet
from plai_waymo_motion_plugin.waymo.waymo_helper import parse_proto_objects
from waymo_open_dataset.protos import map_pb2
PATH = "./waymo_dataset_raw_scenario/" # scenario proto files stored in this dir
obj = parse_proto_objects(PATH, map_pb2.RoadLine)
will neither return useful values as debug-prints, nor debugging after parsed_object.ParseFromString(...) at different iteration-positions will give me values other than (0, 0, 0).
The TfRecord files contain serialized strings of Scenario protos. I believe you need to pass your function the Scenario proto type defined here: https://github.com/waymo-research/waymo-open-dataset/blob/master/waymo_open_dataset/protos/scenario.proto
The TfRecord files contain serialized strings of Scenario protos. I believe you need to pass your function the Scenario proto type defined here: https://github.com/waymo-research/waymo-open-dataset/blob/master/waymo_open_dataset/protos/scenario.proto .
On Wed, Jun 22, 2022 at 4:39 AM inf19150 @.***> wrote:
Given the function
def parse_proto_objects(path_to_waymo: str, obj) -> list: """ Parses objects of protobuf-declaration within waymo-dataset
:param path_to_waymo: str of path, where *.tfrecord-files are placed :param obj: class-type of desired objects returned by this function within waymo_open_dataset.protos :return list of desired objects within all filed tfrecord-files """ DO_DEBUG_PRINTS=True parsed_objects = [] for f in os.listdir(path_to_waymo): dataset = tf.data.TFRecordDataset( os.path.join(path_to_waymo, f), compression_type="" ) for data in dataset: parsed_object = obj() parsed_object.ParseFromString(bytes(data.numpy())) # print(parsed_object) parsed_objects.append(parsed_object) if DO_DEBUG_PRINTS: for item in parsed_object.polyline: print(item) return parsed_objects
Calling parse_proto_objects in such a snippet
from plai_waymo_motion_plugin.waymo.waymo_helper import parse_proto_objects from waymo_open_dataset.protos import map_pb2
PATH = "./waymo_dataset_raw_scenario/" #.tfexample files stored in this dir obj = parse_proto_objects(PATH, map_pb2.RoadLine)
will neither return useful values as debug-prints, nor debugging after parsed_object.ParseFromString(...) at different iteration-positions will give me values other than (0, 0, 0).
[image: image] https://user-images.githubusercontent.com/72318314/175019880-838f62e3-9219-42a6-9817-b4a8d1c2eaed.png
— Reply to this email directly, view it on GitHub https://github.com/waymo-research/waymo-open-dataset/issues/509#issuecomment-1162991209, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATYRUOY2NA2KSJJLXJKTHDLVQL3QPANCNFSM5YFPLCTQ . You are receiving this because you commented.Message ID: @.***>
I wanted to parse the polyline of a RoadLine (as part of the map-data), which is declared as .proto-File.
I'm using the
waymo-open-dataset-tf-2-5-0
dependency in python to access and load a particular object within scenario-format. My parsing is similar to this (taken from tutorial notebook):Unfortunately, the polyline object is empty / filled with 0-Tripels for (x, y, z) whereas static data (e.g. Enum-Declaration of RoadLine-Message in proto) gets parsed without a problem
Has anybody experienced similar issues, related to scenario / protobuf-Format.