dataclass
SemanticLabel
A dataclass to represent semantic labels.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Label name. |
attributes |
list[str]
|
List of attribute names. |
Source code in t4_devkit/dataclass/label.py
Box2D
A class to represent 2D box.
Attributes:
| Name | Type | Description |
|---|---|---|
unix_time |
int
|
Unix timestamp. |
frame_id |
str
|
Coordinates frame ID where the box is with respect to. |
semantic_label |
SemanticLabel
|
|
confidence |
float
|
Confidence score of the box. |
uuid |
str | None
|
Unique box identifier. |
roi |
Roi | None
|
|
position |
Vector3 | None
|
3D position (x, y, z). |
Examples:
>>> # without 3D position
>>> box2d = Box2D(
... unix_time=100,
... frame_id="camera",
... semantic_label=SemanticLabel("car"),
... roi=(100, 100, 50, 50),
... confidence=1.0,
... uuid="car2d_0",
... )
>>> # with 3D position
>>> box2d = box2d.with_position(position=(1.0, 1.0, 1.0))
Source code in t4_devkit/dataclass/box.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
with_position(position)
Return a self instance setting position attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
Vector3Like
|
3D position. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Self instance after setting |
Source code in t4_devkit/dataclass/box.py
Box3D
A class to represent 3D box.
Attributes:
| Name | Type | Description |
|---|---|---|
unix_time |
int
|
Unix timestamp. |
frame_id |
str
|
Coordinates frame ID where the box is with respect to. |
semantic_label |
SemanticLabel
|
|
confidence |
float
|
Confidence score of the box. |
uuid |
str | None
|
Unique box identifier. |
position |
Vector3
|
Box center position (x, y, z). |
rotation |
Quaternion
|
Box rotation quaternion. |
shape |
Shape
|
|
velocity |
Vector3 | None
|
Box velocity (vx, vy, vz). |
num_points |
int | None
|
The number of points inside the box. |
visibility |
VisibilityLevel
|
Box visibility. |
future |
Future | None
|
Box trajectory in the future of each mode. |
Examples:
>>> # without future
>>> box3d = Box3D(
... unix_time=100,
... frame_id="base_link",
... semantic_label=SemanticLabel("car"),
... position=(1.0, 1.0, 1.0),
... rotation=(0.0, 0.0, 0.0, 1.0),
... shape=Shape(shape_type=ShapeType.BOUNDING_BOX, size=(1.0, 1.0, 1.0)),
... velocity=(1.0, 1.0, 1.0),
... confidence=1.0,
... uuid="car3d_0",
... )
>>> # with future
>>> box3d = box3d.with_future(
... waypoints=[[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [3.0, 3.0, 3.0]]],
... confidences=[1.0],
... )
Source code in t4_devkit/dataclass/box.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
size
property
Return the box size in the order of (width, length, height).
Returns:
| Type | Description |
|---|---|
Vector3
|
(width, length, height) values. |
corners(box_scale=1.0)
Return the bounding box corners.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
box_scale
|
float
|
Multiply size by this factor to scale the box. |
1.0
|
Returns:
| Type | Description |
|---|---|
NDArrayF64
|
First four corners are the ones facing forward. The last four are the ones facing backwards, in the shape of (8, 3). |
Source code in t4_devkit/dataclass/box.py
rotate(q)
Apply a rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
RotationLike
|
Rotation quaternion. |
required |
Source code in t4_devkit/dataclass/box.py
translate(x)
Apply a translation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Vector3Like
|
3D translation vector in the order of (x, y, z). |
required |
Source code in t4_devkit/dataclass/box.py
with_future(timestamps, confidences, waypoints)
Return a self instance setting future attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamps
|
ArrayLike
|
Array of future timestamps at each waypoint in the shape of (T). |
required |
confidences
|
ArrayLike
|
Array of confidences for each mode in the shape of (M). |
required |
waypoints
|
ArrayLike
|
Array of waypoints for each mode in the shape of (M, T, D). |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Self instance after setting |
Source code in t4_devkit/dataclass/box.py
distance_box(box, tf_matrix)
Return a box distance from base_link.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
box
|
BoxLike
|
A box. |
required |
tf_matrix
|
HomogeneousMatrix
|
Transformation matrix. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
Expecting type of box is |
Returns:
| Type | Description |
|---|---|
float | None
|
float | None: Return |
Source code in t4_devkit/dataclass/box.py
LidarPointCloud
A dataclass to represent lidar pointcloud.
Attributes:
| Name | Type | Description |
|---|---|---|
points |
NDArrayFloat
|
Points matrix in the shape of (4, N). |
Source code in t4_devkit/dataclass/pointcloud.py
PointCloud
Abstract base dataclass for pointcloud data.
Source code in t4_devkit/dataclass/pointcloud.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
from_file(filepath)
abstractmethod
classmethod
Create an object from pointcloud file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
File path of the pointcloud file. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Self instance. |
num_dims()
abstractmethod
staticmethod
Return the number of the point dimensions.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of the point dimensions. |
PointCloudMetainfo
A dataclass to represent pointcloud metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
stamp |
Stamp
|
Timestamp. |
sources |
list[PointCloudSourceInfo]
|
List of source information. |
Source code in t4_devkit/dataclass/pointcloud.py
source_tokens
property
from_file(filepath)
classmethod
Create an instance from a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the JSON file containing metadata. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
PointCloudMetainfo instance. |
Source code in t4_devkit/dataclass/pointcloud.py
PointCloudSourceInfo
A dataclass to represent pointcloud source information.
Attributes:
| Name | Type | Description |
|---|---|---|
sensor_token |
str
|
source sensor identifier. References token field from Sensor table. |
idx_begin |
int
|
Begin index of points for the source in the concatenated pointcloud structure. |
length |
int
|
Length of points for the source in the concatenated pointcloud structure. |
stamp |
Stamp
|
Timestamp. |
Source code in t4_devkit/dataclass/pointcloud.py
RadarPointCloud
A dataclass to represent radar pointcloud.
Attributes:
| Name | Type | Description |
|---|---|---|
points |
NDArrayFloat
|
Points matrix in the shape of (18, N). |
Source code in t4_devkit/dataclass/pointcloud.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
SegmentationPointCloud
A dataclass to represent segmentation pointcloud.
Attributes:
| Name | Type | Description |
|---|---|---|
points |
NDArrayFloat
|
Points matrix in the shape of (4, N). |
labels |
NDArrayU8
|
Label matrix. |
Source code in t4_devkit/dataclass/pointcloud.py
Stamp
A dataclass to represent timestamp.
Attributes:
| Name | Type | Description |
|---|---|---|
sec |
int
|
Seconds. |
nanosec |
int
|
Nanoseconds. |
Source code in t4_devkit/dataclass/pointcloud.py
in_seconds
property
Convert timestamp to seconds as a float.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Timestamp in seconds. |
Shape
A dataclass to represent the 3D box shape.
Attributes:
| Name | Type | Description |
|---|---|---|
shape_type |
ShapeType
|
Box shape type. |
size |
Vector3
|
Box size in the order of (width, length, height). |
footprint |
Polygon
|
Polygon of footprint. |
Examples:
Source code in t4_devkit/dataclass/shape.py
ShapeType
Bases: Enum
Source code in t4_devkit/dataclass/shape.py
from_name(name)
classmethod
Return an enum object from the name of the member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of enum member. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Enum object. |
Source code in t4_devkit/dataclass/shape.py
Future
Bases: ObjectPath
Represent the future trajectory features.
Note that the expected shape of waypoints is (M, T, D).
Attributes:
| Name | Type | Description |
|---|---|---|
timestamps |
NDArrayInt
|
Sequence of timestamps (T,). |
confidences |
NDArrayFloat
|
Confidences array for each mode (M,). |
waypoints |
Trajectory
|
Waypoints matrix in the shape of (M, T, 3). |
Examples:
>>> future = Future(
... timestamps=[1.0, 2.0]
... confidences=[1.0],
... waypoints=[[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]],
... )
# Get the number of modes.
>>> len(future)
1
# Access the shape of waypoints matrix: (M, T, 3).
>>> future.shape
(1, 2, 3)
# Access waypoints as subscriptable.
>>> future[0] # for mode0
array([[1., 1., 1.],
[2., 2., 2.]])
>>> future[0, 0] # point0 at mode0
array([1., 1., 1.])
# Access confidence and waypoints for each mode as iterable.
>>> for i, (timestamp, confidence, waypoints) in future:
... print(f"Mode{i}: {timestamp}, {confidence}, {waypoints}")
...
Mode0: 1.0, 1.0, [[1. 1. 1.] [2. 2. 2.]]
Source code in t4_devkit/dataclass/trajectory.py
ObjectPath
A dataclass to represent object path including timestamps, confidences, and waypoints.
Source code in t4_devkit/dataclass/trajectory.py
num_mode
property
Return the number of trajectory modes.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of trajectory modes. |
num_timestamp
property
shape
property
__len__()
rotate(q)
Apply a rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
RotationLike
|
Rotation quaternion. |
required |
translate(x)
Apply a translation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Vector3Like
|
3D translation vector. |
required |
Past
Bases: ObjectPath
Represent the past trajectory features.
Note that the expected shape of waypoints is (1, T, D).
Attributes:
| Name | Type | Description |
|---|---|---|
timestamps |
NDArrayInt
|
Sequence of timestamps (T,). |
confidences |
NDArrayFloat
|
Confidences array for the mode (1,). |
waypoints |
Trajectory
|
Waypoints matrix in the shape of (1, T, 3). |
Examples:
>>> past = Past(
... timestamps=[1.0, 2.0]
... confidences=[1.0],
... waypoints=[[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]],
... )
# Get the number of modes.
>>> len(past)
1
# Access the shape of waypoints matrix: (M, T, 3).
>>> past.shape
(1, 2, 3)
# Access waypoints as subscriptable.
>>> past[0] # for mode0
array([[1., 1., 1.],
[2., 2., 2.]])
>>> past[0, 0] # point0 at mode0
array([1., 1., 1.])
# Access confidence and waypoints for each mode as iterable.
>>> for i, (timestamp, confidence, waypoints) in past:
... print(f"Mode{i}: {timestamp}, {confidence}, {waypoints}")
...
Mode0: 1.0, 1.0, [[1. 1. 1.] [2. 2. 2.]]
Source code in t4_devkit/dataclass/trajectory.py
HomogeneousMatrix
Source code in t4_devkit/dataclass/transform.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
rotation_matrix
property
shape
property
yaw_pitch_roll
property
Return yaw, pitch and roll.
NOTE
yaw: Rotation angle around the z-axis in [rad], in the range [-pi, pi].
pitch: Rotation angle around the y'-axis in [rad], in the range [-pi/2, pi/2].
roll: Rotation angle around the x"-axis in [rad], in the range [-pi, pi].
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
Yaw, pitch and roll in [rad]. |
as_identity(frame_id)
classmethod
Construct a new object with identity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame_id
|
str
|
Frame ID. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Constructed self instance. |
Source code in t4_devkit/dataclass/transform.py
dot(other)
Return a dot product of myself and another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
HomogeneousMatrix
|
|
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Returns:
| Type | Description |
|---|---|
HomogeneousMatrix
|
Result of a dot product. |
Source code in t4_devkit/dataclass/transform.py
from_matrix(matrix, src=None, dst=None)
classmethod
Construct a new object from a homogeneous matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Matrix4x4Like | HomogeneousMatrix
|
4x4 homogeneous matrix. |
required |
src
|
str | None
|
Source frame ID.
This must be specified only if the input matrix is |
None
|
dst
|
str | None
|
Destination frame ID.
This must be specified only if the input matrix is |
None
|
Returns:
| Type | Description |
|---|---|
Self
|
Constructed self instance. |
Source code in t4_devkit/dataclass/transform.py
inv()
Return a inverse matrix of myself.
Returns:
| Type | Description |
|---|---|
HomogeneousMatrix
|
Inverse matrix. |
Source code in t4_devkit/dataclass/transform.py
TransformBuffer
A buffer class to store transformation matrices.
Attributes:
| Name | Type | Description |
|---|---|---|
buffer |
dict[tuple[str, str], HomogeneousMatrix]
|
Matrix buffer whose key is |
Source code in t4_devkit/dataclass/transform.py
do_rotate(src, dst, *args, **kwargs)
Rotate specified items with the matrix corresponding to src and dst frame ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source frame ID. |
required |
dst
|
str
|
Destination frame ID. |
required |
Returns:
| Type | Description |
|---|---|
RotateItemLike | None
|
TranslateItemLike | None: Returns rotated items if the corresponding matrix can be found,
otherwise it returns |
Source code in t4_devkit/dataclass/transform.py
do_transform(src, dst, *args, **kwargs)
Transform specified items with the matrix corresponding to src and dst frame ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source frame ID. |
required |
dst
|
str
|
Destination frame ID. |
required |
Returns:
| Type | Description |
|---|---|
TransformItemLike | None
|
TranslateItemLike | None: Returns transformed items if the corresponding matrix can be found,
otherwise it returns |
Source code in t4_devkit/dataclass/transform.py
do_translate(src, dst, *args, **kwargs)
Translate specified items with the matrix corresponding to src and dst frame ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source frame ID. |
required |
dst
|
str
|
Destination frame ID. |
required |
Returns:
| Type | Description |
|---|---|
TranslateItemLike | None
|
TranslateItemLike | None: Returns translated items if the corresponding matrix can be found,
otherwise it returns |
Source code in t4_devkit/dataclass/transform.py
lookup_transform(src, dst)
Look up the transform matrix corresponding to the src and dst frame ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
str
|
Source frame ID. |
required |
dst
|
str
|
Destination frame ID. |
required |
Returns:
| Type | Description |
|---|---|
HomogeneousMatrix | None
|
Returns |
Source code in t4_devkit/dataclass/transform.py
set_transform(matrix)
Set transform matrix to the buffer. Also, if its inverse transformation has not been registered, registers it too.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
HomogeneousMatrix
|
Transformation matrix. |
required |