Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) • DeepStream Version • JetPack Version (valid for Jetson only) • TensorRT Version • NVIDIA GPU Driver Version (valid for GPU only)
Jetson Xavuer nx
deepstream 5.0
tensorrt7.0
jetpack4.4
hello experts, my code is here
while l_frame is not None:
try:
# Note that l_frame.data needs a cast to pyds.NvDsFrameMeta
# The casting is done by pyds.NvDsFrameMeta.cast()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone.
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
break #frame_number = frame_meta.frame_num #num_rects = frame_meta.num_obj_meta
l_obj=frame_meta.obj_meta_list
#lines = []
display_meta = pyds.nvds_acquire_display_meta_from_pool(batch_meta)
obj_index = 0
line_index = 0
while l_obj is not None:
#index = 0
try:
# Casting l_obj.data to pyds.NvDsObjectMeta
obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
#for i in cocopair:
# if i[0] == obj_index:
# temp = l_obj
line = display_meta.line_params
# for a in range(i[1]-i[0]):
# if not temp:
# temp=temp.next
line[line_index].x1 = 0
line[line_index].y1 = 0
line[line_index].x2 = line_index
line[line_index].y2 = line_index
line[line_index].line_width = 6
line[line_index].line_color.set(1.0, 0.0, 0.0,0.5)
line_index += 1
obj_index += 1
print("obj inedx",obj_index)
except StopIteration:
break
#obj_counter[obj_meta.class_id] += 1
try:
l_obj=l_obj.next
except StopIteration:
break
pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta)
try:
l_frame=l_frame.next
except StopIteration:
break
return Gst.PadProbeReturn.OK
i want to draw skeleton based on the keypoints, but there is no line, and when there are more than 17 obj, an index error occured
Traceback (most recent call last):
File “test.py”, line 88, in osd_sink_pad_buffer_probe
line[line_index].x1 = 0
IndexError: list index out of range
can u tell me how to draw lines with python, and circles,now i use small rectange to replace circle, how to draw circles with object detector?
while l_frame is not None:
try:
# Note that l_frame.data needs a cast to pyds.NvDsFrameMeta
# The casting is done by pyds.NvDsFrameMeta.cast()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone.
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
break
#frame_number = frame_meta.frame_num
#num_rects = frame_meta.num_obj_meta
l_obj=frame_meta.obj_meta_list
#lines = []
display_meta = pyds.nvds_acquire_display_meta_from_pool(batch_meta)
display_meta.num_lines = 17
line_params = display_meta.line_params
#obj_index = 0
line_index = 0
while l_obj is not None:
obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
for i in range(17):
if cocopair[i][0]==obj_meta.class_id:
temp = l_obj
while temp is not None:
temp_meta = pyds.NvDsObjectMeta.cast(temp.data)
temp=temp.next
if temp_meta.class_id == cocopair[i][1]:
line_params[line_index].x1 = int(obj_meta.rect_params.left)
line_params[line_index].y1 = int(obj_meta.rect_params.top)
line_params[line_index].x2 = int(temp_meta.rect_params.left)
line_params[line_index].y2 = int(temp_meta.rect_params.top)
line_params[line_index].line_color.set(i, 0, 0, 0.5)
line_params[line_index].line_width = 4
line_index+=1
l_obj=l_obj.next
try:
l_frame=l_frame.next
except StopIteration:
break
yes, i can draw the line now.
but now i want to evaluate the fps with camera. can u tell me how to evaluate the fps of inference with python.
i tried to evaluate fps in osd function like this
while l_frame is not None:
if frame_meta.bInferDone:
time = (cv.getTickCount() - t) / cv.getTickFrequency()
fps = 1.0 / time
print(“this frame is inferenced, fps: {}”.format(fps))
else:
print("this frame not inferenced ")
pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta)
try:
l_frame=l_frame.next
except StopIteration:
break
if l_frame is not None:
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
if frame_meta.bInferDone:
t = cv.getTickCount()
but its not correct. the result is likethis frame is inferenced, fps: 0.00015717842572132173
fine i find the solution but i dont know if its correct, i evalute the fps in the customer post-processing function. like this
static long tim = 0;
bool NvDsInferParseCustomResnet (std::vector const &outputLayersInfo,
NvDsInferNetworkInfo const &networkInfo,
NvDsInferParseDetectionParams const &detectionParams,
std::vector &objectList)
{
//std::cout<<“in customer defined function”<<std::endl;
/* Find the output layer */
static int outputLayerIndex = -1;
//static int outputLayer_L1Index = -1;
//static int outputLayer_L2Index = -1;
long cur_time = cv::getTickCount();
double fps = 1.0 /((cur_time - tim) / cv::getTickFrequency());
tim = cur_time;
std::cout<<"fps: "<<fps<<std::endl;
...