raillabel_providerkit package¶
Subpackages¶
- raillabel_providerkit.convert package
- raillabel_providerkit.export package
- raillabel_providerkit.format package
- Subpackages
- raillabel_providerkit.format.understand_ai package
- Submodules
- raillabel_providerkit.format.understand_ai.bounding_box_2d module
- raillabel_providerkit.format.understand_ai.bounding_box_3d module
- raillabel_providerkit.format.understand_ai.coordinate_system module
- raillabel_providerkit.format.understand_ai.frame module
- raillabel_providerkit.format.understand_ai.metadata module
- raillabel_providerkit.format.understand_ai.point_3d module
- raillabel_providerkit.format.understand_ai.polygon_2d module
- raillabel_providerkit.format.understand_ai.polyline_2d module
- raillabel_providerkit.format.understand_ai.quaternion module
- raillabel_providerkit.format.understand_ai.scene module
- raillabel_providerkit.format.understand_ai.segmentation_3d module
- raillabel_providerkit.format.understand_ai.sensor_reference module
- raillabel_providerkit.format.understand_ai.size_3d module
- Module contents
- raillabel_providerkit.format.understand_ai package
- Module contents
- Subpackages
- raillabel_providerkit.gui package
- raillabel_providerkit.ontologies package
- raillabel_providerkit.validation package
- Subpackages
- raillabel_providerkit.validation.validate_annotation_type_per_sensor package
- raillabel_providerkit.validation.validate_dimensions package
- raillabel_providerkit.validation.validate_ego_track_both_rails package
- raillabel_providerkit.validation.validate_empty_frames package
- raillabel_providerkit.validation.validate_horizon package
- raillabel_providerkit.validation.validate_missing_ego_track package
- raillabel_providerkit.validation.validate_ontology package
- raillabel_providerkit.validation.validate_rail_side package
- raillabel_providerkit.validation.validate_schema package
- raillabel_providerkit.validation.validate_sensors package
- raillabel_providerkit.validation.validate_transition package
- raillabel_providerkit.validation.validate_uris package
- Submodules
- raillabel_providerkit.validation.issue module
IssueIssueIdentifiersIssueTypeIssueType.ANNOTATION_SENSOR_MISMATCHIssueType.ATTRIBUTE_MISSINGIssueType.ATTRIBUTE_SCOPEIssueType.ATTRIBUTE_TYPEIssueType.ATTRIBUTE_UNDEFINEDIssueType.ATTRIBUTE_VALUEIssueType.DIMENSION_INVALIDIssueType.EGO_TRACK_BOTH_RAILSIssueType.EMPTY_FRAMESIssueType.HORIZON_CROSSEDIssueType.MISSING_EGO_TRACKIssueType.OBJECT_TYPE_UNDEFINEDIssueType.RAIL_SIDEIssueType.SCHEMAIssueType.SENSOR_ID_UNKNOWNIssueType.SENSOR_TYPE_WRONGIssueType.TRANSITION_IDENTICAL_START_ENDIssueType.UNEXPECTED_CLASSIssueType.URI_FORMATIssueType.names()
- raillabel_providerkit.validation.issue_schema module
- raillabel_providerkit.validation.validate module
- Module contents
IssueIssueIdentifiersIssueTypeIssueType.ANNOTATION_SENSOR_MISMATCHIssueType.ATTRIBUTE_MISSINGIssueType.ATTRIBUTE_SCOPEIssueType.ATTRIBUTE_TYPEIssueType.ATTRIBUTE_UNDEFINEDIssueType.ATTRIBUTE_VALUEIssueType.DIMENSION_INVALIDIssueType.EGO_TRACK_BOTH_RAILSIssueType.EMPTY_FRAMESIssueType.HORIZON_CROSSEDIssueType.MISSING_EGO_TRACKIssueType.OBJECT_TYPE_UNDEFINEDIssueType.RAIL_SIDEIssueType.SCHEMAIssueType.SENSOR_ID_UNKNOWNIssueType.SENSOR_TYPE_WRONGIssueType.TRANSITION_IDENTICAL_START_ENDIssueType.UNEXPECTED_CLASSIssueType.URI_FORMATIssueType.names()
validate_dimensions()validate_ego_track_both_rails()validate_empty_frames()validate_horizon()validate_missing_ego_track()validate_ontology()validate_rail_side()validate_schema()validate_sensors()validate_transition()validate_uris()
- Subpackages
Submodules¶
raillabel_providerkit.exceptions module¶
Module contents¶
A library for annotation providers of raillabel-formatted data.
- raillabel_providerkit.convert(data: dict, loader_class: type[LoaderABC] | None = None) Scene¶
Convert annotation data from provider formats into raillabel.
- Parameters:
data (dict) – Raw data in the provider format, that should be converted.
loader_class (child-class of raillabel_providerkit.LoaderABC, optional) – Class used for converting the provider formatted data. If None is provided, then one is chosen based on criteria present in the data. Default is None.
- Returns:
scene – Scene with the loaded data in the raillabel format.
- Return type:
raillabel.Scene
- Raises:
raillabel.UnsupportedFormatError – if the annotation file does not match any loaders.
- raillabel_providerkit.export_scenes(input_folder: Path, output_folder: Path, formats: list[Literal['json', 'csv']] | None = None, quiet: bool = False) dict[str, int]¶
Export multiple scenes from a folder to different formats.
- Parameters:
input_folder (Path) – Folder containing scene JSON files to export
output_folder (Path) – Folder where exported files will be saved
formats (list[ExportFormat] | None, optional) – List of formats to export to. Can contain ‘json’, ‘csv’, or both. If None, defaults to [‘json’].
quiet (bool, optional) – If True, disables progress bars. Default is False.
- Returns:
Dictionary with export statistics: - ‘total’: Total number of scenes found - ‘exported’: Number of successfully exported scenes - ‘errors’: Number of scenes that failed to export
- Return type:
- Raises:
ValueError – If formats list is empty or contains invalid format names
FileNotFoundError – If input_folder does not exist
- raillabel_providerkit.get_ontology_path(ontology_name: str) Path¶
Get the path to a built-in ontology file.
- Parameters:
ontology_name (str) – Name of the ontology to load. Supported values: - “osdar26”: Extended railway environment ontology (25 classes) - “automatedtrain”: Safety-critical classes for automated train operation - “osdar23”: Original OSDAR23 dataset ontology
- Returns:
Path to the ontology YAML file (located in config/ontologies/)
- Return type:
Path
- Raises:
ValueError – If the ontology name is not recognized
- raillabel_providerkit.get_schema_path(schema_name: str) Path¶
Get the path to a built-in schema file.
- Parameters:
schema_name (str) – Name of the schema to load. Supported values: - “raillabel”: Generic RailLabel JSON schema (OpenLABEL subset) - “osdar23”: OSDAR23-specific RailLabel schema - “osdar26”: OSDAR26-specific RailLabel schema - “automatedtrain”: AutomatedTrain-specific RailLabel schema - “understand_ai_t4”: Understand.AI T4 format schema - “ontology”: Ontology validation schema (v2)
- Returns:
Path to the schema file (located in config/schemas/)
- Return type:
Path
- Raises:
ValueError – If the schema name is not recognized
Notes
The ontology-specific schemas (osdar23, osdar26, automatedtrain) are currently identical copies of the base raillabel schema, as they share the same OpenLABEL structure. Ontology-specific validation is handled by the ontology YAML files.
- raillabel_providerkit.list_available_ontologies() list[str]¶
List all available built-in ontologies.
- raillabel_providerkit.validate(scene_source: dict | Path, ontology_source: dict | Path | None = None, validate_for_empty_frames: bool = True, validate_for_rail_side_order: bool = True, validate_for_missing_ego_track: bool = True, validate_for_ego_track_both_rails: bool = True, validate_for_sensors: bool = True, validate_for_uris: bool = True, validate_for_dimensions: bool = True, validate_for_horizon: bool = True, validate_for_annotation_type_per_sensor: bool = True, validate_for_transition: bool = True, horizon_tolerance_percent: float = 10.0) list[Issue]¶
Validate a scene based on the Deutsche Bahn Requirements.
- Args:
scene_source: The scene either as a dictionary or as a Path to the scene source file. ontology_source: The dataset ontology as a dictionary or as a Path to the ontology YAML
file. If not None, issues are returned if the scene contains annotations with invalid attributes or object types. Default is None.
- validate_for_empty_frames (optional): If True, issues are returned if the scene contains
sensor frames without annotations. Only checks middle/center cameras and lidar sensors. Default is True.
- validate_for_rail_side_order: If True, issues are returned if the scene contains track with
a mismatching rail side order. Default is True.
- validate_for_missing_ego_track: If True, issues are returned if the scene contains frames
where the ego track (the track the recording train is driving on) is missing. Checks both middle/center cameras and lidar sensors. Default is True.
- validate_for_ego_track_both_rails: If True, issues are returned if the ego track rails
don’t have overlapping y-ranges or don’t have exactly one left and one right rail. Default is True.
- validate_for_sensors: If True, issues are returned if the scene contains sensors that are
not supported or have the wrong sensor type.
- validate_for_uris: If True, issues are returned if the uri fields in the scene contain
unsupported values.
- validate_for_dimensions: If True, issues are returned if the dimensions of cuboids are
outside the expected values range.
validate_for_horizon: If True, issues are returned if annotations cross the horizon. validate_for_annotation_type_per_sensor: Validate that annotation types match sensor types. validate_for_transition: If True, issues are returned if transition annotations have
identical startTrack and endTrack values. Default is True.
- horizon_tolerance_percent: Tolerance buffer as percentage above the horizon line.
Annotations within this buffer zone are considered valid. For example, 10.0 means annotations up to 10% above the horizon line are accepted. Default is 10.0 (10% buffer). This only affects track and transition annotations.
- Returns:
List of all requirement errors in the scene. If an empty list is returned, then there are no errors present and the scene is valid.