I have referenced the article below.
Continuing the discussion from How to Display confidence with label in deepstream ? like (person 0.81)
I want show the confidence to sreen. Guide me.
I have referenced the article below.
Continuing the discussion from How to Display confidence with label in deepstream ? like (person 0.81)
I want show the confidence to sreen. Guide me.
The object confidence is stored in parameter obj_meta->confidence
, you can set it in obj_meta->text_params.display_text
and it can be displayed on the bounding box.
You may refer to the relevant topic here: Show detection confidente along with the class label
I used Python. Do you have any other suggestions for me?
Still using deepstream_test_1.py as example, add last line as below can display confidence. You can customize obj_meta.text_params.display_text
to any string if you want.
l_obj=frame_meta.obj_meta_list
while l_obj is not None:
try:
# Casting l_obj.data to pyds.NvDsObjectMeta
obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
except StopIteration:
break
obj_counter[obj_meta.class_id] += 1
obj_meta.rect_params.border_color.set(0.0, 0.0, 1.0, 0.8) #0.8 is alpha (opacity)
print("object id={}, confidence={}\n".format(obj_meta.class_id, obj_meta.confidence))
obj_meta.text_params.display_text = "%4f"%obj_meta.confidence
I’m grateful for your help!
I have one more problem that I can’t solve, class_id is 0,1,2,… How to convert obj.class_id to class_name when screen?
id and name are bound one by one, You can refer to the code below
define an array for class name and reference it via class_id:
class_names = [ 'vehicle', 'bicycle','person', 'roadsign']
...
obj_meta.text_params.display_text = "%s:%4f"%(class_names[obj_meta.class_id], obj_meta.confidence)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.