data generation scripts to make hugging face compatible dataset

This commit is contained in:
venkatacrc 2025-05-18 23:54:12 +00:00
parent 3fde5cbda8
commit 67a49f27b9
4 changed files with 251 additions and 0 deletions

View file

@ -0,0 +1,30 @@
import os
import shutil
# Path to your rendered_images directory
base_dir = "rendered_images"
# Path to your rendered_images directory
stl_dir = "selected_stls"
ds_stl_path = "dataset/stls/"
ds_img_path = "dataset/images/"
# List and loop through all subdirectories
for name in os.listdir(base_dir):
path = os.path.join(base_dir, name)
if os.path.isdir(path):
# print(f"Found directory: {name}")
stl_file_fpath = os.path.join(stl_dir, name)
stl_file_fpath += ".stl"
#print(stl_file_path)
ds_stl_fpath = os.path.join(ds_stl_path, name)
ds_stl_fpath += ".stl"
shutil.copy(stl_file_fpath, ds_stl_path)
base_img_fpath = path + "/render_0.png"
ds_img_fpath = os.path.join(ds_img_path, name)
ds_img_fpath += "_0001.png"
shutil.copy(base_img_fpath, ds_img_fpath)
#print(base_img_fpath, ds_img_fpath)