evlib.datasets.mvsec¶
MVSEC dataset loader.
- Expected file structure:
{root}/{sequence}_data.hdf5 {root}/{sequence}_gt_flow_dist.npz (optional) {root}/{sequence}_odom.npz (optional) {root}/{sequence}_gt.hdf5 (optional) {root}/{category}_{camera}_x_map.txt (optional) {root}/{category}_calib/{category}_{camera}_x_map.txt (optional, alternative)
category is the sequence name without its trailing digit (e.g. “indoor_flying” for “indoor_flying1”) Calibration maps are searched in root first, then in {root}/{category}_calib/
Reference: https://daniilidis-group.github.io/mvsec/ Zhu, A. Z., Thakur, D., Ozaslan, T., Pfrommer, B., Kumar, V., & Daniilidis, K. (2018). The Multi Vehicle Stereo Event Camera Dataset: An Event Camera Dataset for 3D Perception. IEEE Robotics and Automation Letters, 3(3), 2032-2039.
Classes
|
MVSEC dataset (block access / map style). |
|
Streaming iterator over MVSEC frames. |
- class evlib.datasets.mvsec.MVSECDataset(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)¶
MVSEC dataset (block access / map style).
Thin wrapper around class MVSECDataLoader that adds a frame indexed __getitem__ / __len__ contract suitable for PyTorch DataLoader integration.
For custom access patterns (overlapping windows, multi-scale pyramids, arbitrary time slicing), use the attr loader directly
ds = MVSECDataset(root, “indoor_flying1”) loader = ds.loader events = loader.load_events(0, 10000) events = loader.get_events_by_time(t_start, t_end)
Or instantiate class MVSECDataLoader standalone, no Dataset needed.
- Parameters:
root (str) – Directory containing the MVSEC files.
sequence (str) – Sequence name, e.g. “indoor_flying1”.
camera (str) – “left” or “right”.
load_gt_flow (LoadMode) – LoadMode for ground truth optical flow.
load_calibration (bool) – If True, load calibration maps.
load_imu (bool) – If True, cache IMU data.
load_odometry_npz (bool) – If True, cache odometry from NPZ.
load_gt_odometry (bool) – If True, cache LOAM odometry from gt HDF5.
load_gt_poses (bool) – If True, cache Cartographer poses 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"or"lazy"for events.image_load_mode (ResidentLoadMode) –
"cached"or"lazy"for images.cache_dir (Optional[str]) – Optional root directory for MVSEC sidecar caches.
- property loader: MVSECDataLoader¶
Underlying MVSECDataLoader.
- close()¶
Release resources (file handles, etc.).
- Return type:
None
- load_events(start_index, end_index)¶
Load events in [start_index, end_index).
- time_to_index(t)¶
Find the last event strictly before time t.
- index_to_time(index)¶
Return the timestamp of the event at index.
- times_to_indices(timestamps)¶
Vectorized form of
time_to_index().
- indices_to_times(indices)¶
Vectorized form of
index_to_time().
- get_events_by_time(t_start, t_end)¶
Load events in [t_start, t_end).
- iter_events(num_events=None, time_window=None)¶
Yield RawEvents chunks.
- load_optical_flow(t1, t2)¶
Load ground truth optical flow between two timestamps.
- get_gt_timestamps(event_index)¶
Return the floor and ceil GT timestamps bracketing event_index.
- property frame_timestamps: ndarray[Any, dtype[float64]] | None¶
Grayscale frame timestamps from HDF5, or None if unavailable.
- property frame_event_indices: ndarray[Any, dtype[int64]] | None¶
Event indices aligned to grayscale frames, or None if unavailable.
- property event_load_mode: LoadingType¶
Configured event loading mode.
- property image_load_mode: LoadingType¶
Configured image loading mode.
- load_image(frame_index)¶
Load a single grayscale frame by index.
- property images: ndarray[Any, dtype[uint8]] | None¶
Cached grayscale image stack, or None if lazy/unavailable.
- find_nearest_frame_index(t)¶
Find the nearest grayscale frame to time t.
- undistort_events(events)¶
Apply calibration rectification maps to events.
- load_imu(t_start, t_end)¶
Return IMU readings and timestamps in [t_start, t_end).
- property odometry_npz: MVSECOdometryData | None¶
MVSEC odometry data from NPZ, or None.
- 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¶
LOAM odometry timestamps, or None.
- property gt_pose_timestamps: ndarray[Any, dtype[float64]] | None¶
Cartographer pose timestamps, or None.
- load_nearest_pose(t, source='pose')¶
Return the nearest SE(3) pose (4, 4) to time t.
- property gt_depth_raw_timestamps: ndarray[Any, dtype[float64]] | None¶
Raw depth timestamps, or None.
- property gt_depth_rect_timestamps: ndarray[Any, dtype[float64]] | None¶
Rectified depth timestamps, or None.
- property depth_raw_images: ndarray[Any, dtype[float32]] | None¶
Cached raw depth image stack, or None if lazy/unavailable.
- property depth_rect_images: ndarray[Any, dtype[float32]] | None¶
Cached rectified depth image stack, or None if lazy/unavailable.
- load_depth(frame_index, rectified=False)¶
Load a single depth frame.
- load_depth_raw(frame_index)¶
Load a single raw depth frame.
- load_depth_rect(frame_index)¶
Load a single rectified depth frame.
- property gt_blended_timestamps: ndarray[Any, dtype[float64]] | None¶
Blended image timestamps, or None.
- property blended_images: ndarray[Any, dtype[uint8]] | None¶
Cached blended image stack, or None if lazy/unavailable.
- load_blended_image(frame_index)¶
Load a single blended image.
- property flow_hdf5_frames: ndarray[Any, dtype[float64]] | None¶
Cached GT HDF5 flow stack, or None if lazy/unavailable.
- property gt_flow_hdf5_timestamps: ndarray[Any, dtype[float64]] | None¶
GT HDF5 flow timestamps, or None.
- load_flow_hdf5(frame_index)¶
Load a single flow field from gt HDF5.
- property velodyne_timestamps: ndarray[Any, dtype[float64]] | None¶
Velodyne scan timestamps, or None.
- class evlib.datasets.mvsec.MVSECIterator(root, sequence, **kwargs)¶
Streaming iterator over MVSEC frames.
Yields the same dicts as
MVSECDataset.__getitem__(), frame by frame.- Parameters:
- reset()¶
Reset iteration cursor to the beginning.
- Return type:
None
- close()¶
Release resources (file handles, etc.).
- Return type:
None