Output names convention

Hi everyone.

I have just general wonderment regarding working with multiple outputs using get_output_vstream_infos() method of HEF class. The issue is that instead of returning the actual output names(like output_layer1, output_layer2 etc.) it returns the names of the last layer before output(like <model_name>/conv31). It’s really frustrating as it forces to, basically, hardcode output processing.

So, my question is:

  1. Is there a way to get output name instead of layer before output?
  2. Is there a way to change general translated names like output_1 to something meaningful - like cls_head, for example?

Thanks for the assistance in advance.

Hey @Bohdan_Veremii,

Welcome to the Hailo Community!

Getting the actual output names

So yeah, when you use get_output_vstream_infos(), it tends to give you the internal layer names instead of the nice friendly names you might be expecting (like output_layer1). That’s just how it works - the vstream names come from the last computational layer in your model graph.

The good news is there are a few ways to map between these internal names and what you actually want:

get_sorted_output_names(network_group_name=None) - This gives you the user-facing output names in the order the SDK expects them:

hef.get_sorted_output_names(network_group_name)

get_vstream_name_from_original_name(original_name, network_group_name=None) - If you know your original output name, you can find the corresponding vstream name:

hef.get_vstream_name_from_original_name("output_layer1", network_group_name)

get_original_names_from_vstream_name(vstream_name, network_group_name=None) - This does the reverse - maps from vstream name back to original names:

hef.get_original_names_from_vstream_name("vstream_name", network_group_name)

Making output names more meaningful

For your second question about changing names to something like cls_head - unfortunately you can’t do this after the HEF is already created. Those names get baked in during the model export/conversion stage (when you’re going from TensorFlow, ONNX, etc. to HEF).

If you want better names, you’ll need to:

  • Rename the output layers in your original model before converting
  • Make sure those names stick through the whole export/conversion process

Once the HEF exists, HailoRT doesn’t have any way to rename things - you can only use those mapping methods I mentioned above to work with what you’ve got.

Hope this helps!

1 Like

Thanks a lot, that helps!

1 Like