Jetson Nano 4GB
Deepstream 5.1
Jetpack 4.5.1
I am running object detection using deepstream sdk python-scripts I pass on the meta data. Specifically the rect.params data with class ID to an Arduino connected via UART USB. Since UART is slow the program can’t run sequentially because this will create a bottle neck as my program waits on the slow communication of UART. This now causes a drop in frames while the object is detected, using SPI (faster than UART communication protocol) reduces the drop in frames but the drop is still considerable, So I plan on using multi-threading/multiprocessing to run the code concurrently/parallelly.
The problem is the two functions
..
..
..
while l_obj is not None:
try:
# Casting l_obj.data to pyds.NvDsObjectMeta
#obj_meta=pyds.glist_get_nvds_object_meta(l_obj.data)
obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
except StopIteration:
break
obj_meta.rect_params.border_color.set(0.0, 0.0, 1.0, 0.0)
rect_params = obj_meta.rect_params
list_set = {int(rect_params.top),int(rect_params.left),int(rect_params.height)
,int(rect_params.width),int(obj_meta.class_id)}
list_ = list(list_set)
***object_cords(list_)***
..
..
and my custom function
link = txfer.SerialTransfer('/dev/ttyACM0')
link.open()
time.sleep(2) # allow some time for the Arduino to completely reset
send_size = 0
list_size = link.tx_obj(list_)
print(list_)
print(type(list_))
send_size += list_size
So the Solution I am hoping to find is to run this smoothly either via multi-(threading/Processing)
For clarification:
The def osd_sink_pad_buffer_probe(pad,info,u_data): runs faster than object_cords() function so I need an exception case to handle errors when the osd_buffer functions gives inputs which the serial transfer can’t pass because of the UART speed limitations.