aiqtech commited on
Commit
5ca7c6f
Β·
verified Β·
1 Parent(s): c09aad1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -347,20 +347,20 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
347
  # GLB λ³€ν™˜
348
  with torch.inference_mode():
349
  try:
350
- # Gaussian ν…μ„œλ“€μ„ requires_grad=True둜 μ„€μ •
351
  for attr_name in ['_xyz', '_features_dc', '_scaling', '_rotation', '_opacity']:
352
  if hasattr(gs, attr_name):
353
  tensor = getattr(gs, attr_name)
354
  if torch.is_tensor(tensor):
355
- # ν…μ„œλ₯Ό λ³΅μ œν•˜κ³  requires_grad μ„€μ •
356
- new_tensor = tensor.clone().detach().requires_grad_(True)
357
  setattr(gs, attr_name, new_tensor)
358
 
359
- # Mesh ν…μ„œλ“€μ„ requires_grad=True둜 μ„€μ •
360
  if hasattr(mesh, 'vertices') and torch.is_tensor(mesh.vertices):
361
- mesh.vertices = mesh.vertices.clone().detach().requires_grad_(True)
362
  if hasattr(mesh, 'faces') and torch.is_tensor(mesh.faces):
363
- mesh.faces = mesh.faces.clone().detach().requires_grad_(True)
364
 
365
  # GLB λ³€ν™˜ μ‹œλ„
366
  try:
@@ -370,8 +370,8 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
370
  simplify=mesh_simplify,
371
  texture_size=texture_size,
372
  verbose=True,
373
- optimize_uv=True, # UV μ΅œμ ν™” ν™œμ„±ν™”
374
- optimize_steps=2500 # μ΅œμ ν™” μŠ€ν… 수 μ„€μ •
375
  )
376
  except RuntimeError as e:
377
  print(f"GLB conversion failed with RuntimeError: {str(e)}")
@@ -382,7 +382,7 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
382
  simplify=mesh_simplify,
383
  texture_size=texture_size,
384
  verbose=True,
385
- optimize_uv=False # UV μ΅œμ ν™” λΉ„ν™œμ„±ν™”
386
  )
387
 
388
  except Exception as e:
 
347
  # GLB λ³€ν™˜
348
  with torch.inference_mode():
349
  try:
350
+ # Gaussian ν…μ„œλ“€μ„ float32둜 λ³€ν™˜
351
  for attr_name in ['_xyz', '_features_dc', '_scaling', '_rotation', '_opacity']:
352
  if hasattr(gs, attr_name):
353
  tensor = getattr(gs, attr_name)
354
  if torch.is_tensor(tensor):
355
+ # ν…μ„œλ₯Ό float32둜 λ³€ν™˜
356
+ new_tensor = tensor.clone().detach().float()
357
  setattr(gs, attr_name, new_tensor)
358
 
359
+ # Mesh ν…μ„œλ“€μ„ float32둜 λ³€ν™˜
360
  if hasattr(mesh, 'vertices') and torch.is_tensor(mesh.vertices):
361
+ mesh.vertices = mesh.vertices.clone().detach().float()
362
  if hasattr(mesh, 'faces') and torch.is_tensor(mesh.faces):
363
+ mesh.faces = mesh.faces.clone().detach().long() # facesλŠ” μ •μˆ˜ν˜•μœΌλ‘œ μœ μ§€
364
 
365
  # GLB λ³€ν™˜ μ‹œλ„
366
  try:
 
370
  simplify=mesh_simplify,
371
  texture_size=texture_size,
372
  verbose=True,
373
+ optimize_uv=True,
374
+ optimize_steps=2500
375
  )
376
  except RuntimeError as e:
377
  print(f"GLB conversion failed with RuntimeError: {str(e)}")
 
382
  simplify=mesh_simplify,
383
  texture_size=texture_size,
384
  verbose=True,
385
+ optimize_uv=False
386
  )
387
 
388
  except Exception as e: