Commit
·
d65fe1c
1
Parent(s):
1ca648e
Update generate3d function to use a data dictionary for mesh export, improving compatibility with CRM model. Adjusted export call to include output directory and device parameters, while maintaining the conversion from .obj to .glb format.
Browse files- inference.py +6 -3
inference.py
CHANGED
@@ -15,10 +15,13 @@ def generate3d(model, rgb_image, xyz_image, device="cpu"):
|
|
15 |
obj_path = base_path + ".obj"
|
16 |
glb_path = base_path + ".glb"
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
|
21 |
-
#
|
|
|
|
|
|
|
22 |
mesh = Mesh.load(obj_path, device=torch.device("cpu"))
|
23 |
mesh.write(glb_path)
|
24 |
|
|
|
15 |
obj_path = base_path + ".obj"
|
16 |
glb_path = base_path + ".glb"
|
17 |
|
18 |
+
# CRM export expects a data dictionary
|
19 |
+
data = {"rgb": rgb_image, "xyz": xyz_image}
|
20 |
|
21 |
+
# Export mesh using CRM model
|
22 |
+
model.export_mesh_wt_uv(data, output_dir, 0, device, 1024)
|
23 |
+
|
24 |
+
# Convert .obj to .glb
|
25 |
mesh = Mesh.load(obj_path, device=torch.device("cpu"))
|
26 |
mesh.write(glb_path)
|
27 |
|