evloader is a Python package for loading event-camera datasets into PyTorch and
PyTorch Geometric workflows. It provides dataset-specific loaders for DSEC,
EVIMO/EV-IMO, Gen1, MVSEC, and N-Caltech101, plus shared utilities for event
representations, event splitting, patchification, optical flow, and
visualization.
The project is designed for research code where each dataset has its own natural
output contract. Some loaders return dictionaries, some return sequences of
dictionaries, some return PyG Data objects, and MVSEC exposes loaded arrays as
attributes.
- DSEC: base, test, recurrent, flow, hydra, cached hydra, high-frequency
hydra, raw, by-event-index, time-surface, patchified, semantic, raw semantic,
detection, and
DatasetProviderloaders. - EVIMO / EV-IMO: training, random-by-number, test, test-by-number, import-by-number, EV-IMO, frame, and unpacked-frame loaders.
- Gen1: raw
PSEELoader, processedEventDataset, standard datamodule, and patchified datamodule. - MVSEC: HDF5 data and ground-truth attribute loader.
- N-Caltech101: standard and patchified PyG outputs.
Python >=3.8.5 is required.
git clone https://github.com/senecobis/ev-loader.git
cd ev-loader
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .If you need a CUDA-specific PyTorch build, install the appropriate torch and
torchvision wheels first, then run pip install -e ..
The tests and notebooks use environment variables for real datasets:
export EVLOADER_DSEC_ROOT=/path/to/DSEC
export EVLOADER_EVIMO_ROOT=/path/to/EVIMO1
export EVLOADER_GEN1_ROOT=/path/to/gen1
export EVLOADER_NCALTECH101_ROOT=/path/to/ncaltech101
export EVLOADER_MVSEC_DATA_PATH=/path/to/outdoor_day1_data.hdf5
export EVLOADER_MVSEC_GT_PATH=/path/to/outdoor_day1_gt.hdf5Cache-writing examples use examples/dataloaders/cache/ so they do not write
derived files into dataset roots.
One notebook is provided per dataset in
examples/dataloaders:
dsec_dataloaders.ipynbevimo_dataloaders.ipynbgen1_dataloaders.ipynbmvsec_dataloader.ipynbncaltech101_dataloader.ipynb
Start Jupyter from the repository root after setting the relevant environment variable:
jupyter lab examples/dataloadersfrom pathlib import Path
from evloader.DSEC_dataloader.Sequence import Sequence
seq_path = Path("/path/to/DSEC/train/interlaken_00_a")
dataset = Sequence(
seq_path=seq_path,
mode="train",
delta_t_ms=50,
num_bins=2,
representation="stack",
load_opt_flow=False,
)
sample = dataset[0]
print(sample.keys())
print(sample["representation"]["left"].shape)from evloader.EVIMOv1_dataloader.EVIMOSequence import EVIMOSequence
dataset = EVIMOSequence(
"/path/to/EVIMO1/train/box/seq_00.h5",
window_ms=50,
num_bins=2,
sequence_len=1,
batch_size=1,
)
sample = dataset[0]
print(sample)import os
from evloader.Gen1_dataloader.sequence import Gen1
os.environ["GEN1_DATA_DIR"] = "/path/to/parent/of/gen1"
data_module = Gen1(
batch_size=2,
shuffle=True,
num_workers=0,
pin_memory=False,
num_events_per_sample=25000,
)
data_module.prepare_data()
data_module.setup()
batch = next(iter(data_module.train_dataloader()))
print(batch)from evloader.MVSEC_dataloader.MVSECLoader import MVSECLoader
loader = MVSECLoader(
"/path/to/outdoor_day1_data.hdf5",
"/path/to/outdoor_day1_gt.hdf5",
)
print(loader.events.shape)
print(loader.images.shape)
print(loader.depths.shape)from pathlib import Path
from evloader.Ncaltech101_dataloader.ncaltech101_sequence import NCaltech101
dataset = NCaltech101(
root=Path("/path/to/ncaltech101"),
split="training",
num_events=50000,
)
data = dataset[0]
print(data)The default suite uses synthetic data and should run without external datasets:
python -m pytest -m "not realdata"Real-data tests are opt-in. Set the relevant environment variables first, then run:
python -m pytest -m realdataUseful dataset-specific markers are available:
python -m pytest -m dsec
python -m pytest -m evimo
python -m pytest -m gen1
python -m pytest -m mvsec
python -m pytest -m ncaltech101
python -m pytest -m sharedevloader/
DSEC_dataloader/ DSEC loaders and provider methods
EVIMOv1_dataloader/ EVIMO and EV-IMO loaders
Gen1_dataloader/ Gen1 raw, processed, and patchified loaders
MVSEC_dataloader/ MVSEC HDF5 loader
Ncaltech101_dataloader/ N-Caltech101 loader
data/ Event containers and rendering helpers
representations/ Voxel, stack, timestamp, and time-surface encodings
utils/ Event slicing, splitting, augmentation, flow, patches
visualization/ Event visualization utilities
examples/dataloaders/ Dataset-level usage notebooks
tests/ Synthetic and opt-in real-data pytest suite
- DSEC optical-flow labels are optional for many examples; pass
load_opt_flow=Falsewhen using DSEC copies without flow folders. - Gen1 preprocessing can be expensive. Use
processed_dataset_pathwhen you want processed files to live outside the dataset root. - Some loaders require optional heavy dependencies such as
torch_geometric,pytorch-lightning,hdf5plugin, andpycocotools; they are listed inrequirements.txt.
