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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: license
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
---
|
| 6 |
+
<a name="readme-top"></a>
|
| 7 |
+
|
| 8 |
+
<div align="center" style="background-color: #0e2841; padding: 20px; border-radius: 15px; margin-bottom: 20px;">
|
| 9 |
+
<img src="media/logo.png" alt="REALM Logo" width="400"/>
|
| 10 |
+
<h1 style="color: #ffffff; margin-top: 20px;">RGB and Event Aligned Latent Manifold</h1>
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
Welcome to **REALM**! This repository contains the implementation of REALM, for advanced computer vision tasks involving both traditional RGB and Event-based vision.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
<div align="center">
|
| 17 |
+
<img src="media/demo_realm.gif" alt="demo" >
|
| 18 |
+
</div>
|
| 19 |
+
|
| 20 |
+
If you use this code, please cite the following publication:
|
| 21 |
+
|
| 22 |
+
```bibtex
|
| 23 |
+
@misc{polizzi_2026_realm,
|
| 24 |
+
title={REALM: RGB and Event Aligned Latent Manifold},
|
| 25 |
+
author={Vincenzo Polizzi and David B. Lindell and Jonathan Kelly},
|
| 26 |
+
year={2026},
|
| 27 |
+
eprint={},
|
| 28 |
+
archivePrefix={arXiv},
|
| 29 |
+
primaryClass={cs.CV},
|
| 30 |
+
url={https://arxiv.org/abs/},
|
| 31 |
+
}
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
<!-- TABLE OF CONTENTS -->
|
| 35 |
+
<details>
|
| 36 |
+
<summary>Table of Contents</summary>
|
| 37 |
+
<ol>
|
| 38 |
+
<li><a href="#abstract">Abstract</a></li>
|
| 39 |
+
<li><a href="#-features">Features</a></li>
|
| 40 |
+
<li>
|
| 41 |
+
<a href="#️-installation">Installation</a>
|
| 42 |
+
<ul>
|
| 43 |
+
<li><a href="#1-create-a-conda-environment">Create a Conda Environment</a></li>
|
| 44 |
+
<li><a href="#2-install-requirements">Install Requirements</a></li>
|
| 45 |
+
<li><a href="#3-install-the-realm-package">Install the REALM Package</a></li>
|
| 46 |
+
</ul>
|
| 47 |
+
</li>
|
| 48 |
+
<li>
|
| 49 |
+
<a href="#-usage">Usage</a>
|
| 50 |
+
<ul>
|
| 51 |
+
<li><a href="#1-import-and-use-realm-in-your-code">Import and Use REALM</a></li>
|
| 52 |
+
<li><a href="#2-running-evaluation-scripts">Running Evaluation Scripts</a></li>
|
| 53 |
+
</ul>
|
| 54 |
+
</li>
|
| 55 |
+
<li><a href="#-license">License</a></li>
|
| 56 |
+
<li><a href="#-acknowledgements">Acknowledgements</a></li>
|
| 57 |
+
</ol>
|
| 58 |
+
</details>
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Abstract
|
| 63 |
+
|
| 64 |
+
Event cameras provide several unique advantages over standard frame-based sensors, including high temporal resolution, low latency, and robustness to extreme lighting. However, existing learning-based approaches for event processing are typically confined to narrow, task-specific silos and lack the ability to generalize across modalities.
|
| 65 |
+
|
| 66 |
+
We address this gap with **REALM**, a cross-modal framework that learns an **R**GB and **E**vent **A**ligned **L**atent **M**anifold by projecting event representations into the pretrained latent space of RGB foundation models. Instead of task-specific training, we leverage low-rank adaptation (LoRA) to bridge the modality gap, effectively unlocking the geometric and semantic priors of frozen RGB backbones for asynchronous event streams.
|
| 67 |
+
|
| 68 |
+
We demonstrate that **REALM** effectively maps events into the ViT-based foundation latent space. Our method allows us to perform downstream tasks like depth estimation and semantic segmentation by simply transferring linear heads trained on the RGB teacher. Most significantly, **REALM** enables the direct, zero-shot application of complex, frozen image-trained decoders, such as MASt3R, to raw event data. We demonstrate state-of-the-art performance in wide-baseline feature matching, significantly outperforming specialized architectures. Code and models are available upon acceptance.
|
| 69 |
+
|
| 70 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
| 71 |
+
|
| 72 |
+
---
|
| 73 |
+
|
| 74 |
+
## 🚀 Features
|
| 75 |
+
|
| 76 |
+
- **Multi-Modal Matching**: 3D grounded matching pipelines for RGB-to-Event and Event-to-Event.
|
| 77 |
+
- **Advanced Architectures**: Seamlessly integrates RGB trained heads using [DUNE backbone](https://github.com/naver/dune).
|
| 78 |
+
- **Multiple Downstream Tasks**: Support for depth estimation, semantic segmentation, 3D reconstruction and matching.
|
| 79 |
+
- **Comprehensive Evaluation**: Extensive benchmarking and evaluation scripts.
|
| 80 |
+
|
| 81 |
+
## 🛠️ Installation
|
| 82 |
+
|
| 83 |
+
We highly recommend using Conda to manage your python environment. Follow the steps below to install all dependencies and the `realm` package.
|
| 84 |
+
|
| 85 |
+
### 1. Create a Conda Environment
|
| 86 |
+
|
| 87 |
+
Create and activate a new Conda environment (we recommend Python 3.10+):
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
conda create -n realm python=3.10 -y
|
| 91 |
+
conda activate realm
|
| 92 |
+
conda install -y -c "nvidia/label/cuda-12.8.0" cuda-toolkit
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
Check that the nvcc compiler is available and the CUDA version is 12.8:
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
nvcc --version # should show CUDA 12.8
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
### 2. Install Requirements
|
| 102 |
+
|
| 103 |
+
Install the dependencies from the `requirements.txt` file located at the root of the repository:
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
pip install -r requirements.txt
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
### 3. Install the REALM Package
|
| 110 |
+
|
| 111 |
+
Navigate into the `realm` directory and install the core package:
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
cd realm
|
| 115 |
+
pip install .
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
| 119 |
+
|
| 120 |
+
---
|
| 121 |
+
|
| 122 |
+
## 💡 Usage
|
| 123 |
+
|
| 124 |
+
### 1. Import and Use REALM in Your Code
|
| 125 |
+
|
| 126 |
+
After installation, you can import the REALM package in your Python code as follows:
|
| 127 |
+
|
| 128 |
+
```python
|
| 129 |
+
import torch
|
| 130 |
+
from realm import REALM_creator
|
| 131 |
+
from realm.utils import representation_factory
|
| 132 |
+
from realm.utils import Resize
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
# Initialize the REALM model
|
| 136 |
+
# see realm/realm/configs/ for example configurations
|
| 137 |
+
model = REALM_creator(config='path/to/config.yaml')
|
| 138 |
+
|
| 139 |
+
# Random event generation assuming a camera resolution of 720p and 5 channels (e.g., x, y, timestamp, polarity, and one additional feature channel)
|
| 140 |
+
H, W = 720, 1280
|
| 141 |
+
|
| 142 |
+
# random x, y, timestamp, polarity
|
| 143 |
+
x = torch.randint(0, W, (1000,)) # x-coordinates of events
|
| 144 |
+
y = torch.randint(0, H, (1000,)) # y-coordinates of events
|
| 145 |
+
timestamp = torch.rand(1000) * 1e6 # timestamps in microseconds
|
| 146 |
+
polarity = torch.randint(0, 2, (1000,)) # polarity: 0 for negative events, 1 for positive events
|
| 147 |
+
|
| 148 |
+
# Create an event representation using the factory function
|
| 149 |
+
channels = 5
|
| 150 |
+
normalize = True # Whether to normalize the input data
|
| 151 |
+
ev_repr = representation_factory(
|
| 152 |
+
rep_type="voxel_grid", height=H, width=W,
|
| 153 |
+
channels=channels, normalize=normalize,
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
# Example input (replace with actual data)
|
| 157 |
+
input_data = ev_repr(x, y, timestamp, polarity) # shape: (C, H, W) where C is the number of channels
|
| 158 |
+
|
| 159 |
+
# resize to 448x448 for REALM input
|
| 160 |
+
resize = Resize((448, 448))
|
| 161 |
+
input_data = resize(input_data) # shape: (C, 448, 448)
|
| 162 |
+
|
| 163 |
+
# Forward pass through the model
|
| 164 |
+
output = model(input_data.unsqueeze(0), {optional_options}) # Add batch dimension, shape: (1, C, H, W)
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
### 2. Running Evaluation Scripts
|
| 168 |
+
|
| 169 |
+
The `evaluation/` directory contains scripts for evaluating the performance of REALM on various tasks. You can run these scripts as follows:
|
| 170 |
+
|
| 171 |
+
```bash
|
| 172 |
+
python evaluation/evaluate_depth.py
|
| 173 |
+
python evaluation/evaluate_segmentation.py
|
| 174 |
+
python evaluation/evaluate_matching.py
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
To store the visualization of the results, pass the `--save-visuals` flag, results will be saved under `results/`.
|
| 178 |
+
|
| 179 |
+
To run a quick feature matching test between some events and an RGB image, run the following script:
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
```bash
|
| 183 |
+
python realm/realm/model_factory.py
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
Expect to see the following image under `test/`:
|
| 187 |
+
<div align="center">
|
| 188 |
+
<img src="test/smoke_test_result.png" alt="demo" >
|
| 189 |
+
</div>
|
| 190 |
+
|
| 191 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
| 192 |
+
|
| 193 |
+
---
|
| 194 |
+
|
| 195 |
+
## 📝 License
|
| 196 |
+
|
| 197 |
+
This project is licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
| 198 |
+
|
| 199 |
+
[](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
| 200 |
+
|
| 201 |
+
You are free to share and adapt this material for **non-commercial purposes**, provided that you:
|
| 202 |
+
|
| 203 |
+
- give appropriate credit and cite the REALM paper,
|
| 204 |
+
- indicate if changes were made,
|
| 205 |
+
- distribute any derivative work under the same license.
|
| 206 |
+
|
| 207 |
+
© 2025 Space and Terrestrial Autonomous Robotic Systems (STARS) Lab, University of Toronto Institute for Aerospace Studies (UTIAS). All rights reserved.
|
| 208 |
+
|
| 209 |
+
### Third-party Components
|
| 210 |
+
|
| 211 |
+
The following components are included in this repository under their own respective licenses:
|
| 212 |
+
|
| 213 |
+
- **[DUSt3R](https://github.com/naver/dust3r)** (`thirdparty/dust3r/`) — please refer to the original repository for license details.
|
| 214 |
+
- **MASt3R head** (`heads/mast3r/`) — modified from [MASt3R](https://github.com/naver/mast3r); please refer to the original repository for license details.
|
| 215 |
+
- **[DUNE](https://github.com/naver/dune)** (`dune/`) — please refer to the original repository for license details.
|
| 216 |
+
|
| 217 |
+
Please ensure you comply with the respective licenses of these components when using or redistributing this software.
|
| 218 |
+
|
| 219 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
| 220 |
+
|
| 221 |
+
## 🙏 Acknowledgements
|
| 222 |
+
|
| 223 |
+
This code is based on some open-source repositories, including:
|
| 224 |
+
- [DUNE](https://github.com/naver/dune)
|
| 225 |
+
- [MASt3R](https://github.com/naver/mast3r)
|
| 226 |
+
- [DUSt3R](https://github.com/naver/dust3r)
|
| 227 |
+
- The work by the [Robotics and Perception Group](https://rpg.ifi.uzh.ch/) at the University of Zurich for the event-based vision datasets and evaluation scripts that make it possible to benchmark the performance of REALM on downstream tasks.
|
| 228 |
+
|
| 229 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|