GithubHelp home page GithubHelp logo

how do you simplfy the ModelNet40 about dmc HOT 1 OPEN

zshyang avatar zshyang commented on August 14, 2024
how do you simplfy the ModelNet40

from dmc.

Comments (1)

vinitveersingh avatar vinitveersingh commented on August 14, 2024

Background

The original ModelNet40 data set contain non-manifold meshes. Therefore, pre-processing them to have a fixed number of faces is non-trivial. Some other works decimate meshes as a quadratic energy minimization problem. However, their decimation strategy had some issues, and I wanted to avoid them

Rough Direction

Firstly, I converted the .off files in ModelNet40 into .obj files using this library. And to ensure all .obj files were triangle meshes, I used the "Turn into a Pure-Triangular mesh" filter in MeshLab. These operations did not change the meshes' topology (except when a mesh was not a triangle mesh) but ensured all further pre-processing went smoothly.

Next, as mentioned in the paper, I used Watertight Manifold. In most cases, Watertight Manifold decimated meshes to have 1024 faces. Sometimes, if the decimation was unsuccessful, I used Watertight Manifold iteratively. However, for a select few meshes, Watertight Manifold does not work. Thus, for those meshes, I utilized Blender to add volume to them before using Watertight Manifold. I have the scripts for these, but as you can imagine, decimation occurs on a per-instance basis. Thus, for reproducibility purposes, you should only use the link I have shared on the GitHub page.

Code:

We will not add the pre-processing code to the official repo. However, I have copied the scripts/code required to pre-process the meshes here. It's in the zip file called ModelNet40_utils.zip.

You'll need to install the following software before you run the scripts.

  1. Linux Ubuntu OS
  2. Python and the libraries imported in the scripts
  3. Antiprism Library (https://www.antiprism.com/programs/off2obj.html) (Please make sure alias is installed in the bashrc)
  4. Watertight Manifold
  5. MeshLab Server (A little different from just MeshLab)
  6. Blender

Please note you will have to change the relative paths in the provided Python scripts based on how you create the folders.

Please find the steps below:

  1. Go to the ModelNet40 website, download the .off files into a folder called ModelNet40-model and run the script clean_off.py.
    You must run clean_off.py because some .off files in the original data set are corrupted and cannot be converted to .obj files using the Antiprism Library directly.

  2. Create a folder called ModelNet40-model-obj. Install the Antiprism Library. Run off2obj.py to convert the .off files in ModelNet40-model to .obj format.

  3. Create a folder called ModelNet40-triangle. Install the Meshlab Server. Run pure_triangle.py. This script converts all mesh to pure triangle formats without changing the shapes of the mesh. This is required since some meshes in the original ModelNet40 are not triangle meshes, and DMC only works on triangle meshes.

  4. Create a folder ModelNet40-waterlight. Install and build Watertight Manifold. Please keep track of the path where it is built. For me the manifold was build and installed at this path ''/media/jakep/Elements/Mesh/Decimation/Manifold/build/manifold". It will be different for you. Change the manifold variable in line 11 to your path. And run waterlight.py

  5. Create a folder ModelNet40-decimate-1024. For me, the simplify run file (of Watertight Manifold) was built and installed at this path "/media/jakep/Elements/Mesh/MeshNet++/Decimate/Manifold/build/simplify". It will be different for you. Change the decimate variable in line 11 to your path. And run decimate.py

The above steps will give you errors for some meshes because they have no volume, and some are just hard to decimate for Watertight Manifold.
I think there are four meshes ( I don't remember which ones) for which you will have to use Blender to add volume. I used a Youtube tutorial for this.
You will have to keep track of other meshes that failed to convert after using Watertight Manifold. You have to write your own python scripts for this and can use the scripts in the sanity_check folder. (For scripts in the sanity_check folder, you need to install the necessary Python libraries.)

The trick to converting the failed meshes is to rerun waterlight.py on the meshes in ModelNet40-waterlight (not ModelNet40-decimate-1024) folder that have been unable to decimate. Sometimes you have to do this multiple times. Then run decimate.py on these failed meshes, and it should work.

If you don't necessarily need 1024 faces and 5096 faces is ok for your datasets, steps 1-5 usually work without failing.

Please let me know if you have any further questions. If these instructions resolve your question, please close this issue.

from dmc.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.