evlib.dataloaders

Low level data loaders for event camera datasets.

class evlib.dataloaders.DSECDataLoader(root, sequence, split='train', camera='left', load_images=False, load_flow_forward=False, load_flow_backward=False, load_disparity=False, load_imu=False, load_lidar=False, load_calibration=False, load_rectify_map=True, event_load_mode='lazy', prerectify_events=False)

Low level I/O for a single DSEC sequence.

The expected root contains DSEC sequence directories, either directly as produced by the multi-sequence ZIP archives, or grouped by split such as train/<sequence>/events/left/events.h5 and test/<sequence>/images/left/rectified/*.png. Passing a split directory itself, such as /path/to/DSEC/train, is also supported. Passing the sequence directory itself is supported when its basename matches sequence.

By default events are returned in raw sensor coordinates and rectify_events() is an explicit per slice call. Pass prerectify_events=True with event_load_mode="cached" to rectify the cached event arrays once at init. Subsequent load_events() calls then return pre rectified data and rectify_events() is idempotent.

All public timestamps are in seconds (float64).

load_frame_sample uses forward flow intervals when forward flow is loaded, otherwise it spans consecutive image timestamps. Images are selected by nearest timestamp at the sample start/end, disparity by nearest timestamp at the sample end, and backward flow by matching the same anchor timestamp as the sample start.

Parameters:
  • root (str) – Root directory containing the DSEC dataset, a directory of sequence folders, a split directory such as /path/to/DSEC/train, or the sequence directory itself.

  • sequence (str) – Sequence name (e.g. "zurich_city_01_a").

  • split (DSECSplit) – Dataset split, "train" or "test".

  • camera (DSECCamera) – Event camera side, "left" or "right".

  • load_images (LoadMode) – LoadMode for rectified frame camera images.

  • load_flow_forward (LoadMode) – LoadMode for forward optical flow GT.

  • load_flow_backward (LoadMode) – LoadMode for backward optical flow GT.

  • load_disparity (LoadMode) – LoadMode for disparity maps.

  • load_imu (LoadMode) – LoadMode for IMU samples from data/<drive_prefix>/lidar_imu.bag.

  • load_lidar (LoadMode) – LoadMode for Velodyne point clouds from data/<drive_prefix>/lidar_imu.bag.

  • load_calibration (bool) – If True, load cam_to_cam.yaml calibration.

  • load_rectify_map (bool) – If True, load event rectification map from HDF5.

  • event_load_mode (ResidentLoadMode) – "lazy" to keep HDF5 open and read on demand (default), or "cached" to load all events into RAM.

  • prerectify_events (bool) – If True (cached mode only), rectify + filter the cached event arrays at init so per call rectification is free. Requires event_load_mode="cached" and load_rectify_map=True. With this flag, rectify_events() becomes idempotent so downstream code does not need to branch on mode.

EVENT_SHAPE: tuple[int, int] = (480, 640)
IMAGE_SHAPE: tuple[int, int] = (1080, 1440)
load_events(start_index, end_index)

Load events in [start_index, end_index). Returns mutable copies.

Parameters:
  • start_index (int)

  • end_index (int)

Return type:

RawEvents

property num_events: int

Total number of events.

time_to_index(t)

Find the last event index strictly before time t (seconds).

Parameters:

t (float)

Return type:

int

index_to_time(index)

Return the timestamp (absolute seconds) of event at index.

Parameters:

index (int)

Return type:

float

times_to_indices(timestamps)

Vectorized time_to_index().

Parameters:

timestamps (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

Return type:

ndarray[Any, dtype[int64]]

indices_to_times(indices)

Vectorized index_to_time().

Parameters:

indices (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

Return type:

ndarray[Any, dtype[float64]]

get_events_by_time(t_start, t_end)

Load events whose timestamps fall in [t_start, t_end).

Parameters:
Return type:

RawEvents

close()

Release open file handles and drop small lazy decode caches.

Return type:

None

property t_offset: int64

Temporal offset in microseconds added to raw event timestamps.

property ms_to_idx: ndarray[Any, dtype[int64]]

Millisecond to event index lookup table.

ms_to_idx[ms] gives the first event index whose timestamp is >= ms * 1000 microseconds (relative to t_offset).

property event_load_mode: LoadingType

Configured event loading mode.

property has_rectify_map: bool

Whether the event rectification map is loaded.

property events_prerectified: bool

Whether cached events were prerectified at init.

When True, load_events returns rectified event coordinates and rectify_events() is idempotent.

property rectify_map: ndarray[Any, dtype[float32]] | None

Event rectification map (H, W, 2) or None.

rectify_events(events)

Apply the DSEC event rectification map.

Returns a new RawEvents with rectified coordinates. Events whose raw coordinates are outside the DSEC sensor bounds, or whose rectified pixel falls outside the sensor, are dropped.

If the loader was constructed with prerectify_events=True the input is returned unchanged.

Raises:

RuntimeError – If the rectification map is not loaded.

Parameters:

events (RawEvents)

Return type:

RawEvents

property has_images: bool

Whether images are available.

property image_timestamps: ndarray[Any, dtype[float64]] | None

Image timestamps in seconds, or None.

property image_exposure_timestamps: ndarray[Any, dtype[float64]] | None

Image exposure intervals (N, 2) in seconds, or None.

property num_images: int

Number of available images.

load_image(index)

Load a single image by index.

Returns an (H, W) or (H, W, C) uint8 array. Cached mode returns a view into the preloaded stack. Lazy mode decodes from disk with a small LRU over recent indices.

Parameters:

index (int)

Return type:

ndarray[Any, dtype[uint8]]

find_nearest_image_index(t)

Return the image index nearest to time t (in seconds).

Parameters:

t (float)

Return type:

int

property has_flow_forward: bool

Whether forward optical flow is available.

property has_flow_backward: bool

Whether backward optical flow is available.

property flow_forward_timestamps: ndarray[Any, dtype[float64]] | None

Forward flow timestamps (N, 2) in seconds, or None.

property flow_backward_timestamps: ndarray[Any, dtype[float64]] | None

Backward flow timestamps (N, 2) in seconds, or None.

property num_flow_forward: int

Number of forward flow frames.

property num_flow_backward: int

Number of backward flow frames.

load_flow_forward(index)

Load a single forward optical flow field by index.

Parameters:

index (int)

Return type:

tuple[ndarray[Any, dtype[float32]], ndarray[Any, dtype[bool_]]]

load_flow_backward(index)

Load a single backward optical flow field by index.

Parameters:

index (int)

Return type:

tuple[ndarray[Any, dtype[float32]], ndarray[Any, dtype[bool_]]]

property has_disparity: bool

Whether disparity maps are available.

property disparity_timestamps: ndarray[Any, dtype[float64]] | None

Disparity timestamps in seconds, or None.

property num_disparity_frames: int

Number of disparity frames.

load_disparity(index)

Load a single disparity map by index.

Returns:

(H, W) float32. valid: (H, W) bool validity mask.

Return type:

disparity

Parameters:

index (int)

property has_imu: bool

Whether IMU samples are available.

property imu_timestamps: ndarray[Any, dtype[float64]] | None

IMU sample timestamps in seconds, or None.

property imu_data: DSECImuData | None

Cached IMU data, or None when IMU is lazy or unavailable.

property num_imu_samples: int

Number of available IMU samples.

load_imu(t_start, t_end)

Load IMU samples whose timestamps fall in [t_start, t_end).

Parameters:
Return type:

DSECImuData

property has_lidar: bool

Whether Velodyne LiDAR scans are available.

property lidar_timestamps: ndarray[Any, dtype[float64]] | None

Return LiDAR scan timestamps in seconds, or None.

property num_lidar_scans: int

Number of available LiDAR scans.

iter_events(num_events=None, time_window=None)

Yield class RawEvents chunks.

Exactly one of num_events or time_window must be given.

Parameters:
  • num_events (int | None) – Chunk size in number of events (positive).

  • time_window (float | None) – Chunk duration in seconds (positive).

Raises:

ValueError – If neither or both arguments are given, or if the given value is not positive.

Return type:

Iterator[RawEvents]

property lidar_frame_id: str | None

Frame id used by the LiDAR PointCloud2 messages, or None.

load_lidar(index)

Load one Velodyne scan by index.

The returned points array is a compact structured NumPy array using the PointCloud2 field names and dtypes, commonly x, y, z, intensity, ring, and time for DSEC.

Parameters:

index (int)

Return type:

DSECLidarScan

load_lidar_by_time(t_start, t_end)

Load LiDAR scans whose timestamps fall in [t_start, t_end).

Parameters:
Return type:

list[DSECLidarScan]

property has_calibration: bool

Whether cam to cam calibration data is loaded.

property calibration: dict[str, Any] | None

Parsed calibration YAML dict, or None.

A deep copy is returned so callers cannot mutate process global calibration cache entries shared by later loader instances.

property cam_to_lidar_calibration: dict[str, Any] | None

Parsed data/<drive_prefix>/cam_to_lidar.yaml dict, or None.

property cam_to_imu_calibration: dict[str, Any] | None

Parsed imu_calibration/cam0_to_imu0.yaml dict, or None.

property imu_calibration: dict[str, Any] | None

Parsed imu_calibration/imu0_params.yaml dict, or None.

property num_samples: int

Number of iterable samples.

Returns num_flow_forward if flow is loaded, else num_images - 1 if images are loaded (each sample spans two consecutive images), else 0.

load_frame_sample(index)

Load a synchronized sample dict for the given index.

The sample time interval is taken from the forward flow timestamps file (if loaded) or from consecutive image timestamps. Per the DSEC documentation, forward[k] = (t_k, t_{k+1}) and backward[k] = (t_k, t_{k-1}) are both anchored at t_k. Backward flow is associated with the sample by matching its anchor (t_start) to the sample’s t_start rather than by reusing index. flow_backward is None when no backward entry shares the anchor. Backward coverage can be a strict subset of forward coverage.

Parameters:

index (int)

Return type:

DSECSample

class evlib.dataloaders.DataLoaderBase

ABC for low level event data I/O

Subclasses implement the abstract methods for a specific file format or data source. The concrete convenience methods are built on top of the abstract primitives.

abstractmethod load_events(start_index, end_index)

Load events in [start_index, end_index).

Parameters:
  • start_index (int)

  • end_index (int)

Return type:

RawEvents

abstract property num_events: int

Total number of events.

abstractmethod time_to_index(t)

Find the index of the last event strictly before time t.

May return -1 if no event precedes t.

Parameters:

t (float)

Return type:

int

abstractmethod index_to_time(index)

Return the timestamp of the event at index.

Parameters:

index (int)

Return type:

float

times_to_indices(timestamps)

Vectorized form of time_to_index().

Subclasses may override this for a more efficient implementation.

Parameters:

timestamps (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

Return type:

ndarray[Any, dtype[int64]]

indices_to_times(indices)

Vectorized form of index_to_time().

Subclasses may override this for a more efficient implementation.

Parameters:

indices (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

Return type:

ndarray[Any, dtype[float64]]

abstractmethod close()

Release resources (e.g. file handles, etc.).

Return type:

None

get_events_by_time(t_start, t_end)

Load events whose timestamps fall in [t_start, t_end).

Parameters:
Return type:

RawEvents

iter_events(num_events=None, time_window=None)

Yield class RawEvents chunks.

Exactly one of num_events or time_window must be given.

Parameters:
  • num_events (int | None) – Chunk size in number of events (positive).

  • time_window (float | None) – Chunk duration in seconds (positive).

Raises:

ValueError – If neither or both arguments are given, or if the given value is not positive.

Return type:

Iterator[RawEvents]

class evlib.dataloaders.LoadingType(value)

internal loading state for dataset modalities.

OFF = 'off'
LAZY = 'lazy'
CACHED = 'cached'
classmethod from_value(value, *, name='loading type')
Parameters:
  • value (bool | Literal['lazy', 'cached'] | ~evlib.dataloaders._storage_common.LoadingType)

  • name (str)

Return type:

LoadingType

classmethod from_resident_value(value, *, name)
Parameters:
  • value (Literal['lazy', 'cached'] | ~evlib.dataloaders._storage_common.LoadingType)

  • name (str)

Return type:

LoadingType

property should_load: bool
property should_cache: bool
encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

class evlib.dataloaders.MVSECDataLoader(root, sequence, camera='left', load_gt_flow=False, load_calibration=False, load_imu=False, load_odometry_npz=False, load_gt_odometry=False, load_gt_poses=False, load_gt_depth_raw=False, load_gt_depth_rect=False, load_gt_flow_hdf5=False, load_gt_blended=False, load_velodyne=False, event_load_mode='cached', image_load_mode='cached', cache_dir=None)

Low level I/O for a single MVSEC sequence.

Handles HDF5 reading, NPZ decompression, calibration loading, and typed column caching. Use directly for custom access patterns (overlapping windows, multiscale, etc.) or let MVSECDataset wrap it for PyTorch style frame indexed sampling.

Large HDF5 backed modalities (depth, blended images, HDF5 flow, and velodyne) support a per modality loading strategy via the LoadMode tristate:

  • False – do not load this modality.

  • True or "lazy" – lazy load on demand (HDF5 handle stays open).

  • "cached" – read entirely into memory during __init__.

Small modalities (IMU, odometry NPZ, GT odometry, GT poses) are always cached in memory when enabled because they are tiny.

The default profile is intentionally lean:

  • events are cached in RAM

  • grayscale images are cached in RAM

  • optional GT and calibration modalities stay disabled until requested

Parameters:
  • root (str) – Directory containing the MVSEC dataset files.

  • sequence (str) – Sequence name (e.g. "indoor_flying1").

  • camera (str) – "left" or "right".

  • load_gt_flow (LoadMode) – LoadMode for GT optical flow from NPZ.

  • load_calibration (bool) – If True, load calibration rectification maps.

  • load_imu (bool) – If True, cache IMU data from data HDF5.

  • load_odometry_npz (bool) – If True, cache odometry from *_odom.npz.

  • load_gt_odometry (bool) – If True, cache LOAM odometry SE(3) from gt HDF5.

  • load_gt_poses (bool) – If True, cache Cartographer poses SE(3) from gt HDF5.

  • load_gt_depth_raw (LoadMode) – LoadMode for raw depth maps from gt HDF5.

  • load_gt_depth_rect (LoadMode) – LoadMode for rectified depth maps from gt HDF5.

  • load_gt_flow_hdf5 (LoadMode) – LoadMode for optical flow from gt HDF5.

  • load_gt_blended (LoadMode) – LoadMode for blended images from gt HDF5.

  • load_velodyne (LoadMode) – LoadMode for velodyne lidar from data HDF5.

  • event_load_mode (ResidentLoadMode) – "cached" to keep all events in RAM or "lazy" to build and use a typed read only sidecar cache.

  • image_load_mode (ResidentLoadMode) – "cached" to keep all images in RAM or "lazy" to read frames from HDF5 on demand.

  • cache_dir (Optional[str]) – Optional root directory for MVSEC sidecar caches.

IMAGE_SHAPE: Tuple[int, int] = (260, 346)
VALID_FRAMES: Dict[str, Tuple[int, int | None]] = {'indoor_flying1': (60, 1340), 'indoor_flying2': (140, 1500), 'indoor_flying3': (100, 1711), 'indoor_flying4': (104, 380), 'outdoor_day1': (0, 5020), 'outdoor_day2': (30, None)}
load_events(start_index, end_index)

Load events in [start_index, end_index). Returns mutable copies.

Parameters:
  • start_index (int)

  • end_index (int)

Return type:

RawEvents

property num_events: int

Total number of events.

time_to_index(t)

Find the index of the last event strictly before time t.

May return -1 if no event precedes t.

Parameters:

t (float)

Return type:

int

index_to_time(index)

Return the timestamp of the event at index.

Parameters:

index (int)

Return type:

float

times_to_indices(timestamps)

Vectorized form of time_to_index().

Subclasses may override this for a more efficient implementation.

Parameters:

timestamps (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

Return type:

ndarray[Any, dtype[int64]]

indices_to_times(indices)

Vectorized form of index_to_time().

Subclasses may override this for a more efficient implementation.

Parameters:

indices (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

Return type:

ndarray[Any, dtype[float64]]

close()

Release resources (e.g. file handles, etc.).

Return type:

None

property has_gt_flow: bool
load_optical_flow(t1, t2)

Load GT optical flow between two timestamps.

Returns (H, W, 2) float32 where channels are [flow_x, flow_y]. Estimates displacement over [t1, t2) by propagating through GT frames.

Parameters:
Return type:

ndarray[Any, dtype[float32]]

get_gt_timestamps(event_index)

Return (t_before, t_after) GT timestamps bracketing event_index.

Parameters:

event_index (int)

Return type:

Tuple[float | None, float | None]

gt_time_list()

Return all GT timestamps. Raises if GT flow not loaded.

Return type:

ndarray[Any, dtype[float64]]

property frame_timestamps: ndarray[Any, dtype[float64]] | None
property frame_event_indices: ndarray[Any, dtype[int64]] | None
property event_load_mode: LoadingType
property image_load_mode: LoadingType
property has_images: bool
property images: ndarray[Any, dtype[uint8]] | None

Precached images, or None if lazy/unavailable.

property num_frames: int
normalize_frame_index(frame_index)

Normalize negative index and validate bounds.

Parameters:

frame_index (int)

Return type:

int

find_nearest_frame_index(t)
Parameters:

t (float)

Return type:

int

load_frame_sample(frame_index)

Load a synchronized single camera MVSEC sample for one frame.

Parameters:

frame_index (int)

Return type:

dict[str, object]

load_image(frame_index)

Load a single grayscale frame by index.

Parameters:

frame_index (int)

Return type:

ndarray[Any, dtype[uint8]] | None

property valid_frame_range: Tuple[int, int | None] | None
property has_calibration: bool
undistort_events(events)

Apply calibration rectification maps to events.

Returns new RawEvents with rectified coordinates. Raises RuntimeError if calibration maps are not loaded.

Parameters:

events (RawEvents)

Return type:

RawEvents

property has_imu: bool
property imu_timestamps: ndarray[Any, dtype[float64]] | None
property imu_data: ndarray[Any, dtype[float64]] | None

Full IMU array (N, 6) [ax, ay, az, gx, gy, gz], or None.

load_imu(t_start, t_end)

Return IMU readings and timestamps in [t_start, t_end), or None.

Parameters:
Return type:

Tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]] | None

property has_odometry_npz: bool
property odometry_npz: MVSECOdometryData | None
property has_gt_odometry: bool
property gt_odometry: ndarray[Any, dtype[float64]] | None

LOAM odometry SE(3) poses (N, 4, 4), or None.

property gt_odometry_timestamps: ndarray[Any, dtype[float64]] | None
property has_gt_pose: bool
property gt_pose: ndarray[Any, dtype[float64]] | None

Cartographer SE(3) poses (N, 4, 4), or None.

property gt_pose_timestamps: ndarray[Any, dtype[float64]] | None
load_nearest_pose(t, source='pose')

Return the nearest SE(3) pose (4, 4) to time t.

Parameters:
  • t (float) – Query timestamp.

  • source (str) – "pose" for Cartographer or "odometry" for LOAM.

Return type:

ndarray[Any, dtype[float64]] | None

property has_gt_depth: bool
property has_gt_depth_raw: bool
property has_gt_depth_rect: bool
property depth_raw_images: ndarray[Any, dtype[float32]] | None
property depth_rect_images: ndarray[Any, dtype[float32]] | None
property gt_depth_raw_timestamps: ndarray[Any, dtype[float64]] | None
property gt_depth_rect_timestamps: ndarray[Any, dtype[float64]] | None
property gt_depth_timestamps: ndarray[Any, dtype[float64]] | None
property num_gt_depth_raw_frames: int
get_events_by_time(t_start, t_end)

Load events whose timestamps fall in [t_start, t_end).

Parameters:
Return type:

RawEvents

iter_events(num_events=None, time_window=None)

Yield class RawEvents chunks.

Exactly one of num_events or time_window must be given.

Parameters:
  • num_events (int | None) – Chunk size in number of events (positive).

  • time_window (float | None) – Chunk duration in seconds (positive).

Raises:

ValueError – If neither or both arguments are given, or if the given value is not positive.

Return type:

Iterator[RawEvents]

property num_gt_depth_rect_frames: int
property num_gt_depth_frames: int
load_depth_raw(frame_index)
Parameters:

frame_index (int)

Return type:

ndarray[Any, dtype[float32]] | None

load_depth_rect(frame_index)
Parameters:

frame_index (int)

Return type:

ndarray[Any, dtype[float32]] | None

load_depth(frame_index, rectified=False)
Parameters:
  • frame_index (int)

  • rectified (bool)

Return type:

ndarray[Any, dtype[float32]] | None

property has_gt_blended: bool
property gt_blended_timestamps: ndarray[Any, dtype[float64]] | None
property blended_images: ndarray[Any, dtype[uint8]] | None
load_blended_image(frame_index)
Parameters:

frame_index (int)

Return type:

ndarray[Any, dtype[uint8]] | None

property has_gt_flow_hdf5: bool
property flow_hdf5_frames: ndarray[Any, dtype[float64]] | None
property gt_flow_hdf5_timestamps: ndarray[Any, dtype[float64]] | None
load_flow_hdf5(frame_index)

Load a single flow field (2, H, W) float64 from gt HDF5.

Parameters:

frame_index (int)

Return type:

ndarray[Any, dtype[float64]] | None

property has_velodyne: bool
property velodyne_scans: ndarray[Any, dtype[float32]] | None
property velodyne_timestamps: ndarray[Any, dtype[float64]] | None
property num_velodyne_scans: int
load_velodyne_scan(scan_index)

Load a single velodyne scan (N_points, 4) [x, y, z, intensity].

Parameters:

scan_index (int)

Return type:

ndarray[Any, dtype[float32]] | None

class evlib.dataloaders.MVSECOdometryData(timestamps, linear_velocity, position, quaternion, angular_velocity)

Container for MVSEC odometry samples loaded from *_odom.npz.

Parameters:
timestamps: ndarray[Any, dtype[float64]]
linear_velocity: ndarray[Any, dtype[float64]]
position: ndarray[Any, dtype[float64]]
quaternion: ndarray[Any, dtype[float64]]
angular_velocity: ndarray[Any, dtype[float64]]

Modules

utils

Shared helpers for dataloader indexing, caching, and optional decoding.