Hello. We trying to use RTSP stream for detection. Very strange situation, that is impossible to understand. Please explain us if possible. Here is the code, that does not work:
import jetson.inference
import jetson.utils
import sys
net = jetson.inference.detectNet("ssd-mobilenet-v2", sys.argv,threshold=0.5)
camera = jetson.utils.videoSource("rtsp://192.168.137.20:8888",argv=sys.argv)
display = jetson.utils.videoOutput("display://0") # 'my_video.mp4' for file
while True:#display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img, overlay="box,labels,conf")
display.Render(img)
display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))
and here is the code that works:
import jetson.inference
import jetson.utils
import sys
display = jetson.utils.videoOutput("display://0") # 'my_video.mp4' for file
net = jetson.inference.detectNet("ssd-mobilenet-v2", sys.argv,threshold=0.5)
camera = jetson.utils.videoSource("rtsp://192.168.137.20:8888",argv=sys.argv)
while True:#display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img, overlay="box,labels,conf")
display.Render(img)
display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))
The last message I get before interrupting the code is:
nvbuf_utils: NvReleaseFd Failed... Exiting...
nvbuf_utils: dmabuf_fd 1259 mapped entry NOT found
nvbuf_utils: NvReleaseFd Failed... Exiting...
nvbuf_utils: dmabuf_fd 1261 mapped entry NOT found
nvbuf_utils: NvReleaseFd Failed... Exiting...
nvbuf_utils: dmabuf_fd 1263 mapped entry NOT found
nvbuf_utils: NvReleaseFd Failed... Exiting...
nvbuf_utils: dmabuf_fd 1265 mapped entry NOT found
nvbuf_utils: NvReleaseFd Failed... Exiting...
nvbuf_utils: dmabuf_fd 1267 mapped entry NOT found
nvbuf_utils: NvReleaseFd Failed... Exiting...
nvbuf_utils: dmabuf_fd 1269 mapped entry NOT found
nvbuf_utils: NvReleaseFd Failed... Exiting...
^CTraceback (most recent call last):
File "hello_test.py", line 14, in <module>
detections = net.Detect(img, overlay="box,labels,conf")
KeyboardInterrupt
As far as I understand, it doesnt run beyond this line.
The difference is that in working code, the declaration order is different, and camera with rtsp definition comes last. But why the order of declaration is so important, I dont understand.