Spaces:
Runtime error
Runtime error
update
Browse files- app.py +27 -10
- refine/render.py +1 -1
app.py
CHANGED
|
@@ -49,17 +49,32 @@ EXAMPLE_APOSE_IMAGES = glob.glob("./input_cases_apose/*")
|
|
| 49 |
|
| 50 |
infer_api = InferAPI(config_canocalize, config_multiview, config_slrm, config_refine)
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
-
|
| 59 |
-
|
| 60 |
2. Real person images generally work well, but note that normals may appear smoother than expected. You can try to use other monocular normal estimation models.
|
| 61 |
-
|
| 62 |
3. The base human model in the output is uncolored due to potential NSFW concerns. If you need colored results, please refer to the official GitHub repository for instructions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
"""
|
| 64 |
|
| 65 |
# 示例占位函数 - 需替换实际模型
|
|
@@ -86,7 +101,7 @@ def refine_mesh(apose_img, mesh1, mesh2, mesh3, seed):
|
|
| 86 |
return refined
|
| 87 |
|
| 88 |
with gr.Blocks(title="StdGEN: Semantically Decomposed 3D Character Generation from Single Images") as demo:
|
| 89 |
-
gr.Markdown(
|
| 90 |
with gr.Row():
|
| 91 |
with gr.Column():
|
| 92 |
gr.Markdown("## 1. Reference Image to A-pose Image")
|
|
@@ -139,6 +154,8 @@ with gr.Blocks(title="StdGEN: Semantically Decomposed 3D Character Generation fr
|
|
| 139 |
refined_meshes = [gr.Model3D(label=f"refined mesh {i+1}", height=384) for i in range(3)]
|
| 140 |
refined_full_mesh = gr.Model3D(label="refined whole mesh", height=384)
|
| 141 |
|
|
|
|
|
|
|
| 142 |
# 交互逻辑
|
| 143 |
pose_btn.click(
|
| 144 |
arbitrary_to_apose,
|
|
|
|
| 49 |
|
| 50 |
infer_api = InferAPI(config_canocalize, config_multiview, config_slrm, config_refine)
|
| 51 |
|
| 52 |
+
_HEADER_ = '''
|
| 53 |
+
<h2><b>[CVPR 2025] StdGEN 🤗 Gradio Demo</b></h2>
|
| 54 |
+
This is official demo for our CVPR 2025 paper <a href="">StdGEN: Semantic-Decomposed 3D Character Generation from Single Images</a>.
|
| 55 |
+
Code: <a href='https://github.com/hyz317/StdGEN' target='_blank'>GitHub</a>. Paper: <a href='https://arxiv.org/abs/2411.05738' target='_blank'>ArXiv</a>.
|
| 56 |
+
❗️❗️❗️**Important Notes:**
|
| 57 |
+
1. - You can upload any reference image (with or without background). A-pose images are also supported (white bkg required).
|
| 58 |
+
- If the image has an alpha channel (transparency), background segmentation will be automatically performed. Alternatively, you can pre-segment the background using other tools and upload the result directly.
|
|
|
|
| 59 |
2. Real person images generally work well, but note that normals may appear smoother than expected. You can try to use other monocular normal estimation models.
|
|
|
|
| 60 |
3. The base human model in the output is uncolored due to potential NSFW concerns. If you need colored results, please refer to the official GitHub repository for instructions.
|
| 61 |
+
'''
|
| 62 |
+
|
| 63 |
+
_CITE_ = r"""
|
| 64 |
+
If StdGEN is helpful, please help to ⭐ the <a href='https://github.com/hyz317/StdGEN' target='_blank'>Github Repo</a>. Thanks! [](https://github.com/hyz317/StdGEN)
|
| 65 |
+
---
|
| 66 |
+
📝 **Citation**
|
| 67 |
+
If you find our work useful for your research or applications, please cite using this bibtex:
|
| 68 |
+
```bibtex
|
| 69 |
+
@article{he2024stdgen,
|
| 70 |
+
title={StdGEN: Semantic-Decomposed 3D Character Generation from Single Images},
|
| 71 |
+
author={He, Yuze and Zhou, Yanning and Zhao, Wang and Wu, Zhongkai and Xiao, Kaiwen and Yang, Wei and Liu, Yong-Jin and Han, Xiao},
|
| 72 |
+
journal={arXiv preprint arXiv:2411.05738},
|
| 73 |
+
year={2024}
|
| 74 |
+
}
|
| 75 |
+
```
|
| 76 |
+
📧 **Contact**
|
| 77 |
+
If you have any questions, feel free to open a discussion or contact us at <b>hyz22@mails.tsinghua.edu.cn</b>.
|
| 78 |
"""
|
| 79 |
|
| 80 |
# 示例占位函数 - 需替换实际模型
|
|
|
|
| 101 |
return refined
|
| 102 |
|
| 103 |
with gr.Blocks(title="StdGEN: Semantically Decomposed 3D Character Generation from Single Images") as demo:
|
| 104 |
+
gr.Markdown(_HEADER_)
|
| 105 |
with gr.Row():
|
| 106 |
with gr.Column():
|
| 107 |
gr.Markdown("## 1. Reference Image to A-pose Image")
|
|
|
|
| 154 |
refined_meshes = [gr.Model3D(label=f"refined mesh {i+1}", height=384) for i in range(3)]
|
| 155 |
refined_full_mesh = gr.Model3D(label="refined whole mesh", height=384)
|
| 156 |
|
| 157 |
+
gr.Markdown(_CITE_)
|
| 158 |
+
|
| 159 |
# 交互逻辑
|
| 160 |
pose_btn.click(
|
| 161 |
arbitrary_to_apose,
|
refine/render.py
CHANGED
|
@@ -33,7 +33,7 @@ class NormalsRenderer:
|
|
| 33 |
else:
|
| 34 |
self._mvp = mvp
|
| 35 |
self._image_size = image_size
|
| 36 |
-
self._glctx =
|
| 37 |
_warmup(self._glctx, device)
|
| 38 |
|
| 39 |
def render(self,
|
|
|
|
| 33 |
else:
|
| 34 |
self._mvp = mvp
|
| 35 |
self._image_size = image_size
|
| 36 |
+
self._glctx = dr.RasterizeCudaContext(device=device)
|
| 37 |
_warmup(self._glctx, device)
|
| 38 |
|
| 39 |
def render(self,
|