Comments (7)
Here's my script:
"""
convert_meshes.py
Process the .obj files and make them waterproof and simplified.
"""
import os
import subprocess
from tqdm import tqdm
from multiprocessing import Pool, cpu_count
GRASPDIR = "/path/to/acronym/data/grasps/"
OBJDIR = "/path/to/acronym/data/shapenetsem/models-OBJ/"
MANIFOLD_PATH = "/path/to/Manifold/build/manifold"
SIMPLIFY_PATH = "/path/to/Manifold/build/simplify"
## Grab the object file names from the grasp directory
hashes = []
for fname in os.listdir(GRASPDIR):
tokens = fname.split("_")
assert(len(tokens) == 3)
hashes.append(tokens[1])
## Define function to process a single file
def process_hash(h):
"""Process a single object file by calling a subshell with the mesh processing script.
Args:
h (string): the hash denoting the file type
"""
obj = OBJDIR + 'models/' + h + ".obj"
if not os.path.isfile(obj):
return
# Waterproof the object
temp_name = f"temp.{h}.watertight.obj"
completed = subprocess.run(["timeout", "-sKILL", "30", MANIFOLD_PATH, obj, temp_name], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if completed.returncode != 0:
print(f"Skipping object (manifold failed): {h}")
return
# Simplify the object
outfile = OBJDIR + "simplified/" + h + ".obj"
completed = subprocess.run([SIMPLIFY_PATH, "-i", temp_name, "-o", outfile, "-m", "-r", "0.02"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if completed.returncode != 0:
print(f"Skipping object (simplify failed): {h}")
## Issue the commands in a multiprocessing pool
with Pool(cpu_count()-2) as p:
examples = list(
tqdm(
p.imap_unordered(process_hash, hashes),
total=len(hashes)
)
)
from acronym.
Only processing the 7897 models mentioned in the acronym dataset (the IDs in the filenames) instead of all 24980 in the original ShapeNetSem seems to have worked.
from acronym.
Only processing the 7897 models mentioned in the acronym dataset (the IDs in the filenames) instead of all 24980 in the original ShapeNetSem seems to have worked.
Do you solve the stuck problem?
from acronym.
What exactly is the problem that you are referring to?
from acronym.
What exactly is the problem that you are referring to?
I use this script but only obtaining about 1000 meshes because this script can get stuck in the middle of the mesh generation. How can I solve it?
from acronym.
You could increase the timeout duration. It's currently set to 10 seconds.
from acronym.
You could increase the timeout duration. It's currently set to 10 seconds.
I have extended it even to 1000... But I only got 6880 objects although it indeed increases. Could you upload the generated obj file to google drive to solve this problem once for all?
from acronym.
Related Issues (16)
- Errors when executing examples HOT 1
- acronym_generate_scene.py HOT 3
- ValueError: string is not a file: data/examples/meshes/1Shelves/1e3df0ab57e8ca8587f357007f9e75d1.obj HOT 2
- Not able to access shapenet.org HOT 1
- How to generate grasps for own objects? HOT 1
- Questions regarding the certain fields in the .h5 files HOT 1
- Simulation Implementation HOT 1
- Gripper width?
- Negative volume?
- Parsing of ShapeNetSem meshes HOT 6
- Valid grasps not displayed in scene generation HOT 3
- where to download the mesh files of the 8827 objects? HOT 1
- A typo in the README.md
- I would like to ask about the "grasps/h5" h5 format file, what tools can be quickly generated? HOT 3
- Can't decode str in python3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acronym.