File size: 4,095 Bytes
e4e030b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
diff --git a/run_inference.py b/run_inference.py
index 96f93e3..2b9401a 100644
--- a/run_inference.py
+++ b/run_inference.py
@@ -140,6 +140,7 @@ def run_inference(
     attention_stage: Optional[str] = None,
     attention_layers: Optional[List[int]] = None,
     save_coords: bool = False,
+    mesh_postprocess: bool = False,
 ):
     """
     Run inference
@@ -223,7 +224,7 @@ def run_inference(
             mask,
             seed=seed,
             stage1_only=False,
-            with_mesh_postprocess=False,
+            with_mesh_postprocess=mesh_postprocess,
             with_texture_baking=False,
             use_vertex_color=True,
             stage1_inference_steps=stage1_steps,
@@ -241,7 +242,7 @@ def run_inference(
             stage1_inference_steps=stage1_steps,
             stage2_inference_steps=stage2_steps,
             decode_formats=decode_formats,
-            with_mesh_postprocess=False,
+            with_mesh_postprocess=mesh_postprocess,
             with_texture_baking=False,
             use_vertex_color=True,
             attention_logger=attention_logger,
@@ -387,7 +388,13 @@ Examples:
         action="store_true",
         help="Save 3D spatial coordinates in SLAT attention files (default: False)",
     )
-    
+    parser.add_argument(
+        "--mesh-postprocess",
+        dest="mesh_postprocess",
+        action="store_true",
+        help="Enable mesh postprocessing (simplify=0.95, fill holes). Default: False (dense mesh).",
+    )
+
     args = parser.parse_args()
     
     input_path = Path(args.input_path)
@@ -414,6 +421,7 @@ Examples:
             attention_stage=args.attention_stage,
             attention_layers=parse_attention_layers(args.attention_layers),
             save_coords=args.save_coords,
+            mesh_postprocess=args.mesh_postprocess,
         )
     except Exception as e:
         logger.error(f"Inference failed: {e}")
diff --git a/run_inference_weighted.py b/run_inference_weighted.py
index ef9ca36..cfe968e 100644
--- a/run_inference_weighted.py
+++ b/run_inference_weighted.py
@@ -2548,6 +2548,7 @@ def run_weighted_inference(
     pose_opt_mask_erosion: int = 3,
     pose_opt_device: str = "cuda",
     pose_opt_optimize_scale: bool = False,
+    mesh_postprocess: bool = False,
 ):
     """
     Run weighted inference with adaptive multi-view fusion.
@@ -2939,7 +2940,7 @@ def run_weighted_inference(
             mask,
             seed=seed,
             stage1_only=False,
-            with_mesh_postprocess=False,
+            with_mesh_postprocess=mesh_postprocess,
             with_texture_baking=False,
             use_vertex_color=True,
             stage1_inference_steps=stage1_steps,
@@ -2988,7 +2989,7 @@ def run_weighted_inference(
             stage1_inference_steps=stage1_steps,
             stage2_inference_steps=stage2_steps,
             decode_formats=decode_formats,
-            with_mesh_postprocess=False,
+            with_mesh_postprocess=mesh_postprocess,
             with_texture_baking=False,
             use_vertex_color=True,
             attention_logger=attention_logger,
@@ -3968,7 +3969,9 @@ Examples:
                         help="Pose optimization: device (cuda or cpu, default: cuda)")
     parser.add_argument("--pose_opt_optimize_scale", action="store_true",
                         help="Pose optimization: optimize scale (default: False, only optimize rotation and translation)")
-    
+    parser.add_argument("--mesh-postprocess", dest="mesh_postprocess", action="store_true",
+                        help="Enable mesh postprocessing (simplify=0.95, fill holes). Default: False (dense mesh).")
+
     args = parser.parse_args()
     
     input_path = Path(args.input_path)
@@ -4077,6 +4080,7 @@ Examples:
                 pose_opt_mask_erosion=args.pose_opt_mask_erosion,
                 pose_opt_device=args.pose_opt_device,
                 pose_opt_optimize_scale=args.pose_opt_optimize_scale,
+                mesh_postprocess=args.mesh_postprocess,
             )
     except Exception as e:
         logger.error(f"Inference failed: {e}")