Dongyue Lu1,2Β Β Lingdong Kong1Β Β Gim Hee Lee1Β Β Camille Simon Chane3Β Β Wei Tsang Ooi1,2
1National University of SingaporeΒ Β
2IPAL, CNRS IRL 2955, Singapore
3ETIS UMR 8051, CY Cergy Paris University, ENSEA, CNRS, France
FlexEvent is an event-frame object detector designed to work across varying operational frequencies. It combines the temporal resolution of event cameras with the semantic detail of RGB frames, allowing the same detector to operate from standard frame rates up to 180 Hz.
Our main contributions are:
- FlexEvent, a flexible event-frame detection framework for real-world sensing at varying operational frequencies.
- FlexFuse, an adaptive fusion module that combines recurrent event features with multi-scale RGB features.
- FlexTune, a frequency-adaptive fine-tuning method that uses frequency-adjusted labels to improve temporal generalization.
conda create -n flexevent python=3.9 -y
conda activate flexevent
python -m pip install \
torch==2.1.2 torchvision==0.16.2 \
--index-url https://download.pytorch.org/whl/cu121
python -m pip install -r requirements.txt
python -m pip install setuptools wheel
python -m pip install --no-build-isolation \
"git+https://github.com/facebookresearch/detectron2.git@02b5c4e295e990042a714712c21dc79b731e8833"Follow the data preparation instructions in DSEC-Detection. Include its DSEC-extra sequences and remapped images.
Place the prepared dataset in datasets/DSEC/, or link your existing directory:
mkdir -p datasets
ln -s /path/to/dsec datasets/DSECRun the commands below from the repository root. All scripts use this data
directory by default; to change it, edit path in
config/dataset/dsec.yaml once.
Then generate events_2x.h5 for every sequence with the script included here:
for split in train test; do
for sequence in datasets/DSEC/"$split"/*; do
python scripts/downsample_events.py \
"$sequence/events/left/events.h5" \
"$sequence/events/left/events_2x.h5"
done
doneYour final data directory should look like this:
datasets/DSEC/
βββ train/
β βββ <training_sequence>/
β βββ zurich_city_16_a/ # validation
β βββ ... # zurich_city_17_a through zurich_city_20_a
β βββ zurich_city_21_a/ # validation
βββ test/
βββ <test_sequence>/
Every sequence, including the validation sequences, has the same layout:
<sequence>/
βββ images/
β βββ timestamps.txt
β βββ left/distorted/*.png
βββ events/left/events_2x.h5
βββ object_detections/left/tracks.npy
We provide two label settings:
2class:carandpedestrian. The original car, bus, and truck categories are merged intocar.8class: the native DSEC categories. Since thetraincategory has no annotations in the DSEC-Det split, the released model evaluates the seven non-empty categories.
Download the released weights from
Hugging Face
and place them in checkpoints/.
For each label setting, we provide two variants:
- Global is a FlexFuse model trained only with ground-truth labels. It generally performs best at the standard 20 Hz operating frequency.
- Balanced adds FlexTune and is further trained with pseudo-labels at intermediate timestamps. It performs better at high frequencies and is more consistent across the full frequency range.
All values are COCO AP (%) on the DSEC-Det test split.
| Checkpoint | AP | AP50 | AP75 | APS | APM | APL |
|---|---|---|---|---|---|---|
flexevent_2class_global.pth |
59.52 | 79.23 | 69.78 | 54.56 | 68.83 | 83.21 |
flexevent_2class_balanced.pth |
58.16 | 80.40 | 66.71 | 52.22 | 67.12 | 84.60 |
flexevent_8class_global.pth |
53.40 | 75.31 | 62.89 | 40.04 | 61.47 | 78.19 |
flexevent_8class_balanced.pth |
51.76 | 75.96 | 61.17 | 40.39 | 59.12 | 79.14 |
| Evaluation | 2-class Global | 2-class Balanced | 8-class Global | 8-class Balanced |
|---|---|---|---|---|
| Empty event | 34.21 | 37.40 | 27.83 | 33.99 |
| 180 Hz | 46.94 | 52.64 | 41.84 | 45.57 |
| 90 Hz | 55.60 | 56.77 | 47.69 | 50.82 |
| 60 Hz | 57.65 | 58.40 | 49.70 | 52.66 |
| 45 Hz | 59.10 | 59.32 | 52.00 | 53.18 |
| 36 Hz | 60.16 | 59.66 | 52.98 | 53.86 |
| 30 Hz | 60.47 | 59.62 | 54.28 | 54.19 |
| 20 Hz | 60.15 | 59.06 | 54.63 | 53.38 |
python test_global.py \
dataset.class_mode=2class \
checkpoint=checkpoints/flexevent_2class_global.pthUse dataset.class_mode=8class with an 8-class checkpoint.
Our interframe time sampling and interpolated labels follow DAGR. It reports the empty-event point and nine event rates from 180 Hz to 20 Hz. Intermediate annotations are generated online from the official DSEC-Det tracks by matching track IDs and interpolating the bounding boxes between two annotated frames. No additional label-generation step is required.
python test_interframe.py \
dataset.class_mode=2class \
checkpoint=checkpoints/flexevent_2class_balanced.pth \
validation.interframe=truevisualize.py runs one test sequence and renders RGB, events, ground truth and
predictions together. Use an image extension for one frame or a video extension
for a sequence:
python visualize.py \
dataset.class_mode=2class \
checkpoint=checkpoints/flexevent_2class_balanced.pth \
visualization.sequence=thun_01_a \
visualization.output=demo.mp4DSEC-Det provides frame-aligned annotations at 20 Hz. Training follows the two components of FlexEvent: FlexFuse learns to combine event and RGB information using these annotations, and FlexTune extends supervision to intermediate timestamps for detection at higher frequencies.
For the strongest performance at the standard 20 Hz setting, we train
FlexFuse with GT labels, following Section 3.2 of the paper. Event views with
different temporal durations are fused with RGB features and supervised at the
original annotated timestamps. This produces flexevent_2class_global.pth and
flexevent_8class_global.pth.
For more balanced performance from 20 Hz to 180 Hz, we additionally use
FlexTune (Section 3.3). Higher-frequency detection uses shorter event windows
and requires predictions between annotated frames. We first train a Teacher on
shorter event windows ending at the existing GT timestamps, then use it to
generate and temporally filter pseudo-labels at intermediate timestamps. A
Student is initialized from the Teacher and fine-tuned with both GT and
pseudo-labels. This produces flexevent_2class_balanced.pth and
flexevent_8class_balanced.pth, which trade some standard-frequency accuracy
for stronger high-frequency performance.
The event branch is initialized from RVT-B trained on the Prophesee 1Mpx
detection dataset. The RGB branch uses an ImageNet
ResNet-50. Download the RVT-B weights
and the ImageNet ResNet-50
R-50.pkl.
Place them in pretrained/rvt-b.ckpt and pretrained/R-50.pkl.
Training loads these weights by default.
This trains FlexFuse with GT labels:
python train.py recipe=2class_globalUse recipe=8class_global for the multi-class model.
Following the paper's low-frequency sparse training stage, we train on the final part of each event interval that ends at an annotated timestamp. The main event window is 25 ms, and the labels remain at their original 20 Hz timestamps while the event windows are shorter.
python train.py recipe=2class_teacherUse recipe=8class_teacher for the multi-class Teacher.
Run the Teacher in both temporal directions, then filter its predictions:
for direction in forward reverse; do
python generate_pseudo_labels.py \
dataset.class_mode=2class \
checkpoint=/path/to/teacher.ckpt direction=$direction \
output_dir=pseudo_predictions
done
python scripts/build_pseudo_labels.py \
--predictions-root pseudo_predictions \
--output-root pseudo_labels --class-mode 2classFor the multi-class model, use 8class in generation and label construction,
and add --classwise to the label-construction command. Pseudo-labels are
thresholded before union NMS and track filtering; short rejected tracks are
pruned.
python train.py recipe=2class_balanced \
dataset.train.pseudo_labels_root=pseudo_labels \
training.teacher_checkpoint=/path/to/teacher.ckptUse recipe=8class_balanced for the multi-class Student. Both Students train on
GT at annotated timestamps and pseudo-labels at intermediate timestamps, starting
from the Teacher weights with a new optimizer and schedule.
All evaluation scripts accept either a released .pth file or a Lightning
.ckpt written during training.
This code builds on RVT, DSEC-Detection, and DAGR.
