lvsm-pytorch


Namelvsm-pytorch JSON
Version 0.0.12 PyPI version JSON
download
home_pageNone
SummaryLVSM - Pytorch
upload_time2024-11-05 18:55:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Phil Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords artificial intelligence attention mechanism deep learning novel view synthesis transformers
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="./lvsm.png" width="500px"></img>

<img src="./lvsm-finding.png" width="400px"></img>

<img src="./plucker-ray.png" width="400px"></img>

## LVSM - Pytorch (wip)

Implementation of [LVSM](https://haian-jin.github.io/projects/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 <a href="https://openreview.net/forum?id=A8Vuf2e8y6">another</a> from ICLR 2025

## Install

```bash
$ pip install lvsm-pytorch
```

## Usage

```python
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)

```python
import torch
from lvsm_pytorch.lvsm 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,
)

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()
```

## Citations

```bibtex
@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}
}
```

```bibtex
@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}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "lvsm-pytorch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "artificial intelligence, attention mechanism, deep learning, novel view synthesis, transformers",
    "author": null,
    "author_email": "Phil Wang <lucidrains@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/84/15/706e69388e4ac061944842ef73fb50a84d025e5e0fdceedbb20a2678198d/lvsm_pytorch-0.0.12.tar.gz",
    "platform": null,
    "description": "<img src=\"./lvsm.png\" width=\"500px\"></img>\n\n<img src=\"./lvsm-finding.png\" width=\"400px\"></img>\n\n<img src=\"./plucker-ray.png\" width=\"400px\"></img>\n\n## LVSM - Pytorch (wip)\n\nImplementation of [LVSM](https://haian-jin.github.io/projects/LVSM/), SOTA Large View Synthesis with Minimal 3d Inductive Bias, from Adobe Research\n\nWe will focus only on the Decoder-only architecture in this repository.\n\nThis paper lines up with <a href=\"https://openreview.net/forum?id=A8Vuf2e8y6\">another</a> from ICLR 2025\n\n## Install\n\n```bash\n$ pip install lvsm-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom lvsm_pytorch import LVSM\n\nrays = torch.randn(2, 4, 6, 256, 256)\nimages = torch.randn(2, 4, 3, 256, 256)\n\ntarget_rays = torch.randn(2, 6, 256, 256)\ntarget_images = torch.randn(2, 3, 256, 256)\n\nmodel = LVSM(\n    dim = 512,\n    max_image_size = 256,\n    patch_size = 32,\n    depth = 2,\n)\n\nloss = model(\n    input_images = images,\n    input_rays = rays,\n    target_rays = target_rays,\n    target_images = target_images\n)\n\nloss.backward()\n\n# after much training\n\npred_images = model(\n    input_images = images,\n    input_rays = rays,\n    target_rays = target_rays,\n) # (2, 3, 256, 256)\n\nassert pred_images.shape == target_images.shape\n```\n\nOr 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)\n\n```python\nimport torch\nfrom lvsm_pytorch.lvsm import LVSM, CameraWrapper\n\ninput_intrinsic_rotation = torch.randn(2, 4, 3, 3)\ninput_extrinsic_rotation = torch.randn(2, 4, 3, 3)\ninput_translation = torch.randn(2, 4, 3)\ninput_uniform_points = torch.randn(2, 4, 3, 256, 256)\n\ntarget_intrinsic_rotation = torch.randn(2, 3, 3)\ntarget_extrinsic_rotation = torch.randn(2, 3, 3)\ntarget_translation = torch.randn(2, 3)\ntarget_uniform_points = torch.randn(2, 3, 256, 256)\n\nimages = torch.randn(2, 4, 4, 256, 256)\ntarget_images = torch.randn(2, 4, 256, 256)\n\nlvsm = LVSM(\n    dim = 512,\n    max_image_size = 256,\n    patch_size = 32,\n    channels = 4,\n    depth = 2,\n)\n\nmodel = CameraWrapper(lvsm)\n\nloss = model(\n    input_intrinsic_rotation = input_intrinsic_rotation,\n    input_extrinsic_rotation = input_extrinsic_rotation,\n    input_translation = input_translation,\n    input_uniform_points = input_uniform_points,\n    target_intrinsic_rotation = target_intrinsic_rotation,\n    target_extrinsic_rotation = target_extrinsic_rotation,\n    target_translation = target_translation,\n    target_uniform_points = target_uniform_points,\n    input_images = images,\n    target_images = target_images,\n)\n\nloss.backward()\n```\n\n## Citations\n\n```bibtex\n@inproceedings{Jin2024LVSMAL,\n    title   = {LVSM: A Large View Synthesis Model with Minimal 3D Inductive Bias},\n    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},\n    year    = {2024},\n    url     = {https://api.semanticscholar.org/CorpusID:273507016}\n}\n```\n\n```bibtex\n@article{Zhang2024CamerasAR,\n    title     = {Cameras as Rays: Pose Estimation via Ray Diffusion},\n    author    = {Jason Y. Zhang and Amy Lin and Moneish Kumar and Tzu-Hsuan Yang and Deva Ramanan and Shubham Tulsiani},\n    journal   = {ArXiv},\n    year      = {2024},\n    volume    = {abs/2402.14817},\n    url       = {https://api.semanticscholar.org/CorpusID:267782978}\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Phil Wang  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "LVSM - Pytorch",
    "version": "0.0.12",
    "project_urls": {
        "Homepage": "https://pypi.org/project/lvsm-pytorch/",
        "Repository": "https://github.com/lucidrains/lvsm-pytorch"
    },
    "split_keywords": [
        "artificial intelligence",
        " attention mechanism",
        " deep learning",
        " novel view synthesis",
        " transformers"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4f682aa4f4d2ec5e965605c8220e3203a207f50f1f8c8c91fdb417f494a7eba",
                "md5": "dd94679dd5c2134ec7e25859a62fe380",
                "sha256": "6c0eb09783d0d64a45ee4cec021e2645739335b64269b39c477d309878bda9ec"
            },
            "downloads": -1,
            "filename": "lvsm_pytorch-0.0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dd94679dd5c2134ec7e25859a62fe380",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7254,
            "upload_time": "2024-11-05T18:55:54",
            "upload_time_iso_8601": "2024-11-05T18:55:54.348745Z",
            "url": "https://files.pythonhosted.org/packages/d4/f6/82aa4f4d2ec5e965605c8220e3203a207f50f1f8c8c91fdb417f494a7eba/lvsm_pytorch-0.0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8415706e69388e4ac061944842ef73fb50a84d025e5e0fdceedbb20a2678198d",
                "md5": "f6310ef1c24980ff4eba1bf0b6a19a46",
                "sha256": "ff497bc62b27669b2031e9fbb8aa13a9db3b03fa458d2eb6cebed175386a4584"
            },
            "downloads": -1,
            "filename": "lvsm_pytorch-0.0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "f6310ef1c24980ff4eba1bf0b6a19a46",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1489418,
            "upload_time": "2024-11-05T18:55:55",
            "upload_time_iso_8601": "2024-11-05T18:55:55.665094Z",
            "url": "https://files.pythonhosted.org/packages/84/15/706e69388e4ac061944842ef73fb50a84d025e5e0fdceedbb20a2678198d/lvsm_pytorch-0.0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-05 18:55:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lucidrains",
    "github_project": "lvsm-pytorch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lvsm-pytorch"
}
        
Elapsed time: 0.39552s