raillabel_providerkit.convert.loader_classes package

Submodules

raillabel_providerkit.convert.loader_classes.loader_understand_ai module

class raillabel_providerkit.convert.loader_classes.loader_understand_ai.LoaderUnderstandAi

Bases: LoaderABC

Loader class for the Understand.Ai Trains4 annotation format.

scene

Loaded raillabel.format.understand_ai.Scene with the data.

Type:

raillabel.format.understand_ai.Scene

warnings

List of warning strings, that have been found during the execution of load().

Type:

t.List[str]

SCHEMA_PATH: Path = PosixPath('/home/runner/work/raillabel-providerkit/raillabel-providerkit/raillabel_providerkit/format/understand_ai_t4_schema.json')
load(data: dict, validate_schema: bool = False) Scene

Load the data into a UAIScene and return it.

Parameters:
  • data (dict) – A dictionary loaded from a JSON-file.

  • validate_schema (bool) – If True, the annotation data is validated via the respective schema. This is highly recommended, as not validating the data may lead to Errors during loading or while handling the scene. However, validating may increase the loading time. Default is False.

Returns:

scene – The loaded scene with the data.

Return type:

raillabel.format.understand_ai.UAIScene

scene: Scene
supports(data: dict) bool

Determine if the loader is suitable for the data (lightweight).

Parameters:

data (dict) – A dictionary loaded from a JSON-file.

Returns:

If True, the Loader class is suitable for the data.

Return type:

bool

validate_schema(data: dict) list[str]

Check if the schema is correct.

warnings: list[str]

Module contents

Package containing the loader classes for all supported formats.

class raillabel_providerkit.convert.loader_classes.LoaderABC

Bases: ABC

Abstract base class of the annotation file loaders.

For every annotation format, that can be loaded via raillabel, a loader class should exists, that inherites from this class.

scene

Loaded raillabel.Scene with the data.

Type:

raillabel.Scene

warnings

List of warning strings, that have been found during the execution of load().

Type:

t.List[str]

SCHEMA_PATH

Absolute path to the JSON schema.

Type:

Path

SCHEMA_PATH: Path
abstract load(data: dict, validate: bool = True) Scene

Load JSON-data into a raillabel.Scene.

Any non-critical errors are stored in the warnings-property.

Parameters:
  • data (dict) – A dictionary loaded from a JSON-file.

  • validate (bool) – If True, the annotation data is validated via the respective schema. This is highly recommended, as not validating the data may lead to Errors during loading or while handling the scene. However, validating may increase the loading time. Default is True.

Returns:

scene – The loaded scene with the data.

Return type:

raillabel.Scene

scene: Scene
abstract supports(data: dict) bool

Determine if the loader class is suitable for the data.

This is performed based on hints in the data structure and can therefore be done efficiently.

Parameters:

data (dict) – A dictionary loaded from a JSON-file.

Returns:

If True, the Loader class is suitable for the data.

Return type:

bool

warnings: list[str]