MESH2IR icon indicating copy to clipboard operation
MESH2IR copied to clipboard

Issue with using MESH2IR

Open lucpdi opened this issue 10 months ago • 1 comments

Hi @anton-jeran,

For my research I am trying to use the MESH2IR software. However, I am running into some troubles.

General information

I am running python3.9 (python3.6 did not work) on Windows 11. I have a laptop with an AMD Ryzen 7 5800H CPU and an NVIDIA RTX 3050 Laptop GPU.

I can install all dependencies using pip without errors.

mesh_simplification.py error (maybe solved)

At step python mesh_simplification.py I got the following error:

$ python mesh_simplification.py
input mesh has 92439 vertex and 152182 faces
Traceback (most recent call last):
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\MESH2IR\evaluate\mesh_simplification.py", line 32, in <module>
    ms.apply_filter('simplification_quadric_edge_collapse_decimation', targetfacenum=TARGET_Faces, preservenormal=True)
pymeshlab.pmeshlab.PyMeshLabException: Failed to apply filter: simplification_quadric_edge_collapse_decimation
Filter does not exists. Take a look at MeshSet.print_filter_list function.

Which I solved by changing

ms.apply_filter('simplification_quadric_edge_collapse_decimation', targetfacenum=TARGET_Faces, preservenormal=True)

in the mesh_simplification.py file to

ms.apply_filter('meshing_decimation_quadric_edge_collapse', targetfacenum=TARGET_Faces, preservenormal=True)

Which worked. They seem to have changed the name of the filters. Could you confirm that this is the correct filter to use?

evaluate.py error (not solved)

When running the evaluate.py script, I am getting the following error:

$ python evaluate.py
Traceback (most recent call last):
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\lib\site-packages\wavefile\libsndfile.py", line 44, in <module>
    _lib = ct.CDLL(dllPath)
  File "C:\Users\20214799\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 364, in __init__
    if '/' in name or '\\' in name:
TypeError: argument of type 'NoneType' is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\lib\site-packages\wavefile\libsndfile.py", line 50, in <module>
    _lib = ct.CDLL(os.path.join(dllPath, dllName))
  File "C:\Users\20214799\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\lib\site-packages\wavefile\libsndfile-1' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\MESH2IR\evaluate\evaluate.py", line 24, in <module>
    from wavefile import WaveWriter, Format
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\lib\site-packages\wavefile\__init__.py", line 1, in <module>
    from .wavefile import *
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\lib\site-packages\wavefile\wavefile.py", line 31, in <module>
    from .libsndfile import (
  File "C:\Users\20214799\Documents\python_venv_2\20250219_mesh2ir\lib\site-packages\wavefile\libsndfile.py", line 52, in <module>
    raise Exception("could not import libsndfile dll, make sure the dll '%s' is in the path"%(dllName))
Exception: could not import libsndfile dll, make sure the dll 'libsndfile-1' is in the path

It seems to have to do with the wavefile package, but I am not sure how to solve this. Do you have a suggestion?

Best,

lucpdi

lucpdi avatar Feb 19 '25 20:02 lucpdi

This project is 3 years old. So can you try previous versions of the python libraries?

anton-jeran avatar Feb 20 '25 14:02 anton-jeran

Hello @anton-jeran ,

Above issue was fixed by pasting the libsndfile-1.dll into the folder ./lib/site-packages/wavefile.

I now get the following error:

$ python evaluate.py
C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\torch_geometric\typing.py:68: UserWarning: An issue occurred while importing 'pyg-lib'. Disabling its usage. Stacktrace: Could not find module 'C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\Lib\site-packages\libpyg.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
  warnings.warn(f"An issue occurred while importing 'pyg-lib'. "
C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\torch_geometric\typing.py:86: UserWarning: An issue occurred while importing 'torch-scatter'. Disabling its usage. Stacktrace: [WinError 127] Kan opgegeven procedure niet vinden
  warnings.warn(f"An issue occurred while importing 'torch-scatter'. "
C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\torch_geometric\typing.py:97: UserWarning: An issue occurred while importing 'torch-cluster'. Disabling its usage. Stacktrace: [WinError 127] Kan opgegeven procedure niet vinden
  warnings.warn(f"An issue occurred while importing 'torch-cluster'. "
C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\torch_geometric\typing.py:113: UserWarning: An issue occurred while importing 'torch-spline-conv'. Disabling its usage. Stacktrace: [WinError 127] Kan opgegeven procedure niet vinden
  warnings.warn(
C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\torch_geometric\typing.py:124: UserWarning: An issue occurred while importing 'torch-sparse'. Disabling its usage. Stacktrace: [WinError 127] Kan opgegeven procedure niet vinden
  warnings.warn(f"An issue occurred while importing 'torch-sparse'. "
C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\cupyx\jit\_interface.py:173: FutureWarning: cupyx.jit.rawkernel is experimental. The interface can change in the future.
  cupy._util.experimental('cupyx.jit.rawkernel')
STAGE1_G(
  (cond_net): COND_NET(
    (fc): Linear(in_features=14, out_features=10, bias=True)
    (relu): PReLU(num_parameters=1)
  )
  (fc): Sequential(
    (0): Linear(in_features=10, out_features=32768, bias=False)
    (1): BatchNorm1d(32768, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): PReLU(num_parameters=1)
  )
  (upsample1): Sequential(
    (0): ConvTranspose1d(2048, 1024, kernel_size=(41,), stride=(4,), padding=(19,), output_padding=(1,))
    (1): BatchNorm1d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): PReLU(num_parameters=1)
  )
  (upsample2): Sequential(
    (0): ConvTranspose1d(1024, 512, kernel_size=(41,), stride=(4,), padding=(19,), output_padding=(1,))
    (1): BatchNorm1d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): PReLU(num_parameters=1)
  )
  (upsample3): Sequential(
    (0): ConvTranspose1d(512, 256, kernel_size=(41,), stride=(4,), padding=(19,), output_padding=(1,))
    (1): BatchNorm1d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): PReLU(num_parameters=1)
  )
  (upsample4): Sequential(
    (0): ConvTranspose1d(256, 128, kernel_size=(41,), stride=(2,), padding=(20,), output_padding=(1,))
    (1): BatchNorm1d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): PReLU(num_parameters=1)
  )
  (upsample5): Sequential(
    (0): ConvTranspose1d(128, 128, kernel_size=(41,), stride=(2,), padding=(20,), output_padding=(1,))
    (1): BatchNorm1d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): PReLU(num_parameters=1)
  )
  (RIR): Sequential(
    (0): ConvTranspose1d(128, 1, kernel_size=(41,), stride=(1,), padding=(20,))
    (1): Tanh()
  )
)
Load from:  Models/MESH2IR/netG_epoch_175.pth
Traceback (most recent call last):
  File "C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\MESH2IR\evaluate\evaluate.py", line 192, in <module>
    evaluate()
  File "C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\MESH2IR\evaluate\evaluate.py", line 116, in evaluate
    netG, mesh_net = load_network_stageI(netG_path,mesh_net_path)
  File "C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\MESH2IR\evaluate\evaluate.py", line 76, in load_network_stageI
    mesh_net.load_state_dict(state_dict)
  File "C:\Users\20214799\Documents\python_venv_2\20250225_MESH2IR\lib\site-packages\torch\nn\modules\module.py", line 2581, in load_state_dict
    raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for MESH_NET:
        Missing key(s) in state_dict: "pool1.select.weight", "pool2.select.weight", "pool3.select.weight".
        Unexpected key(s) in state_dict: "pool1.weight", "pool2.weight", "pool3.weight".

I have the correct pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv torch-geometric and CuPy for my CUDA version 12.1.

Do you have an idea how this error could be fixed? Maybe I need an older version of a particular Python library, but I do not know which in that case.

lucpdi avatar Mar 18 '25 08:03 lucpdi

try Python3.6 and old pytorch version?

anton-jeran avatar Mar 18 '25 17:03 anton-jeran