Closed mikkelmedm closed 2 years ago
Hey,
this is a typical problem, one way to solve this is to rerun BlenderProc multiple times to avoid lingering memory demands from past allocations. Right now we do not offer a function to remove orphan unused data.
I would recommend to sub sample the amount of cctextures in the first part of the script to maybe 50 at maximum and then rerun this particular script 10 times. You will loose a bit of time for the initial setup, but it will be much faster overall.
I hope this helps.
Best, Max
Hi :) Thanks for your quick response!
With the new version, is there an straightforward way of doing the rerun (similar to the rerun.py script in previous version)?
Yes, you can just use the rerun.py
script. That is the correct way of doing it.
Sorry for asking, I cannot seem to figure it out. So if I would usually run above main.py script with e.g. ´´blenderproc run main.py --scene "beer.blend"´´, would I then have to now run ´´python rerun.py main.py --scene "beer.blend"´´? Thanks
Yes exactly :)
Best, Max
So I usually run blenderproc run main.py --scene "beer.blend"
. Now running python rerun.py main.py --scene "beer.blend"
leaves me with the following error message:
Sorry nevermind, I had to specify the output folder as the last argument, when using rerun.py, forgot about that :)
Describe the bug Not sure if this is a bug, or if I can somehow optimize my code more. Sorry if I have missed something obvious.
Yesterday I started a process of running multiple renders (15 frames * 1000 runs), it started out running fine ("Fra: n Mem: ~2.700M"). However inspecting this morning each render took waay longer and memory was "Fra: n Mem: ~12.000M".
Trying to rerun the process now, I notice also that Memory is increasing slighty for each run.
General Information
Version 2.0.0a7
Ubuntu
Yes.
No, just the created my own main.py file.
To Reproduce Steps to reproduce the behavior:
blenderproc run main.py --scene "beer.blend" --object_name "beer"
parser = argparse.ArgumentParser()
Paths:
parser.add_argument('--bop_parent_path', default="bop_dataset", help="Path to the bop datasets parent directory") parser.add_argument('--cc_textures_path', default="resources/cctextures", help="Path to downloaded cc textures") parser.add_argument('--output_dir', default="trackar_data/output", help="Path to where the final files will be saved ")
Parameters:
parser.add_argument('--bound_box', default=False, help="True for BBox keypoints - False for unique keypoints") parser.add_argument('--stand_vs_lay_prob', default=[0.7, 0.3], help="Propability of standing object vs laying object, respectively")
parser.add_argument('--scene', default="trackar_data/chairs.blend", help="Path to the scene.blend file") parser.add_argument('--object_name', default="Can", help="Name of object in .blend file with keypoints") parser.add_argument('--multi_obj', default=False, help="If the scene contains multiple objects to load one at random")
parser.add_argument('--num_runs', default=774, help="Number of runs") parser.add_argument('--frames_per_run', default=15, help="Number of frames for each run") parser.add_argument('--out_size', default=(256, 512), help="Output width and output height") parser.add_argument('--cam_dist_min', default=0.25, help="Minimum radius of camera sampler shell") parser.add_argument('--cam_dist_max', default=0.8, help="Maximum radius of camera sampler shell") parser.add_argument('--distractor_objs_min', default=2, help="Minimum number of occluding/distractor objects to add to the scene") parser.add_argument('--distractor_objs_max', default=13, help="Maximum number of occluding/distractor objects to add to the scene") args = parser.parse_args()
bproc.init()
Set to True for faster outputs during debbuging
DEBUG = False
If DEBUG==True it loads only a random sample of bop objects, otherwise loads all objects ONCE
at start of script and randomly chooses n-size subset for each run to place in scene.
distractor_bop_objs = bproc.loader.load_bop(bop_dataset_path = os.path.join(args.bop_parent_path, 'hb'), sys_paths = "bop_toolkit", sample_objects=True if DEBUG else False, num_of_objs_to_sample=2 if DEBUG else None, mm2m = True) distractor_bop_objs += bproc.loader.load_bop(bop_dataset_path = os.path.join(args.bop_parent_path, 'ycbv'), sys_paths = "bop_toolkit", sample_objects=True if DEBUG else False, num_of_objs_to_sample=2 if DEBUG else None, mm2m = True)
if DEBUG: bproc.renderer.set_samples(10) distractor_objs_max = 2 distractor_objs_min = 1
else: distractor_objs_max = args.distractor_objs_max distractor_objs_min = args.distractor_objs_min bproc.renderer.set_light_bounces(
diffuse_bounces = 200, glossy_bounces = 200, max_bounces = 200, transmission_bounces = 200, transparent_max_bounces = 200 )
set segmap_class (category_id) and physics properties of distractor objects:
for j, obj in enumerate(distractor_bop_objs): obj.set_cp("category_id", 0)
load the blender object(s) into the scene
load_blend_objs = bproc.loader.load_blend(args.scene)
If we need to scale the object:
scale = 0.15
set segmap_class (category_id) and physics properties
for obj in load_blend_objs: obj.set_cp("category_id", 1)
Load cctextures:
cc_textures = bproc.loader.load_ccmaterials(args.cc_textures_path)
light_point = bproc.types.Light() light_point.set_energy(200)
Iteratively generate a new scene with random camera/light/object placements:
for r in range(args.num_runs):