ashawkey / stable-dreamfusion

Text-to-3D & Image-to-3D & Mesh Exportation with NeRF + Diffusion.
Apache License 2.0
7.99k stars 710 forks source link

AttributeError: module 'pymeshlab' has no attribute 'Percentage' #363

Open erikestany opened 1 month ago

erikestany commented 1 month ago

Description

Hi. The Colab notebook generates the videos, but when it has to generate the mesh, this error appears. Some idea? Thanks.

Namespace(text=None, negative='', O=True, O2=False, test=True, eval_interval=1, workspace='trial', guidance='stable-diffusion', seed=0, save_mesh=True, mcubes_resolution=256, decimate_target=100000.0, iters=10000, lr=0.001, warm_iters=500, min_lr=0.0001, ckpt='latest', cuda_ray=True, taichi_ray=False, max_steps=1024, num_steps=64, upsample_steps=32, update_extra_interval=16, max_ray_batch=4096, warmup_iters=2000, jitter_pose=False, uniform_sphere_rate=0.5, bg_radius=1.4, density_activation='softplus', density_thresh=0.1, blob_density=10, blob_radius=0.5, backbone='grid', optim='adan', sd_version='2.1', hf_key=None, fp16=True, vram_O=False, w=64, h=64, bound=1, dt_gamma=0, min_near=0.1, radius_range=[1.0, 1.5], fovy_range=[40, 70], dir_text=True, suppress_face=False, angle_overhead=30, angle_front=60, lambda_entropy=0.0001, lambda_opacity=0, lambda_orient=0.01, lambda_tv=0, gui=False, W=800, H=800, radius=3, fovy=60, light_theta=60, light_phi=0, max_spp=1)
NeRFNetwork(
  (encoder): GridEncoder: input_dim=3 num_levels=16 level_dim=2 resolution=16 -> 2048 per_level_scale=1.3819 params=(6119864, 2) gridtype=hash align_corners=False interpolation=smoothstep
  (sigma_net): MLP(
    (net): ModuleList(
      (0): Linear(in_features=32, out_features=32, bias=True)
      (1): Linear(in_features=32, out_features=4, bias=True)
    )
  )
  (encoder_bg): FreqEncoder: input_dim=3 degree=6 output_dim=39
  (bg_net): MLP(
    (net): ModuleList(
      (0): Linear(in_features=39, out_features=16, bias=True)
      (1): Linear(in_features=16, out_features=3, bias=True)
    )
  )
)
[INFO] Cmdline: main.py -O --test --workspace trial --save_mesh
[INFO] Trainer: df | 2024-06-04_19-00-10 | cuda | fp16 | trial
[INFO] #parameters: 12241607
[INFO] Loading latest checkpoint ...
[INFO] Latest checkpoint is trial/checkpoints/df_ep0005.pth
[INFO] loaded model.
[INFO] load at epoch 5, global step 500
[WARN] Failed to load optimizer.
[INFO] loaded scheduler.
[INFO] loaded scaler.
==> Start Test, save results to trial/results
100% 100/100 [00:47<00:00,  2.21it/s]
==> Finished Test.
100% 100/100 [01:01<00:00,  1.64it/s]
==> Saving mesh to trial/mesh
[INFO] marching cubes thresh: 2.5 (3.3152773061539964e-12 ~ 12.096467971801758)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/content/stable-dreamfusion/main.py](https://localhost:8080/#) in <module>
    143                 # a special loader for poisson mesh reconstruction,
    144                 # loader = NeRFDataset(opt, device=device, type='test', H=128, W=128, size=100).dataloader()
--> 145                 trainer.save_mesh()
    146 
    147     else:

3 frames
[/content/stable-dreamfusion/meshutils.py](https://localhost:8080/#) in clean_mesh(verts, faces, v_pct, min_f, min_d, repair, remesh)
     88 
     89     if v_pct > 0:
---> 90         ms.meshing_merge_close_vertices(threshold=pml.Percentage(v_pct)) # 1/10000 of bounding box diagonal
     91 
     92     ms.meshing_remove_duplicate_faces() # faces defined by the same verts

AttributeError: module 'pymeshlab' has no attribute 'Percentage'

Steps to Reproduce

.

Expected Behavior

.

Environment

.

bc129697 commented 2 weeks ago

@erikestany How did you solve this problem?