lucidrains/lvsm-pytorch
À propos
Implementation of LVSM, SOTA Large View Synthesis with Minimal 3d Inductive Bias, from Adobe Research
IA et apprentissage automatiqueProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Original


LVSM - Pytorch
Implementation of LVSM, SOTA Large View Synthesis with Minimal 3d Inductive Bias, from Adobe Research
We will focus only on the Decoder-only architecture in this repository.
This paper lines up with another from ICLR 2025
Install
$ pip install lvsm-pytorch
Usage
import torch
from lvsm_pytorch import LVSM
rays = torch.randn(2, 4, 6, 256, 256)
images = torch.randn(2, 4, 3, 256, 256)
target_rays = torch.randn(2, 6, 256, 256)
target_images = torch.randn(2, 3, 256, 256)
model = LVSM(
dim = 512,
max_image_size = 256,
patch_size = 32,
depth = 2,
)
loss = model(
input_images = images,
input_rays = rays,
target_rays = target_rays,
target_images = target_images
)
loss.backward()
# after much training
pred_images = model(
input_images = images,
input_rays = rays,
target_rays = target_rays,
) # (2, 3, 256, 256)
assert pred_images.shape == target_images.shape
Or from the raw camera intrinsic / extrinsics (please submit an issue or pull request if you see an error. new to view synthesis and out of my depths here)
import torch
from lvsm_pytorch import LVSM, CameraWrapper
input_intrinsic_rotation = torch.randn(2, 4, 3, 3)
input_extrinsic_rotation = torch.randn(2, 4, 3, 3)
input_translation = torch.randn(2, 4, 3)
input_uniform_points = torch.randn(2, 4, 3, 256, 256)
target_intrinsic_rotation = torch.randn(2, 3, 3)
target_extrinsic_rotation = torch.randn(2, 3, 3)
target_translation = torch.randn(2, 3)
target_uniform_points = torch.randn(2, 3, 256, 256)
images = torch.randn(2, 4, 4, 256, 256)
target_images = torch.randn(2, 4, 256, 256)
lvsm = LVSM(
dim = 512,
max_image_size = 256,
patch_size = 32,
channels = 4,
depth = 2,
use_world_rope = True, # WorldRoPE (Kim et al.)
use_pope = True, # PoPE (Gopalakrishnan et al.)
use_coor_descent = True, # CoLT5 coordinate descent (Ainslie et al.)
)
model = CameraWrapper(lvsm)
loss = model(
input_intrinsic_rotation = input_intrinsic_rotation,
input_extrinsic_rotation = input_extrinsic_rotation,
input_translation = input_translation,
input_uniform_points = input_uniform_points,
target_intrinsic_rotation = target_intrinsic_rotation,
target_extrinsic_rotation = target_extrinsic_rotation,
target_translation = target_translation,
target_uniform_points = target_uniform_points,
input_images = images,
target_images = target_images,
)
loss.backward()
# after much training
pred_target_images = model(
input_intrinsic_rotation = input_intrinsic_rotation,
input_extrinsic_rotation = input_extrinsic_rotation,
input_translation = input_translation,
input_uniform_points = input_uniform_points,
target_intrinsic_rotation = target_intrinsic_rotation,
target_extrinsic_rotation = target_extrinsic_rotation,
target_translation = target_translation,
target_uniform_points = target_uniform_points,
input_images = images,
)
# or extract 3d-fused representations directly for downstream policies
embed = model.encode(
intrinsic_rotation = input_intrinsic_rotation,
extrinsic_rotation = input_extrinsic_rotation,
translation = input_translation,
images = images,
) # (2, 4, 8, 8, 512)
For an improvised self-supervised learning using masked autoencoder for reconstructing images and plucker rays, just import MAE first and wrap your LVSM instance. Then pass in your images and rays
import torch
from lvsm_pytorch import (
LVSM,
MAE
)
rays = torch.randn(2, 4, 6, 256, 256)
images = torch.randn(2, 4, 4, 256, 256)
lvsm = LVSM(
dim = 512,
max_image_size = 256,
patch_size = 32,
channels = 4,
depth = 2,
dropout_input_ray_prob = 0.5
)
mae = MAE(
lvsm = lvsm,
frac_masked = 0.5, # 1 in 2 image/ray pair to be masked out. minimum set to 1
frac_images_to_ray_masked = 0.5, # for a given image/ray pair that is masked, the proportion of images being masked vs rays (1. would be only images masked, 0. would be only rays masked). they cannot be both masked
image_to_ray_loss_weight = 1. # you can weigh the image recon oss differently than ray recon loss
)
ssl_loss = mae(
images,
rays
)
ssl_loss.backward()
# do the above in a loop on a huge amount of data
Above with camera in/extrsinsics
import torch
from lvsm_pytorch.lvsm import (
LVSM,
MAE,
MAECameraWrapper
)
intrinsic_rotation = torch.randn(2, 4, 3, 3)
extrinsic_rotation = torch.randn(2, 4, 3, 3)
translation = torch.randn(2, 4, 3)
uniform_points = torch.randn(2, 4, 3, 256, 256)
images = torch.randn(2, 4, 4, 256, 256)
lvsm = LVSM(
dim = 512,
max_image_size = 256,
patch_size = 32,
channels = 4,
depth = 2,
)
mae = MAE(lvsm)
model = MAECameraWrapper(mae)
loss = model(
intrinsic_rotation = intrinsic_rotation,
extrinsic_rotation = extrinsic_rotation,
translation = translation,
uniform_points = uniform_points,
images = images,
)
loss.backward()
Citations
@inproceedings{Jin2024LVSMAL,
title = {LVSM: A Large View Synthesis Model with Minimal 3D Inductive Bias},
author = {Haian Jin and Hanwen Jiang and Hao Tan and Kai Zhang and Sai Bi and Tianyuan Zhang and Fujun Luan and Noah Snavely and Zexiang Xu},
year = {2024},
url = {https://api.semanticscholar.org/CorpusID:273507016}
}
@article{Zhang2024CamerasAR,
title = {Cameras as Rays: Pose Estimation via Ray Diffusion},
author = {Jason Y. Zhang and Amy Lin and Moneish Kumar and Tzu-Hsuan Yang and Deva Ramanan and Shubham Tulsiani},
journal = {ArXiv},
year = {2024},
volume = {abs/2402.14817},
url = {https://api.semanticscholar.org/CorpusID:267782978}
}
@misc{he2021masked,
title = {Masked Autoencoders Are Scalable Vision Learners},
author = {Kaiming He and Xinlei Chen and Saining Xie and Yanghao Li and Piotr Dollár and Ross Girshick},
year = {2021},
eprint = {2111.06377},
archivePrefix = {arXiv},
primaryClass = {cs.CV}
}
@misc{kim2026worldrope,
title = {WorldRoPE: Probabilistic World-Centric Rotary Embedding for Multi-View Attention},
author = {Mijeong Kim and Kyujin Lim and Bohyung Han},
year = {2026},
eprint = {2610.16337},
archivePrefix = {arXiv},
primaryClass = {cs.CV},
url = {https://arxiv.org/abs/2610.16337}
}
@inproceedings{Ainslie2023CoLT5FL,
title = {CoLT5: Faster Long-Range Transformers with Conditional Computation},
author = {Joshua Ainslie and Tao Lei and Michiel de Jong and Santiago Ontañón and Siddhartha Brahma and Yury Zemlyanskiy and David Uthus and Mandy Guo and James Lee-Thorp and Yi Tay and Yun-Hsuan Sung and Sumit Sanghai},
year = {2023},
eprint = {2303.09752},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2303.09752}
}
@misc{gopalakrishnan2025decouplingwhatwherepolar,
title = {Decoupling the "What" and "Where" With Polar Coordinate Positional Embeddings},
author = {Anand Gopalakrishnan and Robert Csordás and Jürgen Schmidhuber and Michael C. Mozer},
year = {2025},
eprint = {2509.10534},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2509.10534}
}
@misc{kimiteam2026attentionresiduals,
title = {Attention Residuals},
author = {Kimi Team and Guangyu Chen and Yu Zhang and Jianlin Su and Weixin Xu and Siyuan Pan and Yaoyu Wang and Yucheng Wang and Guanduo Chen and Bohong Yin and Yutian Chen and Junjie Yan and Ming Wei and Y. Zhang and Fanqing Meng and Chao Hong and Xiaotong Xie and Shaowei Liu and Enzhe Lu and Yunpeng Tai and Yanru Chen and Xin Men and Haiqing Guo and Y. Charles and Haoyu Lu and Lin Sui and Jinguo Zhu and Zaida Zhou and Weiran He and Weixiao Huang and Xinran Xu and Yuzhi Wang and Guokun Lai and Yulun Du and Yuxin Wu and Zhilin Yang and Xinyu Zhou},
year = {2026},
eprint = {2603.15031},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
url = {https://arxiv.org/abs/2603.15031}
}
@misc{luo2026multiheadattentionresiduals,
title = {Multi-Head Attention Residuals},
author = {Cheng Luo and Zefan Cai and Junjie Hu},
year = {2026},
eprint = {2607.27230},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
url = {https://arxiv.org/abs/2607.27230}
}
Explorer des projets similaires
Chargement…