Spaces:
Running
on
Zero
Running
on
Zero
xinjie.wang
commited on
Commit
·
01827f5
1
Parent(s):
7cdd1a1
update
Browse files
asset3d_gen/data/mesh_operator.py
CHANGED
@@ -68,28 +68,18 @@ class MeshFixer(object):
|
|
68 |
|
69 |
def __init__(
|
70 |
self,
|
|
|
|
|
71 |
device: str = "cuda",
|
72 |
) -> None:
|
73 |
self.device = device
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
faces: Union[torch.Tensor, np.ndarray],
|
82 |
-
):
|
83 |
-
self.vertices = (
|
84 |
-
torch.tensor(vertices, device=self.device)
|
85 |
-
if isinstance(vertices, np.ndarray)
|
86 |
-
else vertices.to(self.device)
|
87 |
-
)
|
88 |
-
self.faces = (
|
89 |
-
torch.tensor(faces.astype(np.int32), device=self.device)
|
90 |
-
if isinstance(faces, np.ndarray)
|
91 |
-
else faces.to(self.device)
|
92 |
-
)
|
93 |
|
94 |
@staticmethod
|
95 |
def log_mesh_changes(method):
|
@@ -421,6 +411,8 @@ class MeshFixer(object):
|
|
421 |
- vertices: Simplified and repaired vertex array of (V, 3).
|
422 |
- faces: Simplified and repaired face array of (F, 3).
|
423 |
"""
|
|
|
|
|
424 |
self.simplify(ratio=filter_ratio)
|
425 |
self.fill_holes(
|
426 |
max_hole_size=max_hole_size,
|
|
|
68 |
|
69 |
def __init__(
|
70 |
self,
|
71 |
+
vertices: Union[torch.Tensor, np.ndarray],
|
72 |
+
faces: Union[torch.Tensor, np.ndarray],
|
73 |
device: str = "cuda",
|
74 |
) -> None:
|
75 |
self.device = device
|
76 |
+
if isinstance(vertices, np.ndarray):
|
77 |
+
vertices = torch.tensor(vertices)
|
78 |
+
self.vertices = vertices
|
79 |
+
|
80 |
+
if isinstance(faces, np.ndarray):
|
81 |
+
faces = torch.tensor(faces)
|
82 |
+
self.faces = faces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
@staticmethod
|
85 |
def log_mesh_changes(method):
|
|
|
411 |
- vertices: Simplified and repaired vertex array of (V, 3).
|
412 |
- faces: Simplified and repaired face array of (F, 3).
|
413 |
"""
|
414 |
+
self.vertices.to(self.device)
|
415 |
+
self.faces.to(self.device)
|
416 |
self.simplify(ratio=filter_ratio)
|
417 |
self.fill_holes(
|
418 |
max_hole_size=max_hole_size,
|