Add pre-trained Alligat0R weights (fp16 safetensors) and model card
Browse files- README.md +119 -0
- nuscenes_cub3-50/config.json +17 -0
- nuscenes_cub3-50/model.safetensors +3 -0
- nuscenes_cub3-all/config.json +17 -0
- nuscenes_cub3-all/model.safetensors +3 -0
- scannet_cub3-50/config.json +17 -0
- scannet_cub3-50/model.safetensors +3 -0
- scannet_cub3-all/config.json +17 -0
- scannet_cub3-all/model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pipeline_tag: image-segmentation
|
| 4 |
+
tags:
|
| 5 |
+
- covisibility
|
| 6 |
+
- croco
|
| 7 |
+
- pose-estimation
|
| 8 |
+
- nuscenes
|
| 9 |
+
- scannet
|
| 10 |
+
- neurips-2025
|
| 11 |
+
- vision-transformer
|
| 12 |
+
datasets:
|
| 13 |
+
- thibautloiseau/Cub3
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Alligat0R: Pre-Training through Covisibility Segmentation for Relative Camera Pose Regression
|
| 17 |
+
|
| 18 |
+
**NeurIPS 2025 Spotlight** | [Paper](https://arxiv.org/abs/2503.07561) | [Code](https://github.com/thibautloiseau/alligat0r) | [Dataset](https://huggingface.co/datasets/thibautloiseau/Cub3)
|
| 19 |
+
|
| 20 |
+
Alligat0R is a novel pre-training approach for binocular vision tasks. Instead of cross-view completion (CroCo), it uses a **covisibility segmentation** objective: for each pixel in one image, the model predicts whether the corresponding 3D point is **covisible**, **occluded**, or **outside the field of view** in the other image.
|
| 21 |
+
|
| 22 |
+
## Available Variants
|
| 23 |
+
|
| 24 |
+
This repository contains four pre-trained Alligat0R backbones (covisibility segmentation, before pose fine-tuning):
|
| 25 |
+
|
| 26 |
+
| Subfolder | Training Data | Image Size | Description |
|
| 27 |
+
|---|---|---|---|
|
| 28 |
+
| `nuscenes_cub3-50` | nuScenes (Cub3-50, >= 50% overlap) | 288 x 512 | Outdoor driving |
|
| 29 |
+
| `nuscenes_cub3-all` | nuScenes (Cub3-all, >= 5% overlap) | 288 x 512 | Outdoor driving, challenging pairs |
|
| 30 |
+
| `scannet_cub3-50` | ScanNet (Cub3-50, >= 50% overlap) | 384 x 512 | Indoor scenes |
|
| 31 |
+
| `scannet_cub3-all` | ScanNet (Cub3-all, >= 5% overlap) | 384 x 512 | Indoor scenes, challenging pairs |
|
| 32 |
+
|
| 33 |
+
All models use a ViT-Large encoder (24 layers, 1024-dim) and a ViT-Base decoder (12 layers, 768-dim) with RoPE positional embeddings. Weights are stored in fp16 safetensors format (~798 MB each).
|
| 34 |
+
|
| 35 |
+
## Usage
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
import torch
|
| 39 |
+
from reloc3r.alligat0r import Alligat0R
|
| 40 |
+
|
| 41 |
+
device = "cuda"
|
| 42 |
+
model = Alligat0R.from_pretrained(
|
| 43 |
+
"thibautloiseau/alligat0r",
|
| 44 |
+
subfolder="scannet_cub3-all",
|
| 45 |
+
device=device,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
from PIL import Image
|
| 49 |
+
from torchvision import transforms
|
| 50 |
+
|
| 51 |
+
img_size = (384, 512) # use (288, 512) for nuScenes variants
|
| 52 |
+
tf = transforms.Compose([
|
| 53 |
+
transforms.Resize(img_size),
|
| 54 |
+
transforms.ToTensor(),
|
| 55 |
+
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
|
| 56 |
+
])
|
| 57 |
+
view1 = {"img": tf(Image.open("img1.jpg").convert("RGB")).unsqueeze(0).to(device)}
|
| 58 |
+
view2 = {"img": tf(Image.open("img2.jpg").convert("RGB")).unsqueeze(0).to(device)}
|
| 59 |
+
|
| 60 |
+
with torch.no_grad():
|
| 61 |
+
seg1, seg2 = model(view1, view2) # (B, 3, H, W) logits per view
|
| 62 |
+
|
| 63 |
+
cov1 = seg1.argmax(1)[0].cpu().numpy() # 0=covisible, 1=occluded, 2=outside-FOV
|
| 64 |
+
cov2 = seg2.argmax(1)[0].cpu().numpy()
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Fine-Tuning for Pose Regression
|
| 68 |
+
|
| 69 |
+
These pre-trained weights serve as initialization for downstream tasks. To fine-tune for relative pose regression, use the training script from the [GitHub repository](https://github.com/thibautloiseau/alligat0r):
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
torchrun --nproc_per_node=4 finetune_pose.py \
|
| 73 |
+
--mode alligat0r_pose \
|
| 74 |
+
--dataset scannet \
|
| 75 |
+
--overlap all \
|
| 76 |
+
--load_pretrained_default
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## Architecture
|
| 80 |
+
|
| 81 |
+
- **Encoder:** ViT-Large (24 layers, 1024-dim, 16 heads, patch size 16)
|
| 82 |
+
- **Decoder:** ViT-Base (12 layers, 768-dim, 12 heads) with cross-attention
|
| 83 |
+
- **Segmentation head:** linear projection from decoder features to 3-class per-pixel predictions
|
| 84 |
+
- **Positional encoding:** RoPE (freq=100)
|
| 85 |
+
|
| 86 |
+
The architecture is symmetric: both images are processed identically without masking, unlike CroCo which uses asymmetric masking.
|
| 87 |
+
|
| 88 |
+
## Training Details
|
| 89 |
+
|
| 90 |
+
- **Optimizer:** AdamW (lr=1.5e-4, weight_decay=0.05, betas=(0.9, 0.95))
|
| 91 |
+
- **Schedule:** cosine decay with 2 epochs warmup, 25 training epochs
|
| 92 |
+
- **Batch size:** 32 per GPU
|
| 93 |
+
- **Loss:** cross-entropy on the 3-class covisibility prediction
|
| 94 |
+
- **Hardware:** NVIDIA A100 GPUs
|
| 95 |
+
|
| 96 |
+
## Results
|
| 97 |
+
|
| 98 |
+
After fine-tuning for metric relative pose regression on Cub3-all (backbone unfrozen):
|
| 99 |
+
|
| 100 |
+
| Method | RUBIK 5deg/0.5m | RUBIK 5deg/2m | RUBIK 10deg/5m | ScanNet 10deg/0.25m | ScanNet 10deg/0.5m | ScanNet 10deg/1m |
|
| 101 |
+
|---|---|---|---|---|---|---|
|
| 102 |
+
| CroCo (Cub3-50) | 12.4 | 38.3 | 66.7 | 75.7 | 87.4 | 91.5 |
|
| 103 |
+
| **Alligat0R (Cub3-all)** | **24.6** | **60.3** | **81.9** | **85.5** | **92.5** | **95.1** |
|
| 104 |
+
|
| 105 |
+
## Limitations
|
| 106 |
+
|
| 107 |
+
- Models are trained on driving (nuScenes) and indoor (ScanNet) domains. Generalization to other domains (e.g., aerial, underwater) has not been evaluated.
|
| 108 |
+
- nuScenes covisibility annotations rely on monocular depth predictions, which may contain noise on reflective surfaces, transparent objects, or distant geometry.
|
| 109 |
+
|
| 110 |
+
## Citation
|
| 111 |
+
|
| 112 |
+
```bibtex
|
| 113 |
+
@inproceedings{loiseau2025alligat0r,
|
| 114 |
+
title={{Alligat0R}: Pre-Training through Covisibility Segmentation for Relative Camera Pose Regression},
|
| 115 |
+
author={Loiseau, Thibaut and Bourmaud, Guillaume and Lepetit, Vincent},
|
| 116 |
+
booktitle={NeurIPS},
|
| 117 |
+
year={2025}
|
| 118 |
+
}
|
| 119 |
+
```
|
nuscenes_cub3-50/config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"patch_size": 16,
|
| 3 |
+
"enc_embed_dim": 1024,
|
| 4 |
+
"enc_depth": 24,
|
| 5 |
+
"enc_num_heads": 16,
|
| 6 |
+
"dec_embed_dim": 768,
|
| 7 |
+
"dec_depth": 12,
|
| 8 |
+
"dec_num_heads": 12,
|
| 9 |
+
"mlp_ratio": 4,
|
| 10 |
+
"norm_im2_in_dec": true,
|
| 11 |
+
"pos_embed": "RoPE100",
|
| 12 |
+
"mode": "alligat0r_pretrain",
|
| 13 |
+
"img_size": [
|
| 14 |
+
288,
|
| 15 |
+
512
|
| 16 |
+
]
|
| 17 |
+
}
|
nuscenes_cub3-50/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b52a8ec790acea60552134e5b813913d36da7f5041241ae754de5e53152b482e
|
| 3 |
+
size 835895552
|
nuscenes_cub3-all/config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"patch_size": 16,
|
| 3 |
+
"enc_embed_dim": 1024,
|
| 4 |
+
"enc_depth": 24,
|
| 5 |
+
"enc_num_heads": 16,
|
| 6 |
+
"dec_embed_dim": 768,
|
| 7 |
+
"dec_depth": 12,
|
| 8 |
+
"dec_num_heads": 12,
|
| 9 |
+
"mlp_ratio": 4,
|
| 10 |
+
"norm_im2_in_dec": true,
|
| 11 |
+
"pos_embed": "RoPE100",
|
| 12 |
+
"mode": "alligat0r_pretrain",
|
| 13 |
+
"img_size": [
|
| 14 |
+
288,
|
| 15 |
+
512
|
| 16 |
+
]
|
| 17 |
+
}
|
nuscenes_cub3-all/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9415a75478a8faf948cdc066a5ff63708cd17aa4eac35e6a1aa95c5166e0472e
|
| 3 |
+
size 835895552
|
scannet_cub3-50/config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"patch_size": 16,
|
| 3 |
+
"enc_embed_dim": 1024,
|
| 4 |
+
"enc_depth": 24,
|
| 5 |
+
"enc_num_heads": 16,
|
| 6 |
+
"dec_embed_dim": 768,
|
| 7 |
+
"dec_depth": 12,
|
| 8 |
+
"dec_num_heads": 12,
|
| 9 |
+
"mlp_ratio": 4,
|
| 10 |
+
"norm_im2_in_dec": true,
|
| 11 |
+
"pos_embed": "RoPE100",
|
| 12 |
+
"mode": "alligat0r_pretrain",
|
| 13 |
+
"img_size": [
|
| 14 |
+
384,
|
| 15 |
+
512
|
| 16 |
+
]
|
| 17 |
+
}
|
scannet_cub3-50/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:09aa0b33cecb2b8fd018b0ce0962bd2ded11188a816f0a508f1e18baf8bb5397
|
| 3 |
+
size 835895552
|
scannet_cub3-all/config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"patch_size": 16,
|
| 3 |
+
"enc_embed_dim": 1024,
|
| 4 |
+
"enc_depth": 24,
|
| 5 |
+
"enc_num_heads": 16,
|
| 6 |
+
"dec_embed_dim": 768,
|
| 7 |
+
"dec_depth": 12,
|
| 8 |
+
"dec_num_heads": 12,
|
| 9 |
+
"mlp_ratio": 4,
|
| 10 |
+
"norm_im2_in_dec": true,
|
| 11 |
+
"pos_embed": "RoPE100",
|
| 12 |
+
"mode": "alligat0r_pretrain",
|
| 13 |
+
"img_size": [
|
| 14 |
+
384,
|
| 15 |
+
512
|
| 16 |
+
]
|
| 17 |
+
}
|
scannet_cub3-all/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b603d4adc2acbcb254be2948b5e067ec4c1a657741321b38344c1918b09bd420
|
| 3 |
+
size 835895552
|