Actor Module¶
The actor module provides data structures for representing objects in a driving scene, including vehicles, pedestrians, cyclists, and static objects.
Actor¶
- class mimic_data_api.actor.Actor(*, id, name=None, dimensions, boxtype, original_boxtype=None, dynamic, trajectory, description=None, original_id=None, actor_accumulated_pcd_filepath=None, actor_accumulated_pcd=None, thumbnail_filepath=None, initial_splat_filepath=None, lidar_source=-1, base_folderpath=None)[source]¶
Bases:
BaseModelRepresentation of an actor (object) in a driving scene.
An actor represents any object of interest in the scene that is not the ego vehicle, including other vehicles, pedestrians, cyclists, traffic signs, and other static or dynamic objects.
- dimensions¶
Physical dimensions (length, width, height) of the actor’s bounding box.
- Type:
- boxtype¶
Standardized category of the actor for cross-dataset compatibility.
- Type:
{“pedestrian”, “bicycle”, “sign”, “vehicle”, “unknown”}
- original_boxtype¶
Original category label from the source dataset. Useful when the source dataset provides more granular labels (e.g., “sedan”, “SUV”, “truck”).
- Type:
str or None
- trajectory¶
Time-series of poses representing the actor’s position and orientation over time in world coordinates.
- Type:
- original_id¶
Original actor ID from the source dataset. Useful for tracking actors across scene edits or for referencing back to the original data. Some datasets (e.g. Waymo’s
key.laser_object_id) use string IDs.
Note
The
boxtypefield uses a standardized set of categories for consistency across different datasets. Useoriginal_boxtypeto preserve the more detailed labels from the source dataset.Example
>>> actor = Actor( ... id=42, ... name="Pedestrian_001", ... dimensions=ActorDimensions(length=0.5, width=0.5, height=1.7), ... boxtype="pedestrian", ... dynamic=True, ... trajectory=trajectory, # WorldTrajectory instance ... description="Pedestrian crossing at intersection" ... )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Actor Categories
The
boxtypefield uses standardized categories for cross-dataset compatibility:Category
Description
vehicleCars, trucks, buses, motorcycles, and other motorized vehicles
pedestrianPeople walking, standing, or running
bicycleCyclists and bicycles
signTraffic signs, signals, and road markers
unknownUnclassified or ambiguous objects
Use
original_boxtypeto preserve more granular labels from source datasets (e.g., “sedan”, “SUV”, “pickup_truck”).- dimensions: ActorDimensions¶
- trajectory: WorldTrajectory¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
ActorDimensions¶
- class mimic_data_api.actor.ActorDimensions(*, length, width, height)[source]¶
Bases:
BaseModelPhysical dimensions of an actor in 3D space.
This class represents the bounding box dimensions of an actor, typically used for collision detection, visualization, and spatial reasoning in driving scenarios.
Example
>>> dims = ActorDimensions(length=4.5, width=1.8, height=1.5) >>> print(f"Vehicle footprint: {dims.length}m x {dims.width}m") Vehicle footprint: 4.5m x 1.8m
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Common Dimensions
Typical dimensions for different actor types:
Type
Length (m)
Width (m)
Height (m)
Sedan
4.5
1.8
1.5
SUV
4.8
1.9
1.7
Truck
5.5
2.0
2.0
Pedestrian
0.5
0.5
1.7
Bicycle
1.8
0.6
1.7
Sign
0.1
0.6
2.0
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Usage Examples¶
Creating a dynamic vehicle:
from mimic_data_api import Actor, ActorDimensions, WorldTrajectory
import numpy as np
# Vehicle trajectory (moving forward at 10 m/s)
n_frames = 100
timestamps = np.linspace(0, 10, n_frames)
# Create translation matrices
poses = np.stack([np.eye(4)] * n_frames)
for i, t in enumerate(timestamps):
poses[i, 0, 3] = 10.0 * t # x = 10 * t (forward motion)
vehicle = Actor(
id=1,
name="sedan_001",
dimensions=ActorDimensions(length=4.5, width=1.8, height=1.5),
boxtype="vehicle",
original_boxtype="sedan",
dynamic=True,
trajectory=WorldTrajectory(
timestamps=timestamps,
object2world=poses
),
description="Blue sedan traveling eastbound"
)
Creating a static sign:
# Static actor has single-frame trajectory
stop_sign = Actor(
id=100,
name="stop_sign_001",
dimensions=ActorDimensions(length=0.1, width=0.6, height=2.0),
boxtype="sign",
dynamic=False,
trajectory=WorldTrajectory(
timestamps=np.array([0.0]),
object2world=np.eye(4).reshape(1, 4, 4)
)
)
Filtering actors by type:
from mimic_data_api import Scene
scene = Scene.model_validate_json(open("scene.json").read())
# Get all vehicles
vehicles = [a for a in scene.actors if a.boxtype == "vehicle"]
# Get all dynamic actors
dynamic = [a for a in scene.actors if a.dynamic]
# Get pedestrians and cyclists (vulnerable road users)
vru = [a for a in scene.actors if a.boxtype in ("pedestrian", "bicycle")]