File size: 1,256 Bytes
24be7b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | import os
import json
import shutil
def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
prompts = [
"A_cartoon_house_with_red_roof",
"A_castle_made_of_cardboard",
"A_heart_made_of_wood",
]
methods = ["Unique3D", "MeshFormer", "Meshy", "InstantMesh"]
export_root = "export_data"
mkdir(export_root)
for method in methods:
mkdir(os.path.join(export_root, method))
for i in range(len(prompts)):
mkdir(os.path.join(export_root, method, str(i)))
model_src = os.path.join("outputs", method, f"{prompts[i]}.glb")
model_dst = os.path.join(export_root, method, str(i), "model.glb")
shutil.copy(model_src, model_dst)
prompts = [prompt.replace("_", " ").strip() for prompt in prompts]
json.dump(prompts, open(os.path.join(export_root, "prompt.json"), "w"), indent=4)
"""
|--- data/
|--- prompt.json
|--- method_name_0/
| |--- 0/ # prompt[0]
| | |--- model.glb
| |--- 1/ # prompt[1]
| |--- model.glb
|
|--- method_name_1/
| |--- 0/ # prompt[0]
| | |--- model.glb
| |--- 1/ # prompt[1]
| |--- model.glb
"""
|