google-research-datasets / Objectron

Objectron is a dataset of short, object-centric video clips. In addition, the videos also contain AR session metadata including camera poses, sparse point-clouds and planes. In each video, the camera moves around and above the object and captures it from different views. Each object is annotated with a 3D bounding box. The 3D bounding box describes the object’s position, orientation, and dimensions. The dataset contains about 15K annotated video clips and 4M annotated images in the following categories: bikes, books, bottles, cameras, cereal boxes, chairs, cups, laptops, and shoes
Other
2.24k stars 263 forks source link

Error parsing annotation #12

Closed DeriZSY closed 4 years ago

DeriZSY commented 4 years ago

Met google.protobuf.message.DecodeError: Error parsing message or RuntimeWarning: Unexpected end-group tag: Not all data was converted (and end up have ab empty list of annotations) for all the annotations I tested in bike data.

Code for reproduction

if __name__ == "__main__":
    batch_id = 0
    seq_id = 10
    video_filename = f'/data/objectron/train/videos/bike/batch-{batch_id}/{seq_id}/video.MOV'
    annotation_file = f'/data/objectron/train/annotations/bike/batch-{batch_id}/{seq_id}.pbdata'
    # Along with the video.MOV file, there is a geometry.pbdata file that contains
    # the geometry information of the scene (such as camera poses, point-clouds, and surfaces).
    # There is a copy of this container within each annotation protobuf too.
    geometry_filename = f'/data/objectron/train/videos/bike/batch-{batch_id}/{seq_id}/geometry.pbdata'  # a.k.a. AR metadata
    frame_id = 100
    with open(annotation_file, 'rb') as pb:
        data = pb.read()
        sequence = annotation_protocol.Sequence()
        sequence.ParseFromString(data)
        frame = grab_frame(video_filename, [frame_id])
        annotation, cat, num_keypoints, types = get_frame_annotation(sequence, frame_id)

What could be wrong? Are there any sepcific version requirements?

ahmadyan commented 4 years ago

I cannot re-produce this error. Can you share your downloaded annotation file pbdata?

For reference, this snippet works for me:

public_url = "https://storage.googleapis.com/objectron"
batch_id = 0
seq_id = 10
annotation_filename = public_url + f'/annotations/bike/batch-{batch_id}/{seq_id}.pbdata'
annotation = requests.get(annotation_filename)

file = open("annotation.pbdata", "wb")
file.write(annotation.content)
file.close()

frame_id = 100
with open('./annotation.pbdata', 'rb') as pb:
    data = pb.read()
    sequence = annotation_protocol.Sequence()
    sequence.ParseFromString(data)
    print(sequence)

If I had to guess, you probably tried downloading the pbdata file from the wrong address, try looking into the resulting downloaded file (e.g. try cat annotation.pbdata)

DeriZSY commented 4 years ago

Yeah, I think you're right. I made a mistake with downloading URL. It seems to be downloaded successfully but the contents are completely wrong.