MCPcopy Create free account
hub / github.com/TCXX/ObjaversePlusPlus / render_batch

Function render_batch

annotation_model/persistent_batch_render_auto.py:56–94  ·  view source on GitHub ↗

Runs Blender to render a batch of objects.

(object_files, target_path, output_dir, core_id)

Source from the content-addressed store, hash-verified

54 subprocess.run(command)
55
56def render_batch(object_files, target_path, output_dir, core_id):
57 """Runs Blender to render a batch of objects."""
58 #core_id = get_core_id()
59 #set_affinity(core_id)
60 command = [
61 "taskset",
62 "-c",
63 str(core_id),
64 "/mnt/2077AI/3d_model_labeller/Multiview_3D_model_classifier/labeller_model/blender-4.2.1-linux-x64/blender",
65 "-b",
66 "-P",
67 "persistent_blender_script.py",
68 "--",
69 "--object_path",
70 target_path,
71 "--output_dir",
72 output_dir,
73 "--engine",
74 "CYCLES",
75 "--scale",
76 "0.8",
77 "--num_images",
78 "40",
79 "--camera_dist",
80 "1.2",
81 ]
82
83 env = os.environ.copy()
84 env['OBJECT_BATCH'] = ','.join(object_files)
85
86 log_dir = os.getcwd() + "/correct_logs/" + object_files[0][:-4]
87 log_file_path = log_dir + "_log.log"
88 error_file_path = log_dir + "_error.log"
89
90 with open(log_file_path, 'a') as log_file, open(error_file_path, 'a') as error_file:
91 # Run the command and suppress the output (stdout and stderr) to the log file
92 subprocess.run(command, env=env, stdout=log_file, stderr=error_file)
93
94 #subprocess.run(command, env=env)
95
96def split_batches(object_files, num_batches):
97 """Split the list of object files into smaller batches."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected