• Hardware Platform (Jetson / GPU) GTX2080 Ti
• DeepStream Version 6
• TensorRT Version 8.0.1.6+cuda11.3.1.005
• NVIDIA GPU Driver Version (valid for GPU only) 470.103.01
• Issue Type( questions, new requirements, bugs) question
Hi, I’m using Python API, deepstream-ssd-parser. I want to add tracking functions on the custom nvinferserver output by using nvtracker plugin.
There are some more details about my problem:
- The pipeline is
.. -> nvinferserver(pgie) -> nvtracker(tracker) -> nvvideoconvert -> nvosd(osd) -> ...
- I copied the nvtracker configs from the deepstream_test_2 sample (aka.
config_tracker_NvDCF_perf.yml
). - In pgie’s pgie_src_pad_buffer_probe function: I have got my custom model outputs correctly.
-
In pgie’s add_obj_meta_to_frame function:
- I have filled
object_id
,unique_component_id
,class_id
,confidence
anddetector_bbox_info
ofobj_meta
correctly. - I keep the position values of
obj_meta.rect_params
the same withobj_meta.detector_bbox_info
- I also leave the
obj_meta.tracker_bbox_info
andobj_meta.tracker_confidence
empty.
- I have filled
- I have hooked the sink probe of osd and the src probe of the tracker, but observed that no matter what values of NvDsObjectMeta have been passed by upstream pgie in
add_obj_meta_to_frame
, the tracker always outputs meaninglesstracker_confidence
andtracker_bbox_infos
(aka. 0.0, [0,0,0,0]). WHY? - Is there any standard description for nvtrack plugin input/output metadata protocols for reference?
My modified add_obj_meta_to_frame
is below. The pgie’s downstream nvtracker does not work at all.
def add_obj_meta_to_frame(frame_object, batch_meta, frame_meta, label_names):
""" Inserts an object into the metadata """
# this is a good place to insert objects into the metadata.
# Here's an example of inserting a single object.
obj_meta = pyds.nvds_acquire_obj_meta_from_pool(batch_meta)
# gie.unique_id = 1
obj_meta.unique_component_id = 1 # this value has been confirmed with nvinferserver's config
# Set object info including class, detection confidence, etc.
obj_meta.class_id = frame_object.classId # always = 0, because my model only supports one class (for face detection).
obj_meta.confidence = frame_object.detectionConfidence
# There is no tracking ID upon detection. The tracker will
# assign an ID.
obj_meta.object_id = UNTRACKED_OBJECT_ID # I guess the value should be correct.
# Set the object classification label.
obj_meta.obj_label = 'Face' # there is only one class (face) that the custom model supported.
# ADDED by me
detector_bbox_info = obj_meta.detector_bbox_info
detector_bbox_info.org_bbox_coords.left = float(IMAGE_WIDTH * frame_object.left)
detector_bbox_info.org_bbox_coords.top = float(IMAGE_HEIGHT * frame_object.top)
detector_bbox_info.org_bbox_coords.width = float(IMAGE_WIDTH * frame_object.width)
detector_bbox_info.org_bbox_coords.height = float(IMAGE_HEIGHT * frame_object.height)
# Set bbox properties. These are in input resolution.
rect_params = obj_meta.rect_params
rect_params.left = float(IMAGE_WIDTH * frame_object.left)
rect_params.top = float(IMAGE_HEIGHT * frame_object.top)
rect_params.width = float(IMAGE_WIDTH * frame_object.width)
rect_params.height = float(IMAGE_HEIGHT * frame_object.height)
# Red border of width 3
rect_params.border_width = 3
rect_params.border_color.set(1, 0, 0, 1)
# Semi-transparent yellow backgroud
rect_params.has_bg_color = 1
rect_params.bg_color.set(1, 1, 0, 0.4)
# Set display text for the object.
txt_params = obj_meta.text_params
if txt_params.display_text:
pyds.free_buffer(txt_params.display_text)
txt_params.x_offset = int(rect_params.left)
txt_params.y_offset = max(0, int(rect_params.top) - 10)
txt_params.display_text = (
"Face " + "{:04.3f} {}".format(frame_object.detectionConfidence, obj_meta.object_id)
)
# # Font , font-color and font-size
txt_params.font_params.font_name = "Serif"
txt_params.font_params.font_size = 10
# set(red, green, blue, alpha); set to White
txt_params.font_params.font_color.set(1.0, 1.0, 1.0, 1.0)
# # Text background color
txt_params.set_bg_clr = 1
# set(red, green, blue, alpha); set to Black
txt_params.text_bg_clr.set(0.0, 0.0, 0.0, 1.0)
# Inser the object into current frame meta
# This object has no parent
pyds.nvds_add_obj_meta_to_frame(frame_meta, obj_meta, None)
Any suggestion or reference sample would be much appreciated!