Visualization
Rendering with Tier4
If you want to visualize annotation results, Tier4
supports some rendering methods as below.
Scene
Specific Instance(s)
Note
You can also render multiple instances at once:
PointCloud
Note
In case of you want to ignore camera distortion, please specify ignore_distortion=True
.
Save Recording
You can save the rendering result as follows:
When you specify save_dir
, viewer will not be spawned on your screen.
Rendering with RerunViewer
If you want to visualize your components, such as boxes that your ML-model estimated, RerunViewer
allows you to visualize these components.
For details, please refer to the API references.
>>> from t4_devkit.viewer import RerunViewer
# You need to specify `cameras` if you want to 2D spaces
>>> viewer = RerunViewer("foo", cameras=<CAMERA_NAMES:[str;N]>)
# Timestamp in seconds
>>> seconds: int | float = ...
Rendering 3D boxes
# Rendering 3D boxes
>>> from t4_devkit.dataclass import Box3D
>>> box3ds = [Box3D(...)...]
>>> viewer.render_box3ds(seconds, box3ds)
It allows you to render boxes by specifying elements of boxes directly.
# Rendering 3D boxes
>>> centers = [[i, i, i] for i in range(10)]
>>> rotations = [[1, 0, 0, 0] for _ in range(10)]
>>> sizes = [[1, 1, 1] for _ in range(10)]
>>> class_ids = [0 for _ in range(10)]
>>> viewer.render_box3ds(seconds, centers, rotations, sizes, class_ids)
Rendering 2D boxes
For 2D spaces, you need to specify camera names in the viewer constructor, and render images by specifying camera names:
# RerunViewer(<APP_ID:str>, cameras=<CAMERA_NAMES:[str;N]>)
>>> viewer = RerunViewer("foo", cameras=["camera1"])
>>> import numpy as np
>>> image = np.zeros((100, 100, 3), dtype=np.uint8)
>>> viewer.render_image(seconds, "camera1", image)
# Rendering 2D boxes
>>> from t4_devkit.dataclass import Box2D
>>> box2ds = [Box2D(...)...]
>>> viewer.render_box2ds(seconds, "camera1", box2ds)
It allows you to render boxes by specifying elements of boxes directly:
# Rendering 2D boxes
>>> rois = [[0, 0, 10 * i, 10 * i] for i in range(10)]
>>> viewer.render_box2ds(seconds, "camera1", rois, class_ids)
Rendering point cloud
from t4_devkit.dataclass import LidarPointCloud
# Point cloud channel name
>>> lidar_channel = "LIDAR_TOP"
# Load point cloud from file
>>> pointcloud = LidarPointCloud.from_file(<PATH_TO_POINTCLOUD.pcd.bin>)
>>> viewer.render_pointcloud(seconds, lidar_channel, pointcloud)