Spaces:
Runtime error
Runtime error
Upload 147 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +9 -0
- .gitignore +41 -0
- app.py +88 -0
- configs/freesplatter-object-2dgs.yaml +22 -0
- configs/freesplatter-object.yaml +21 -0
- configs/freesplatter-scene.yaml +22 -0
- examples/img_to_3d/avatar.png +3 -0
- examples/img_to_3d/backpack.jpg +0 -0
- examples/img_to_3d/basketball.jpg +0 -0
- examples/img_to_3d/bird.jpg +0 -0
- examples/img_to_3d/boy.jpg +0 -0
- examples/img_to_3d/bread.jpg +0 -0
- examples/img_to_3d/bull.jpg +0 -0
- examples/img_to_3d/camera.jpg +0 -0
- examples/img_to_3d/censer.jpg +0 -0
- examples/img_to_3d/chair.jpg +0 -0
- examples/img_to_3d/chair2.jpg +0 -0
- examples/img_to_3d/chameleon.jpg +0 -0
- examples/img_to_3d/chicken.jpg +0 -0
- examples/img_to_3d/close.jpg +0 -0
- examples/img_to_3d/crab.jpg +0 -0
- examples/img_to_3d/crocodile.jpg +0 -0
- examples/img_to_3d/cute_tiger.jpg +0 -0
- examples/img_to_3d/cybertruck.jpg +0 -0
- examples/img_to_3d/dog.jpg +0 -0
- examples/img_to_3d/dog2.jpg +0 -0
- examples/img_to_3d/donkey.jpg +0 -0
- examples/img_to_3d/dragon.jpg +0 -0
- examples/img_to_3d/fox.jpg +0 -0
- examples/img_to_3d/girl.jpg +0 -0
- examples/img_to_3d/girl2.jpg +0 -0
- examples/img_to_3d/goat.jpg +0 -0
- examples/img_to_3d/harp.jpg +0 -0
- examples/img_to_3d/head.jpg +0 -0
- examples/img_to_3d/house.jpg +0 -0
- examples/img_to_3d/house2.jpg +0 -0
- examples/img_to_3d/king.jpg +0 -0
- examples/img_to_3d/lion.png +3 -0
- examples/img_to_3d/magician.jpg +0 -0
- examples/img_to_3d/peach.jpg +0 -0
- examples/img_to_3d/robot.jpg +0 -0
- examples/img_to_3d/robot2.jpg +0 -0
- examples/img_to_3d/sculpture.png +3 -0
- examples/img_to_3d/sculpture2.jpg +0 -0
- examples/img_to_3d/sign.jpg +0 -0
- examples/img_to_3d/sit.jpg +0 -0
- examples/img_to_3d/skateboard.jpg +0 -0
- examples/img_to_3d/stitch.jpg +0 -0
- examples/img_to_3d/stone.jpg +0 -0
- examples/img_to_3d/teddy_bread.jpg +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
examples/img_to_3d/avatar.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
examples/img_to_3d/lion.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
examples/img_to_3d/sculpture.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
examples/views_to_scene/dtu_1/000000.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
examples/views_to_scene/dtu_1/000002.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
examples/views_to_scene/wild_1/000.jpg filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
examples/views_to_scene/wild_1/001.jpg filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
examples/views_to_scene/wild_2/000.jpg filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
examples/views_to_scene/wild_2/001.jpg filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
eggs/
|
| 15 |
+
.eggs/
|
| 16 |
+
.vscode/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
*.egg-info/
|
| 24 |
+
.installed.cfg
|
| 25 |
+
*.egg
|
| 26 |
+
MANIFEST
|
| 27 |
+
|
| 28 |
+
.DS_Store
|
| 29 |
+
|
| 30 |
+
.env/
|
| 31 |
+
.trash/
|
| 32 |
+
ckpts/
|
| 33 |
+
logs/
|
| 34 |
+
data/
|
| 35 |
+
outputs/
|
| 36 |
+
figures*/
|
| 37 |
+
examples/
|
| 38 |
+
rebuttal/
|
| 39 |
+
apps/
|
| 40 |
+
*.sh
|
| 41 |
+
run.py
|
app.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
if 'OMP_NUM_THREADS' not in os.environ:
|
| 3 |
+
os.environ['OMP_NUM_THREADS'] = '16'
|
| 4 |
+
import torch
|
| 5 |
+
import gradio as gr
|
| 6 |
+
from functools import partial
|
| 7 |
+
from huggingface_hub import snapshot_download
|
| 8 |
+
|
| 9 |
+
from freesplatter.webui.runner import FreeSplatterRunner
|
| 10 |
+
from freesplatter.webui.tab_img_to_3d import create_interface_img_to_3d
|
| 11 |
+
from freesplatter.webui.tab_views_to_3d import create_interface_views_to_3d
|
| 12 |
+
from freesplatter.webui.tab_views_to_scene import create_interface_views_to_scene
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
os.makedirs('./ckpts/Hunyuan3D-1', exist_ok=True)
|
| 16 |
+
snapshot_download('tencent/Hunyuan3D-1', repo_type='model', local_dir='./ckpts/Hunyuan3D-1')
|
| 17 |
+
|
| 18 |
+
torch.set_grad_enabled(False)
|
| 19 |
+
device = torch.device('cuda')
|
| 20 |
+
runner = FreeSplatterRunner(device)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
_HEADER_ = '''
|
| 24 |
+
# FreeSplatter 🤗 Gradio Demo
|
| 25 |
+
\n\nOfficial demo of the paper [FreeSplatter: Pose-free Gaussian Splatting for Sparse-view 3D Reconstruction](https://arxiv.org/abs/2404.07191). [[Github]](https://github.com/TencentARC/FreeSplatter)
|
| 26 |
+
**FreeSplatter** is a feed-forward framework capable of generating high-quality 3D Gaussians from **uncalibrated** sparse-view images and recovering their camera parameters in mere seconds.
|
| 27 |
+
'''
|
| 28 |
+
|
| 29 |
+
_IMG_TO_3D_HELP_ = '''
|
| 30 |
+
💡💡💡**Usage Tips:**
|
| 31 |
+
- This demo supports various multi-view diffusion models, including [Hunyuan3D](https://github.com/Tencent/Hunyuan3D-1) Std and [Zero123++](https://github.com/SUDO-AI-3D/zero123plus) v1.1/v1.2. You can try different models to get the best result.
|
| 32 |
+
- Try clicking the \U0001f3b2\ufe0f button to use a different `Random seed` (default: 42) for diverse outputs.
|
| 33 |
+
- In most cases, using `2DGS` leads to better mesh geometry than `3DGS`. Please refer to the [2DGS paper](https://arxiv.org/abs/2403.17888).
|
| 34 |
+
- You can adjust the views used for reconstruction to alleviate the blurry texture problem caused by multi-view inconsistency.
|
| 35 |
+
'''
|
| 36 |
+
|
| 37 |
+
_CITE_ = r"""
|
| 38 |
+
If FreeSplatter is helpful, please help to ⭐ the <a href='https://github.com/TencentARC/FreeSplatter' target='_blank'>Github Repo</a>. Thanks! [](https://github.com/TencentARC/FreeSplatter)
|
| 39 |
+
---
|
| 40 |
+
📝 **Citation**
|
| 41 |
+
If you find our work useful for your research or applications, please cite using this bibtex:
|
| 42 |
+
```bibtex
|
| 43 |
+
@article{xu2024freesplatter,
|
| 44 |
+
title={FreeSplatter: Pose-free Gaussian Splatting for Sparse-view 3D Reconstruction},
|
| 45 |
+
author={Xu, Jiale and Gao, Shenghua and Shan, Ying},
|
| 46 |
+
journal={arXiv preprint},
|
| 47 |
+
year={2024}
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
📋 **License**
|
| 51 |
+
Apache-2.0 LICENSE. Please refer to the [LICENSE file](https://huggingface.co/spaces/TencentARC/FreeSplatter/blob/main/LICENSE) for details.
|
| 52 |
+
📧 **Contact**
|
| 53 |
+
If you have any questions, feel free to open a discussion or contact us at <b>[email protected]</b>.
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
with gr.Blocks(analytics_enabled=False, title='FreeSplatter Demo', theme=gr.themes.Ocean()) as demo:
|
| 58 |
+
gr.Markdown(_HEADER_)
|
| 59 |
+
|
| 60 |
+
with gr.Tabs() as main_tabs:
|
| 61 |
+
with gr.TabItem('Image-to-3D', id='tab_img_to_3d'):
|
| 62 |
+
gr.Markdown(_IMG_TO_3D_HELP_)
|
| 63 |
+
|
| 64 |
+
with gr.Tabs() as sub_tabs_img_to_3d:
|
| 65 |
+
with gr.TabItem('Hunyuan3D Std', id='tab_hunyuan3d_std'):
|
| 66 |
+
_, var_img_to_3d_hunyuan3d_std = create_interface_img_to_3d(
|
| 67 |
+
runner.run_segmentation,
|
| 68 |
+
runner.run_img_to_3d,
|
| 69 |
+
model='Hunyuan3D Std')
|
| 70 |
+
with gr.TabItem('Zero123++ v1.1', id='tab_zero123plus_v11'):
|
| 71 |
+
_, var_img_to_3d_zero123plus_v11 = create_interface_img_to_3d(
|
| 72 |
+
runner.run_segmentation,
|
| 73 |
+
runner.run_img_to_3d,
|
| 74 |
+
model='Zero123++ v1.1')
|
| 75 |
+
with gr.TabItem('Zero123++ v1.2', id='tab_zero123plus_v12'):
|
| 76 |
+
_, var_img_to_3d_zero123plus_v12 = create_interface_img_to_3d(
|
| 77 |
+
runner.run_segmentation,
|
| 78 |
+
runner.run_img_to_3d,
|
| 79 |
+
model='Zero123++ v1.2')
|
| 80 |
+
|
| 81 |
+
gr.Markdown(_CITE_)
|
| 82 |
+
|
| 83 |
+
demo.queue().launch(
|
| 84 |
+
share=False,
|
| 85 |
+
server_name="0.0.0.0",
|
| 86 |
+
server_port=41137,
|
| 87 |
+
ssl_verify=False,
|
| 88 |
+
)
|
configs/freesplatter-object-2dgs.yaml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
target: freesplatter.models.model.FreeSplatterModel
|
| 3 |
+
params:
|
| 4 |
+
transformer_config:
|
| 5 |
+
target: freesplatter.models.transformer.Transformer
|
| 6 |
+
params:
|
| 7 |
+
patch_size: 8
|
| 8 |
+
input_dim: 3
|
| 9 |
+
inner_dim: 1024
|
| 10 |
+
output_dim: 22
|
| 11 |
+
depth: 24
|
| 12 |
+
n_heads: 16
|
| 13 |
+
renderer_config:
|
| 14 |
+
sh_degree: 1
|
| 15 |
+
img_height: 512
|
| 16 |
+
img_width: 512
|
| 17 |
+
scaling_activation_type: sigmoid
|
| 18 |
+
scale_min_act: 0.0001
|
| 19 |
+
scale_max_act: 0.02
|
| 20 |
+
scale_multi_act: 0.1
|
| 21 |
+
sh_residual: false
|
| 22 |
+
use_2dgs: true
|
configs/freesplatter-object.yaml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
target: freesplatter.models.model.FreeSplatterModel
|
| 3 |
+
params:
|
| 4 |
+
transformer_config:
|
| 5 |
+
target: freesplatter.models.transformer.Transformer
|
| 6 |
+
params:
|
| 7 |
+
patch_size: 8
|
| 8 |
+
input_dim: 3
|
| 9 |
+
inner_dim: 1024
|
| 10 |
+
output_dim: 23
|
| 11 |
+
depth: 24
|
| 12 |
+
n_heads: 16
|
| 13 |
+
renderer_config:
|
| 14 |
+
sh_degree: 1
|
| 15 |
+
img_height: 512
|
| 16 |
+
img_width: 512
|
| 17 |
+
scaling_activation_type: sigmoid
|
| 18 |
+
scale_min_act: 0.0001
|
| 19 |
+
scale_max_act: 0.02
|
| 20 |
+
scale_multi_act: 0.1
|
| 21 |
+
sh_residual: false
|
configs/freesplatter-scene.yaml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
target: freesplatter.models.model.FreeSplatterModel
|
| 3 |
+
params:
|
| 4 |
+
transformer_config:
|
| 5 |
+
target: freesplatter.models.transformer.Transformer
|
| 6 |
+
params:
|
| 7 |
+
patch_size: 8
|
| 8 |
+
input_dim: 3
|
| 9 |
+
inner_dim: 1024
|
| 10 |
+
output_dim: 23
|
| 11 |
+
depth: 24
|
| 12 |
+
n_heads: 16
|
| 13 |
+
renderer_config:
|
| 14 |
+
sh_degree: 1
|
| 15 |
+
img_height: 512
|
| 16 |
+
img_width: 512
|
| 17 |
+
scaling_activation_type: sigmoid
|
| 18 |
+
scale_min_act: 0.0001
|
| 19 |
+
scale_max_act: 0.02
|
| 20 |
+
scale_multi_act: 0.1
|
| 21 |
+
bg_color: [0., 0., 0.]
|
| 22 |
+
sh_residual: true
|
examples/img_to_3d/avatar.png
ADDED
|
|
Git LFS Details
|
examples/img_to_3d/backpack.jpg
ADDED
|
examples/img_to_3d/basketball.jpg
ADDED
|
examples/img_to_3d/bird.jpg
ADDED
|
examples/img_to_3d/boy.jpg
ADDED
|
examples/img_to_3d/bread.jpg
ADDED
|
examples/img_to_3d/bull.jpg
ADDED
|
examples/img_to_3d/camera.jpg
ADDED
|
examples/img_to_3d/censer.jpg
ADDED
|
examples/img_to_3d/chair.jpg
ADDED
|
examples/img_to_3d/chair2.jpg
ADDED
|
examples/img_to_3d/chameleon.jpg
ADDED
|
examples/img_to_3d/chicken.jpg
ADDED
|
examples/img_to_3d/close.jpg
ADDED
|
examples/img_to_3d/crab.jpg
ADDED
|
examples/img_to_3d/crocodile.jpg
ADDED
|
examples/img_to_3d/cute_tiger.jpg
ADDED
|
examples/img_to_3d/cybertruck.jpg
ADDED
|
examples/img_to_3d/dog.jpg
ADDED
|
examples/img_to_3d/dog2.jpg
ADDED
|
examples/img_to_3d/donkey.jpg
ADDED
|
examples/img_to_3d/dragon.jpg
ADDED
|
examples/img_to_3d/fox.jpg
ADDED
|
examples/img_to_3d/girl.jpg
ADDED
|
examples/img_to_3d/girl2.jpg
ADDED
|
examples/img_to_3d/goat.jpg
ADDED
|
examples/img_to_3d/harp.jpg
ADDED
|
examples/img_to_3d/head.jpg
ADDED
|
examples/img_to_3d/house.jpg
ADDED
|
examples/img_to_3d/house2.jpg
ADDED
|
examples/img_to_3d/king.jpg
ADDED
|
examples/img_to_3d/lion.png
ADDED
|
Git LFS Details
|
examples/img_to_3d/magician.jpg
ADDED
|
examples/img_to_3d/peach.jpg
ADDED
|
examples/img_to_3d/robot.jpg
ADDED
|
examples/img_to_3d/robot2.jpg
ADDED
|
examples/img_to_3d/sculpture.png
ADDED
|
Git LFS Details
|
examples/img_to_3d/sculpture2.jpg
ADDED
|
examples/img_to_3d/sign.jpg
ADDED
|
examples/img_to_3d/sit.jpg
ADDED
|
examples/img_to_3d/skateboard.jpg
ADDED
|
examples/img_to_3d/stitch.jpg
ADDED
|
examples/img_to_3d/stone.jpg
ADDED
|
examples/img_to_3d/teddy_bread.jpg
ADDED
|