Hi, I’m trying to create a semantic segmentation dataset of an arena made of tiles.
I generate an arena like this:
def generate_arena():
stage = stage_utils.get_current_stage()
#groundPlane = stage.GetPrimAtPath("/World/GroundPlane")
#if not groundPlane.IsValid():
#plane = GroundPlane(prim_path="/World/GroundPlane", size=100, color=np.array([0.5, 0.5, 0.5]), z_position=0)
# delete the arena if it exists
arena_prim = stage.GetPrimAtPath("/World/Arena")
if arena_prim.IsValid():
print("Deleting existing arena")
stage.RemovePrim("/World/Arena")
usd_files = [
#"file:/home/priba/Documents/AI/Robots/Tiles/EndPBR.usd",
#"file:/home/priba/Documents/AI/Robots/Tiles/StartPBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/TCrossingPBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/TCrossingOneSidePBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/TCrossingNoMarkerPBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/Turn1PBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/Turn2PBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/XCrossingPBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/XCrossingOneSidePBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/XCrossingOneMarkerPBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/XCrossingNoMarkerPBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/ZigZag1PBR.usd",
"file:/home/priba/Documents/AI/Robots/Tiles/ZigZag2PBR.usd",
]
asset_prims = []
local_scale = 0.1
gridsize = 9
for i, (x, y) in enumerate(np.ndindex(gridsize, gridsize)):
pos_x = (x - gridsize//2) * 30
pos_z = (y - gridsize//2) * 30
pos_y = 1
angle = random.choice([0, 90, 180, 270])
prim_path = f"/World/Arena/Asset_{i}"
usd_path = random.choice(usd_files)
print(f"Adding asset at {prim_path} with USD path {usd_path} on {pos_x}, {pos_y}, {pos_z}")
quaternion = get_quaternion_from_euler(0, np.deg2rad(angle), np.pi/2)
stage_utils.add_reference_to_stage(usd_path, prim_path)
XFormPrim(prim_path).set_world_pose([pos_x, pos_y, pos_z], quaternion)
XFormPrim(prim_path).set_local_scale([local_scale, local_scale, local_scale])
# get child of prim path LinePBR material. Take its shader and randomize the diffuse color
xform_prim = stage.GetPrimAtPath(prim_path)
child = xform_prim.GetChildren()[0] # Assuming the first child is the one we want
mat_prim = stage.GetPrimAtPath(child.GetPath().AppendPath("LinePBR"))
print(prim_path + "/LinePBR")
print(mat_prim)
col = random.uniform(0.05, 0.4)
rand_color = Gf.Vec3f(col, col, col)
omni.usd.create_material_input(mat_prim, "diffuse_color_constant", rand_color, Sdf.ValueTypeNames.Color3f)
asset_prims.append(prim_path)
print("arena generated!")
The usd files have the semantic ids set before hand and when i check the semantic view everything seems to be labeled correctly.
I then add a bunch of random objects, lights, textures etc. and randomize their positions on the arena. They often clip through the tiles but don’t seem to cause issues.
I then noticed that in my generated dataset some of the tiles get completely omitted. The object is there in the rgb scene view and the neighbor objects appear in the segmented view but that object doesn’t. I managed to track down which one it is to move it around and still nothing, even though other copies of that tile show up fine.
I then copied that exact object and moved it over and that copy gets segmented properly.
This is strange behavior and seems like a bug. Am I doing something wrong? What could cause this?
I’m on Isaac Sim 4.2.0

