How to add semantic labels to rep.randomizer.instantiate

Hello there,

I was wondering if it would be possible to create a semantic labels with the rep.randomizer.instantiate function. From what I was able to look up this isn’t possible, so to fix this I tried to create a randomizer function that selected a random model from the directory and created it. This did not work, since it only randomly selected the asset in the first interaction, and used the same asset for the rest of the data generation. Would really appreciate some tips.

import omni.replicator.core as rep
import os
import random
  
heatmarks_directory = '/home/rics/Documents/t/heat_A/'
heatmarks_list = rep.utils.get_usd_files(heatmarks_directory, recursive=False)
  
with rep.new_layer():
  
      plane=rep.create.plane(position=(0, 0, -0.42118), scale=50, visible=True)
      camera = rep.create.camera(position=(0, 0, 25), rotation=(0, -90, 0))
      render_product = rep.create.render_product(camera, (1024, 1024))
      rep.settings.set_render_pathtraced(samples_per_pixel=64)
  
      def random_heatmark():
          random_heat_mark= random.choice(heatmarks_list)
          heatmark = rep.create.from_usd(random_heat_mark, semantics=[('class', 'heat_mark')])
  
          with heatmark:
              rep.modify.pose(
                  scale=(100, 100, 100),
          )
          return heatmark.node
      
      rep.randomizer.register(random_heatmark)    
  
      heatmark = None
     
      # Setup randomization
      with rep.trigger.on_frame(num_frames=100, rt_subframes=50):
  
          if heatmark is not None:
              rep.remove([heatmark])
  
          rep.randomizer.random_heatmark()
  
          with camera:
              rep.modify.pose(
                  position=rep.distribution.uniform((-3, -3, 18),(3, 3, 30)),
                  rotation=rep.distribution.uniform((-10, -100, -180),(10, -80, 180))
              )
  
      # Initialize and attach writer
      writer = rep.WriterRegistry.get("BasicWriter")
  
      writer.initialize(output_dir="heat_fault", rgb=True)
  
      writer.attach([render_product])
  
      rep.orchestrator.preview()