import dtlpy as dl
from scipy.spatial.transform import Rotation
dataset = dl.datasets.get(dataset_id="dataset-id")
frames_item = dataset.items.get(filepath='/frames.json')
builder = frames_item.annotations.builder()
label = "Car"
position = [
0.0,
0.0,
0.0,
]
scale = [
1.0,
1.0,
1.0,
]
rotation = Rotation.from_quat([
0.0,
0.0,
0.0,
1.0,
]).as_euler(
seq="xyz",
degrees=False
)
attributes = {"onRoad": True}
description = "Car on road"
annotation_definition = dl.Cube3d(
label=label,
position=position,
scale=scale,
rotation=rotation,
attributes=attributes,
description=description
)
frame_num = 0
end_frame_num = 1
object_id = "0"
metadata = {"user": {"Car": "onRoad"}}
builder.add(
annotation_definition=annotation_definition,
frame_num=frame_num,
end_frame_num=end_frame_num,
object_id=object_id,
metadata=metadata
)
builder.upload()