Skip to main content

Upload ZOD data

This tutorial will guide you through uploading different scene types using the Zenseact Open Dataset (ZOD). The purpose of this page is to show you some of the steps that might be needed to convert recordings into Kognic scenes.

Prerequisites & Dependencies

  1. To follow along in this guide you need to download the data from Zenseact Open Dataset. The data should be structured like this:
zod
├── sequences
│ ├── 000000
│ ├── 000002
│ ├── ...
└── trainval-sequences-mini.json
  1. You will also need to install the ZOD Python package from PyPI, which provides some abstractions for reading the data:
pip install zod
  1. You need to have a Kognic account and the Kognic Python client installed. If you have not done this yet, read the quickstart guide.

This guide follows the process of uploading scenes using ZOD data, using the example code from the Kognic IO ZOD examples repository which contains the complete source files for all of the snippets in this page. The examples are runnable, if you have the data available and have Kognic authentication set up.

Our example code initialises a Kognic IO Client at the top level, then creates the scene from ZOD data for (potentially) multiple scenes at once using a function.

examples/zod/upload_cameras_sequence_scene.py
loading...

The first step in creating the scene is to load and iterate ZOD sequences, picking as many as we are interested in.

examples/zod/upload_cameras_sequence_scene.py
loading...

Then we must convert the scene. Given we have the ZOD frames converted, it's very easy to create a single camera sequence.

examples/zod/upload_cameras_sequence_scene.py
loading...

But to convert the frames is more complex. We need to add all the sensors that we are interested in: in this case only the FRONT camera. We must also convert timestamps to different precision as we go.

  • ZOD frame start timestamps are in fractional seconds
  • Kognic frame relative timestamps are in milliseconds
  • We use integer nanoseconds as an intermediate.
examples/zod/upload_cameras_sequence_scene.py
loading...

Converting the camera frame to an image is a simple mapping in this case, which we have abstracted out. Note that we do not know the shutter timing of the ZOD frames, but we set it to 1 ns in this example. This is not a problem in this case where there is no 3D data.

examples/zod/conversion.py
loading...

Going back to the main create function, we move on to creating the scene:

examples/zod/upload_cameras_sequence_scene.py
loading...

Where we simply hand the scene (CamerasSequence) to Kognic IO to create for us. If it is not a dry run, we get back the UUID of the created scene (if it's a dry run, expect None).

examples/zod/upload_cameras_sequence_scene.py
loading...