raillabel package¶
Subpackages¶
- raillabel.filter package
- Submodules
- raillabel.filter._filter_abc module
- raillabel.filter.end_time_filter module
- raillabel.filter.exclude_annotation_id_filter module
- raillabel.filter.exclude_annotation_type_filter module
- raillabel.filter.exclude_attributes_filter module
- raillabel.filter.exclude_frame_id_filter module
- raillabel.filter.exclude_object_id_filter module
- raillabel.filter.exclude_object_type_filter module
- raillabel.filter.exclude_sensor_id_filter module
- raillabel.filter.exclude_sensor_type_filter module
- raillabel.filter.include_annotation_id_filter module
- raillabel.filter.include_annotation_type_filter module
- raillabel.filter.include_attributes_filter module
- raillabel.filter.include_frame_id_filter module
- raillabel.filter.include_object_id_filter module
- raillabel.filter.include_object_type_filter module
- raillabel.filter.include_sensor_id_filter module
- raillabel.filter.include_sensor_type_filter module
- raillabel.filter.start_time_filter module
- Module contents
EndTimeFilter
ExcludeAnnotationIdFilter
ExcludeAnnotationTypeFilter
ExcludeAttributesFilter
ExcludeFrameIdFilter
ExcludeObjectIdFilter
ExcludeObjectTypeFilter
ExcludeSensorIdFilter
ExcludeSensorTypeFilter
IncludeAnnotationIdFilter
IncludeAnnotationTypeFilter
IncludeAttributesFilter
IncludeFrameIdFilter
IncludeObjectIdFilter
IncludeObjectTypeFilter
IncludeSensorIdFilter
IncludeSensorTypeFilter
StartTimeFilter
- Submodules
- raillabel.format package
- Submodules
- raillabel.format._attributes module
- raillabel.format._sensor_without_intrinsics module
- raillabel.format._util module
- raillabel.format.bbox module
- raillabel.format.camera module
- raillabel.format.cuboid module
- raillabel.format.frame module
- raillabel.format.frame_interval module
- raillabel.format.gps_imu module
- raillabel.format.intrinsics_pinhole module
- raillabel.format.intrinsics_radar module
- raillabel.format.lidar module
- raillabel.format.metadata module
- raillabel.format.num module
- raillabel.format.object module
- raillabel.format.other_sensor module
- raillabel.format.point2d module
- raillabel.format.point3d module
- raillabel.format.poly2d module
- raillabel.format.poly3d module
- raillabel.format.quaternion module
- raillabel.format.radar module
- raillabel.format.scene module
- raillabel.format.seg3d module
- raillabel.format.sensor_reference module
- raillabel.format.size2d module
- raillabel.format.size3d module
- raillabel.format.transform module
- Module contents
- Submodules
- raillabel.json_format package
- Submodules
- raillabel.json_format._json_format_base module
- raillabel.json_format.attributes module
- raillabel.json_format.bbox module
- raillabel.json_format.boolean_attribute module
- raillabel.json_format.coordinate_system module
- raillabel.json_format.cuboid module
- raillabel.json_format.element_data_pointer module
- raillabel.json_format.frame module
- raillabel.json_format.frame_interval module
- raillabel.json_format.metadata module
- raillabel.json_format.num module
- raillabel.json_format.num_attribute module
- raillabel.json_format.object module
- raillabel.json_format.object_data module
- raillabel.json_format.poly2d module
- raillabel.json_format.poly3d module
- raillabel.json_format.scene module
- raillabel.json_format.stream_camera module
- raillabel.json_format.stream_other module
- raillabel.json_format.stream_radar module
- raillabel.json_format.stream_sync module
- raillabel.json_format.text_attribute module
- raillabel.json_format.transform_data module
- raillabel.json_format.vec module
- raillabel.json_format.vec_attribute module
- Module contents
JSONAnnotations
JSONAttributes
JSONBbox
JSONBooleanAttribute
JSONCoordinateSystem
JSONCuboid
JSONElementDataPointer
JSONFrame
JSONFrameData
JSONFrameInterval
JSONFrameProperties
JSONIntrinsicsPinhole
JSONIntrinsicsRadar
JSONMetadata
JSONNum
JSONNumAttribute
JSONObject
JSONObjectData
JSONPoly2d
JSONPoly3d
JSONScene
JSONSceneContent
JSONStreamCamera
JSONStreamCameraProperties
JSONStreamOther
JSONStreamRadar
JSONStreamRadarProperties
JSONStreamSync
JSONStreamSyncProperties
JSONStreamSyncTimestamp
JSONTextAttribute
JSONTransformData
JSONVec
JSONVecAttribute
- Submodules
- raillabel.scene_builder package
Module contents¶
Devkit for working with recorded and annotated train ride data from DB.
The first step in using raillabel is downloading a desired dataset (like [OSDaR23](https://data.fid-move.de/dataset/osdar23)). You can then load any scene by running
import raillabel
scene = raillabel.load("path/to/annotation_file.json")
This returns the root class for the annotations.
If a file is too extensive for your use-case you can filter out certain parts of a scene like this
from raillabel.filter import (
IncludeObjectTypeFilter,
ExcludeAnnotationTypeFilter,
StartTimeFilter, ExcludeFrameIdFilter,
IncludeAttributesFilter
)
scene_with_only_trains = scene.filter([IncludeObjectTypeFilter(["rail_vehicle"])])
scene_without_bboxs = scene.filter([ExcludeAnnotationTypeFilter(["bbox"])])
cut_scene_with_only_red_trains = scene.filter([
StartTimeFilter("1587349200.004200000"),
ExcludeFrameIdFilter([2, 4]),
IncludeObjectTypeFilter(["rail_vehicle"]),
IncludeAttributesFilter({"color": "red"}),
])
An overview of all available filters can be found [here](https://dsd-dbs.github.io/raillabel/code/raillabel.filter.html#module-raillabel.filter).
If you then want to save your changes, then use
raillabel.save(cut_scene_with_only_red_trains, "/path/to/target.json")
- class raillabel.Scene(metadata: ~raillabel.format.metadata.Metadata, sensors: dict[str, ~raillabel.format.camera.Camera | ~raillabel.format.lidar.Lidar | ~raillabel.format.radar.Radar | ~raillabel.format.gps_imu.GpsImu | ~raillabel.format.other_sensor.OtherSensor] = <factory>, objects: dict[~uuid.UUID, ~raillabel.format.object.Object] = <factory>, frames: dict[int, ~raillabel.format.frame.Frame] = <factory>)¶
Bases:
object
The root RailLabel class, which contains all data.
Examples: You can load scenes like this:
import raillabel scene = raillabel.load("path/to/scene.json")
The scenes then contain all of the data. This is how you can iterate over the annotations:
for frame in scene.frames.values(): for annotation in frame.annotations.values(): pass # do something with the annotation here
- filter(filters: list[_FilterAbc]) Scene ¶
Return a scene with annotations, sensors, objects and frames excluded.
Example:
from raillabel.filter import ( IncludeObjectTypeFilter, ExcludeAnnotationTypeFilter, StartTimeFilter, ExcludeFrameIdFilter, IncludeAttributesFilter ) scene_with_only_trains = scene.filter([IncludeObjectTypeFilter(["rail_vehicle"])]) scene_without_bboxs = scene.filter([ExcludeAnnotationTypeFilter(["bbox"])]) cut_scene_with_only_red_trains = scene.filter([ StartTimeFilter("1587349200.004200000"), ExcludeFrameIdFilter([2, 4]), IncludeObjectTypeFilter(["rail_vehicle"]), IncludeAttributesFilter({"color": "red"}), ])
- frames: dict[int, Frame]¶
A container of dynamic, timewise, information. Keys are the frame integer number.
- objects: dict[UUID, Object]¶
Unique objects (like a specific person) in this scene. Keys are object uuids
- raillabel.load(path: Path | str) Scene ¶
Load an annotation file as a scene.
Example:
import raillabel scene = raillabel.load("path/to/scene.json")
- raillabel.save(scene: Scene, path: Path | str, prettify_json: bool = False) None ¶
Save a raillabel.Scene to a JSON file.
Example:
import raillabel scene = raillabel.load("path/to/scene.json") # change something about the scene raillabel.save(scene, "path/to/new_scene.json") # or to get a human readable (but much larger) file raillabel.save(scene, "path/to/new_scene.json", prettify_json=True)