ckc99u commited on
Commit
c42b29d
·
verified ·
1 Parent(s): bf5fbab

Update RigNet/quick_start.py

Browse files
Files changed (1) hide show
  1. RigNet/quick_start.py +10 -12
RigNet/quick_start.py CHANGED
@@ -90,31 +90,29 @@ def create_single_data(mesh_filename):
90
  # batch
91
  batch = torch.zeros(len(v), dtype=torch.long)
92
 
93
- # voxel - FIXED: Use absolute path and better error handling
94
  binvox_file = mesh_filename.replace('_remesh.obj', '_normalized.binvox')
95
  normalized_obj = mesh_filename.replace("_remesh.obj", "_normalized.obj")
96
 
97
  if not os.path.exists(binvox_file):
98
- print(f" voxelizing mesh with binvox...")
99
-
100
- # Use absolute path to binvox (installed in Dockerfile)
101
  if platform == "linux" or platform == "linux2":
102
- cmd = f"binvox -d 88 -pb {normalized_obj}"
 
103
  elif platform == "win32":
104
  cmd = f"binvox.exe -d 88 {normalized_obj}"
105
  else:
106
- raise Exception('Sorry, we currently only support windows and linux.')
107
-
108
- print(f" Running: {cmd}")
109
  exit_code = os.system(cmd)
110
-
111
  if exit_code != 0:
112
  raise Exception(f"binvox command failed with exit code {exit_code}. Command: {cmd}")
113
-
114
  if not os.path.exists(binvox_file):
115
  raise Exception(f"binvox did not create output file: {binvox_file}")
116
-
117
- print(f" ✓ Voxelization complete: {binvox_file}")
118
 
119
  with open(binvox_file, 'rb') as fvox:
120
  vox = binvox_rw.read_as_3d_array(fvox)
 
90
  # batch
91
  batch = torch.zeros(len(v), dtype=torch.long)
92
 
 
93
  binvox_file = mesh_filename.replace('_remesh.obj', '_normalized.binvox')
94
  normalized_obj = mesh_filename.replace("_remesh.obj", "_normalized.obj")
95
 
96
  if not os.path.exists(binvox_file):
97
+ print(" voxelizing mesh with binvox...")
98
+ # On headless Linux (Hugging Face), run binvox under Xvfb
 
99
  if platform == "linux" or platform == "linux2":
100
+ # -a will pick a free display (e.g. :99) and start Xvfb for this command
101
+ cmd = f"xvfb-run -a binvox -d 88 -pb {normalized_obj}"
102
  elif platform == "win32":
103
  cmd = f"binvox.exe -d 88 {normalized_obj}"
104
  else:
105
+ raise Exception("Sorry, we currently only support Windows and Linux.")
106
+
107
+ print(f" Running: {cmd}")
108
  exit_code = os.system(cmd)
 
109
  if exit_code != 0:
110
  raise Exception(f"binvox command failed with exit code {exit_code}. Command: {cmd}")
111
+
112
  if not os.path.exists(binvox_file):
113
  raise Exception(f"binvox did not create output file: {binvox_file}")
114
+
115
+ print(f" ✓ Voxelization complete: {binvox_file}")
116
 
117
  with open(binvox_file, 'rb') as fvox:
118
  vox = binvox_rw.read_as_3d_array(fvox)