raillabel.format.frame_interval module

class raillabel.format.frame_interval.FrameInterval(start: int, end: int)

Bases: object

Closed interval of frames.

end: int

Ending frame number of the interval (inclusive).

classmethod from_frame_ids(frame_ids: list[int]) list[FrameInterval]

Convert a list of frame uids into FrameIntervals.

Example: .. code-block:: python

FrameInterval.from_frame_ids([0, 1, 2, 3, 9, 12, 13, 14]) == [

FrameInterval(0, 3), FrameInterval(9, 9), FrameInterval(12, 14),

]

classmethod from_json(json: JSONFrameInterval) FrameInterval

Construct an instant of this class from RailLabel JSON data.

start: int

Initial frame number of the interval (inclusive).

to_json() JSONFrameInterval

Export this object into the RailLabel JSON format.

raillabel.format.frame_interval._slice_into_intervals(sorted_frame_ids: list[int]) list[list[int]]