TripoSR icon indicating copy to clipboard operation
TripoSR copied to clipboard

use scikit instead of torchmcubes

Open flowtyone opened this issue 11 months ago • 6 comments

Increase usability by using scikit-image instead of the old torchmcubes. This makes the project much easier to install and test.

flowtyone avatar Mar 06 '24 09:03 flowtyone

Increase usability by using scikit-image instead of the old torchmcubes. This makes the project much easier to install and test.

Just out of interest are there any obvious quality benefits over using scikit-image or is this mostly just an installing and testing solution? Speed benefits, wider range of GPU support etc? It would be interesting to actually see a full comparison between the two.

mrbid avatar Mar 07 '24 02:03 mrbid

@mrbid speed wasn't impacted in my tests. The issue with torchmcubes is that it lacks prebuilt wheels and has a dependency issue with torch that makes it harder to install

flowtyone avatar Mar 07 '24 05:03 flowtyone

@flowtyone how did you actually solved the problem? If you share a step by step would help a lot. I am struggling a lot to make it work

math-sasso avatar Mar 28 '24 14:03 math-sasso

@math-sasso this PR works, just use my fork branch, it has these changes

flowtyone avatar Mar 28 '24 14:03 flowtyone

https://github.com/flowtyone/TripoSR/commit/341657e34f98f314cdfdcfbabe689d0d52dde7a5

It's quite a minimal and elegant patch. No need to even fork it tbh. This should be merged as an optional function in TripoSR, allowing the user to select which is used - ofc that wont solve the dependency issue, and I don't know if there is a similar ifdef system in Python as there is in C.

mrbid avatar Mar 28 '24 17:03 mrbid

I have an error with your fork:

Traceback (most recent call last):
  File "/home/r/Desktop/TripoSR-use-scikit/run.py", line 32, in <module>
    mesh = model.extract_mesh(scene_codes, resolution=256)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/r/Desktop/TripoSR-use-scikit/tsr/system.py", line 172, in extract_mesh
    self.set_marching_cubes_resolution(resolution)
  File "/home/r/Desktop/TripoSR-use-scikit/tsr/system.py", line 169, in set_marching_cubes_resolution
    self.isosurface_helper = MarchingCubeHelper(resolution)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/r/Desktop/TripoSR-use-scikit/tsr/models/isosurface.py", line 20, in __init__
    self.mc_func: Callable = marching_cubes
                             ^^^^^^^^^^^^^^
NameError: name 'marching_cubes' is not defined

I was going to bench it against the original and this modified version by @thatname here: https://github.com/VAST-AI-Research/TripoSR/issues/22#issuecomment-2010318709

mrbid avatar Apr 04 '24 02:04 mrbid