Getting annotation about objects down the hierarchy

Hi all,

My task is to generate annotated-data (bounding-box_2d and 3d for an object - a tool with trackers).

I use the replicator, and in the script, to get the prims I use : drill = rep.get.prim_at_path(‘tool’). That way when the tool rotates all it’s childs rotate with him and I get good images, but I get the bounding-boxes ONLY for the WHOLE tool. If I use “rep.get.prims” instead - all the child-objects transform seperately with different random-values, but I get bounding-box data for all the childs also.

Does anyone know how I can make them rotate with the same random transformation AND get bounding-box data also for all the child-objects?

I attached an image with all the scene hierarchy and the full script in the script-editor.

Thanks

 Rami

Hi Rami,

It looks like you can simply execute multiple different get/modify semantics operations for each piece that you want.

Example:

# specific example
bur = rep.get.prims('bur')
with bur:
    rep.modify.semantics([('class', 'bur')])


# More inclusive example:
drill_parts = rep.get.prims('/Root/drill_with_trackers/tool.*')
with drill_parts:
    rep.modify.semantics([('class', 'drill')])

drill = rep.get.prims('/Root/drill_with_trackers/tool') # only getting the top-level tool Xform
with drill:
     rep.modify.pose(....)

HI Dennis, Tha worked! (with a small change, using “prim_at_path” for “drill”. thanks !!
I don’t understand though what’s done there, also after reading the api 1.6.4 documentation. Is there a more detailed document about the replicator that you can refer me to?

Thanks again, Rami

This is mostly a function of how USD itself works.

Objects in a hierarchy are moved with their parents are moved, but can also move independently.

When passing multiple prims or a group of prims to modify.pose, we interpret that as meaning you want each individual object to have its pose randomized, since to move all the children together, you can just move the top-most prim.

As for semantics. we also have children “inherit” from their parents so that each piece does not need to be labeled individually, but we also combine them into a single label/bounding box.

Example: For an automobile, it is much easier to label the top-most prim xform for the object once, instead of having to label each and every sub-component of the vehicle. And we want a combined bounding box of all those sub-components to represent the vehicle.

We still allow children to be labeled separately from their parents, and they can even have the same label to have their own bounding box, but with identical labels.

I hope this explanation helps.