I’m generating datasets of bottles for in order to train a program, however they keep overlapping each other and that can mess up the training. Is there a way to measure the amount of overlap and if it’s over say 50%, the bottle’s position is randomized again or hidden entirely?
Here’s the code I have:
import omni.replicator.core as rep
with rep.new_layer():
camera = rep.create.camera(position=(0, 250, 1300), focal_length = 18.14756)
render_product = rep.create.render_product(camera, (1920, 1200))
def dome_lights():
lights = rep.create.light(
light_type="Dome",
rotation= (270,0,0),
texture=rep.distribution.choice([
'/home/ubuntu/Documents/AIM/EXR/belfast_sunset_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/belfast_sunset_puresky_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/castel_st_angelo_roof_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/fouriesburg_mountain_cloudy_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/garden_nook_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/golf_course_sunrise_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/neon_photostudio_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/outdoor_workshop_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/pretville_cinema_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/pretville_street_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/rainforest_trail_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/sandsloot_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/snowy_field_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/studio_small_09_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/wide_street_01_4k.hdr',
'/home/ubuntu/Documents/AIM/EXR/workshop_4k.hdr'
])
)
return lights.node
rep.randomizer.register(dome_lights)
def distant_light():
sun = rep.create.light(
light_type = "Distant",
position = rep.distribution.uniform((-1500, -2000, -2000), (1500, 2000, 2000)),
intensity = rep.distribution.uniform(4000, 10000),
look_at = (0, 0, 0)
)
return sun.node
rep.randomizer.register(distant_light)
def move_shapes():
shapes = rep.get.prims(semantics=[
('class', 'BlueMonster'), ('class', 'C4'), ('class', 'GreenMonster'), ('class', 'WhiteMonster'),
('class', 'PurpleMonster'), ('class', 'OrangeMonster'), ('class', 'PinkMonster')])
with shapes:
rep.modify.pose(
position=rep.distribution.uniform((-700, -150, -4000), (700, 400, 0)),
rotation=rep.distribution.uniform((0, 0, 0), (360, 360, 360))
)
return shapes.node
rep.randomizer.register(move_shapes)
with rep.trigger.on_frame(num_frames=3):
rep.randomizer.move_shapes()
rep.randomizer.dome_lights()
rep.randomizer.distant_light()
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
output_dir="occlusion",
rgb=True,
bounding_box_2d_loose=True,
instance_segmentation=True,
bounding_box_3d=True,
occlusion=True
)
writer.attach([render_product])