Spaces:
Running
on
Zero
Running
on
Zero
bug fix, add examples
Browse files
gradio_app/examples/ex1.png
ADDED
Git LFS Details
|
gradio_app/examples/{shoe.png → ex2.png}
RENAMED
File without changes
|
gradio_app/examples/ex3.jpg
ADDED
gradio_app/examples/ex4.png
ADDED
Git LFS Details
|
gradio_app/gradio_3dgen.py
CHANGED
@@ -18,7 +18,7 @@ def run_mv(preview_img, input_processing, seed):
|
|
18 |
rgb_pils, front_pil = run_mvprediction(preview_img, remove_bg=input_processing, seed=int(seed)) # 6s
|
19 |
return rgb_pils, front_pil
|
20 |
|
21 |
-
@spaces.GPU(duration=90) # seems split into multiple part will leads to `RuntimeError`, before fix it, still initialize here
|
22 |
def generate3dv2(preview_img, input_processing, seed, render_video=True, do_refine=True, expansion_weight=0.1, init_type="std"):
|
23 |
if preview_img is None:
|
24 |
raise gr.Error("The input image is none!")
|
|
|
18 |
rgb_pils, front_pil = run_mvprediction(preview_img, remove_bg=input_processing, seed=int(seed)) # 6s
|
19 |
return rgb_pils, front_pil
|
20 |
|
21 |
+
# @spaces.GPU(duration=90) # seems split into multiple part will leads to `RuntimeError`, before fix it, still initialize here
|
22 |
def generate3dv2(preview_img, input_processing, seed, render_video=True, do_refine=True, expansion_weight=0.1, init_type="std"):
|
23 |
if preview_img is None:
|
24 |
raise gr.Error("The input image is none!")
|
mesh_reconstruction/recon.py
CHANGED
@@ -51,7 +51,7 @@ def reconstruct_stage1(pils: List[Image.Image], steps=100, vertices=None, faces=
|
|
51 |
|
52 |
vertices,faces = opt.remesh(poisson=False)
|
53 |
|
54 |
-
vertices, faces = vertices.detach(), faces.detach()
|
55 |
|
56 |
if return_mesh:
|
57 |
return to_py3d_mesh(vertices, faces)
|
|
|
51 |
|
52 |
vertices,faces = opt.remesh(poisson=False)
|
53 |
|
54 |
+
vertices, faces = vertices.detach().cpu(), faces.detach().cpu()
|
55 |
|
56 |
if return_mesh:
|
57 |
return to_py3d_mesh(vertices, faces)
|
mesh_reconstruction/refine.py
CHANGED
@@ -10,6 +10,7 @@ from scripts.project_mesh import multiview_color_projection, get_cameras_list
|
|
10 |
from scripts.utils import to_py3d_mesh, from_py3d_mesh, init_target
|
11 |
|
12 |
def run_mesh_refine(vertices, faces, pils: List[Image.Image], steps=100, start_edge_len=0.02, end_edge_len=0.005, decay=0.99, update_normal_interval=10, update_warmup=10, return_mesh=True, process_inputs=True, process_outputs=True):
|
|
|
13 |
if process_inputs:
|
14 |
vertices = vertices * 2 / 1.35
|
15 |
vertices[..., [0, 2]] = - vertices[..., [0, 2]]
|
@@ -67,7 +68,7 @@ def run_mesh_refine(vertices, faces, pils: List[Image.Image], steps=100, start_e
|
|
67 |
|
68 |
vertices,faces = opt.remesh(poisson=(i in poission_steps))
|
69 |
|
70 |
-
vertices, faces = vertices.detach(), faces.detach()
|
71 |
|
72 |
if process_outputs:
|
73 |
vertices = vertices / 2 * 1.35
|
|
|
10 |
from scripts.utils import to_py3d_mesh, from_py3d_mesh, init_target
|
11 |
|
12 |
def run_mesh_refine(vertices, faces, pils: List[Image.Image], steps=100, start_edge_len=0.02, end_edge_len=0.005, decay=0.99, update_normal_interval=10, update_warmup=10, return_mesh=True, process_inputs=True, process_outputs=True):
|
13 |
+
vertices, faces = vertices.to("cuda"), faces.to("cuda")
|
14 |
if process_inputs:
|
15 |
vertices = vertices * 2 / 1.35
|
16 |
vertices[..., [0, 2]] = - vertices[..., [0, 2]]
|
|
|
68 |
|
69 |
vertices,faces = opt.remesh(poisson=(i in poission_steps))
|
70 |
|
71 |
+
vertices, faces = vertices.detach().cpu(), faces.detach().cpu()
|
72 |
|
73 |
if process_outputs:
|
74 |
vertices = vertices / 2 * 1.35
|
scripts/multiview_inference.py
CHANGED
@@ -153,4 +153,4 @@ def geo_reconstruct_part2(vertices, faces):
|
|
153 |
def geo_reconstruct_part3(meshes, img_list):
|
154 |
meshes = meshes.to("cuda")
|
155 |
new_meshes = multiview_color_projection(meshes, img_list, resolution=1024, device="cuda", complete_unseen=True, confidence_threshold=0.2, cameras_list = get_cameras_list([0, 90, 180, 270], "cuda", focal=1))
|
156 |
-
return new_meshes
|
|
|
153 |
def geo_reconstruct_part3(meshes, img_list):
|
154 |
meshes = meshes.to("cuda")
|
155 |
new_meshes = multiview_color_projection(meshes, img_list, resolution=1024, device="cuda", complete_unseen=True, confidence_threshold=0.2, cameras_list = get_cameras_list([0, 90, 180, 270], "cuda", focal=1))
|
156 |
+
return new_meshes.to("cpu")
|