Commit
·
df7cc11
1
Parent(s):
3d787d3
Refactor vertex handling in generate3d function for improved performance
Browse files- Updated the vertex color assignment process to eliminate unnecessary CPU operations by directly using tensor data.
- Enhanced the creation of the mesh by utilizing tensor inputs for vertices and faces, streamlining the overall mesh generation workflow.
- inference.py +2 -2
inference.py
CHANGED
@@ -84,10 +84,10 @@ def generate3d(model, rgb, ccm, device):
|
|
84 |
|
85 |
# For each new vertex, find the nearest old vertex and copy its color
|
86 |
k = 3 # or 5, etc.
|
87 |
-
dists, idxs = tree.query(verts
|
88 |
new_colors = np.mean(color_tri[idxs], axis=1)
|
89 |
|
90 |
# Create the new mesh with colors
|
91 |
-
mesh = trimesh.Trimesh(vertices=verts
|
92 |
|
93 |
return obj_path
|
|
|
84 |
|
85 |
# For each new vertex, find the nearest old vertex and copy its color
|
86 |
k = 3 # or 5, etc.
|
87 |
+
dists, idxs = tree.query(verts, k=k)
|
88 |
new_colors = np.mean(color_tri[idxs], axis=1)
|
89 |
|
90 |
# Create the new mesh with colors
|
91 |
+
mesh = trimesh.Trimesh(vertices=verts, faces=faces, vertex_colors=new_colors)
|
92 |
|
93 |
return obj_path
|