raillabel.filter.include_attributes_filter module

class raillabel.filter.include_attributes_filter.IncludeAttributesFilter(attributes: dict[str, bool | float | str | list | None])

Bases: _AnnotationLevelFilter

Filter out all annotations in the scene, that do NOT have matching attributes.

If an attribute has None as the value, all annotations are excluded, that do not have this attribute. If the value is anything other than None, all annotations are excluded that do not have the attribute or where the value does not match.

_abc_impl = <_abc._abc_data object>
attributes: dict[str, bool | float | str | list | None]
passes_filter(_: UUID, annotation: Bbox | Cuboid | Poly2d | Poly3d | Seg3d, __: Scene) bool

Assess if an annotation passes this filter.

For each (required_attribute_name, required_attribute_value) in the filter: - First, check if the annotation contains the required attribute name. - If required_attribute_value is None, only presence of the key is required. - Otherwise, the annotation’s attribute value must exactly match

the required_attribute_value to pass the filter.