Hi,
I am trying to generate the synthetic data to coco format by using the following script in the script editor.
It works fine with basicwriter and kittiwriter, but the annotations that cocowriter generates are all shown as others
with id 201
.
The script is modified from the tutorial script and the attachment is the output annotation json.
Does any one know how to figure it out?
Refer to the replicator api.
Thank you in advanced.
import omni.replicator.core as rep
import os
with rep.new_layer():
camera = rep.create.camera(position=(0, -10, 1),rotation=(0,0,-90))
render_product = rep.create.render_product(camera, (1024, 1024))
torus = rep.create.torus(semantics=[('class', 'torus')] , position=(0, -2 , 1))
sphere = rep.create.sphere(semantics=[('class', 'sphere')], position=(0, 1, 1))
cube = rep.create.cube(semantics=[('class', 'cube')], position=(1, -2 , 1) )
with rep.trigger.on_frame(max_execs=20, rt_subframes=2):
with rep.create.group([torus, sphere, cube]):
rep.modify.pose(
position=rep.distribution.uniform((-1, -1, -1), (2, 2, 2)),
scale=rep.distribution.uniform(0.1, 2))
# Initialize and attach writer
writer = rep.WriterRegistry.get("CocoWriter")
print("***********************************************")
output_directory = os.getcwd() + "/omni.replicator_out/coco_output"
print("Final output base directory:", output_directory)
coco_categories = {
torus: {
'name': 'torus',
'id': 0,
'supercategory': 'geometry'
},
sphere: {
'name': 'sphere',
'id': 1,
'supercategory': 'geometry'
},
cube: {
'name': 'cube',
'id': 2,
'supercategory': 'geometry'
}
}
print(f'coco_categories: {coco_categories}')
writer.initialize(
output_dir=output_directory,
rgb=True,
bounding_box_2d_tight=True,
semantic_types=["class"],
coco_categories=coco_categories
)
writer.attach([render_product])
# rep.orchestrator.preview()
rep.orchestrator.run()
coco_annotations_arejdbfc.txt (18.8 KB)