jetson_inference.detectNet('ssd-mobilenet-v2') too slow

Hi,
I used a humble node publishing video stream , and trying to use another humble node to receive the video on AGX Orin. the performance of detectNet is too slow. it only can output detect result in 5 seconds per frame.
Can someone give me some suggestions about how to import the speed? Thank you in advance!
And the code in Python.

[TRT]
[TRT] device GPU, /usr/local/bin/networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff initialized.
[TRT] W = 7 H = 100 C = 1
[TRT] detectNet – maximum bounding boxes: 100
[TRT] loaded 91 class labels
[TRT] detectNet – number of object classes: 91
[TRT] loaded 0 class colors
[TRT] didn’t load expected number of class colors (0 of 91)
[TRT] filling in remaining 91 class colors with default colors
detected 1 objects in image
<detectNet.Detection object>
– Confidence: 0.679688
– ClassID: 1
– Left: 222.188
– Top: 2.63672
– Right: 612.188
– Bottom: 357.363
– Width: 390
– Height: 354.727
– Area: 138343
– Center: (417.188, 180)
jetson.inference – detectNet loading custom model ‘(null)’

detectNet – loading detection network model from:
– model networks/SSD-Mobilenet-v2/ssd_mobilenet_v2_coco.uff
– input_blob ‘Input’
– output_blob ‘NMS’
– output_count ‘NMS_1’
– class_labels networks/SSD-Mobilenet-v2/ssd_coco_labels.txt
– threshold 0.500000
– batch_size 1

[TRT] TensorRT version 8.6.2

Hi,

Most of the elapsed time is used for initialization and pipeline setup.
This is a one-time job when creating the inference.

You can try to feed a video or camera source to check the real latency.

Thanks.

Hi!
Thank you for your quick reply!
But I kept running the code for more than 20 minutes. The initialization should be done at beginning. The elapsed time between different detections is too long: 3~5 minutes.

Do you have any suggestions for such case that have to use ROS image for objects detection?

Hi,

Could you share the command you execute?
Do you use a camera/video input or image?

Thanks.

The main code are:
net = jetson_inference.detectNet(‘ssd-mobilenet-v2’)
self.create_subscription(Image, “/camera/image_color”, self.has_received_image2,qos_profile=1)

a loop:

img = self.bridge.imgmsg_to_cv2(ros_image, desired_encoding=‘passthrough’)
frame_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img_cuda = jetson_utils.cudaFromNumpy(frame_rgb)
detections = net.Detect(img_cuda, overlay=“box,labels,conf”)

Hi,

The loop includes data reader, conversion, memcpy, and finally inference.
Please try to update the loop with only inference for the benchmarking.

For example:

img = self.bridge.imgmsg_to_cv2(ros_image, desired_encoding=‘passthrough’)
frame_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img_cuda = jetson_utils.cudaFromNumpy(frame_rgb)

# a loop:
detections = net.Detect(img_cuda, overlay=“box,labels,conf”)

Thanks.

Thank you for your reply!
in my previous loop, i put net = jetson_inference.detectNet(‘ssd-mobilenet-v2’) in the loop. It’s OK now just took net = jetson_inference.detectNet(‘ssd-mobilenet-v2’) out of the loop.

we can close this case now. and thank you again!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.