Open Boris7Britva opened 1 year ago
Hi @Boris7Britva, can you try rebuilding with -DENABLE_NVMM=off
cmake option?
cd jetson-inference/build
cmake -DENABLE_NVMM=off ../
make
sudo make install
oh okay, after inspecting the logs again, that may not have been necessary.
Are you able to run video-viewer.py or detectnet.py okay? I may need to update my-detection.py for something
video-viewer.py? If you mean "video-viewer csi://0" command - it works, for example I can run WebRTC stream.
detectnet.py - I get exactly 1 frame displayed and then it's stuck:
@dusty-nv is there anything else I can try?
@Boris7Britva I'm not sure why your camera freezes only when running detectnet, sorry about that. To further debug it, are you able to process a video file with detectnet okay? https://github.com/dusty-nv/jetson-inference/blob/master/docs/detectnet-console-2.md#processing-video-files
Also, have you tried running the jetson-inference docker container to see if you get different results? https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-docker.md
@dusty-nv Video file processing failed exactly after one detection, like in the case with the camera. There is something wrong with jetson.utils
I was able to successfully run Docker with: ./imagenet images/jellyfish.jpg images/test/jellyfish.jpg ./detectnet images/peds_0.jpg images/test/peds_0.jpg
examples from your link. But detectnet.py failed again:
@Boris7Britva thanks, unfortunately I'm unable to reproduce this - can you try commenting out these two lines from detectnet.py:
then make sure you run the detectnet.py that has your changed modifications (or rename it to something else)
@dusty-nv, please see the log:
@Boris7Britva everything looks normal in that log except the video seems to stop early. I wonder if the video is corrupted?
Can you try running this example? https://github.com/dusty-nv/jetson-inference/blob/master/docs/imagenet-console-2.md#processing-a-video
Hi @dusty-nv
I don't think video is corrupted, I can play it with embedded video player, as well as this new video.
Here is the result:
@Boris7Britva I still see a lot of errors in your logs about nvbuf utils - are you sure that you re-build/re-installed with -DENABLE_NVMM=off
?
cd jetson-inference/build
cmake -DENABLE_NVMM=off ../
make
sudo make install
(this should be done outside of container and you shouldn't use container)
@dusty-nv Sorry, I reinstalled the image yesterday and didn't apply that option.
Attached log after disabling NVMM
OK, I believe the issue now is that you are trying to save the video to a directory that doesn't exist in your current path:
~/Downloads/AI/jetson-inference/python/examples$ ./imagenet.py --network=resnet-18 jellyfish.mkv images/test/jellyfish_resnet18.mkv
(there is no images/test
directory under jetson-inference/python/examples
to save to)
Instead, just save jellyfish_resnet18.mkv
to the current directory - try just running it as:
~/Downloads/AI/jetson-inference/python/examples$ ./imagenet.py --network=resnet-18 jellyfish.mkv jellyfish_resnet18.mkv
Ok. This one worked.
I've bought a new Rpi cam v2.1 to make sure it's not camera issue.
Can you please explain what's wrong for this simple script?
Hi@Boris7Britva @dusty-nv . I am a beginner that met the same problem on jetson.inference.detectNet(). I was running these lines,and the csi camera was running just fine: import jetson.utils input = jetson.utils.videoSource("csi://0") output = jetson.utils.videoOutput("display://0")
while output.IsStreaming(): img = input.Capture() output.Render(img)
But after I put detectNet in to the lines, it showed the same problem that @Boris7Britva got:
import jetson.utils input = jetson.utils.videoSource("csi://0") output = jetson.utils.videoOutput("display://0") import jetson.inference net = jetson.inference.detectNet("ssd-mobilenet-v2",threshold=0.5)
while output.IsStreaming(): img = input.Capture() detections = net.Detect(img) output.Render(img) output.SetStatus("Performance:{:.0}FPS".format(net.GetNetworkFPS()))
Exception: jetson.utils -- function wasn't passed a valid cudaImage or cudaMemory object
log.txt I have already tried re-build/re-installed with -DENABLE_NVMM=off and it still showed the same exception. I am using Jetson Nano 2Gb+ JetPack 4.6.3 with L4T 32.7.3 and IMX219 CSI camera.
Can you help me to fix this please? Thank you so much.
I tried to use another TF card to reinstall the image and run the script again. Still had the same exception, but the log looked differently. log.txt
[gstreamer] gstCamera::Capture() -- a timeout occurred waiting for the next image buffer
@mmhzlrj ok, I think what happened is that videoSource.Capture() was changed in commit https://github.com/dusty-nv/jetson-inference/commit/e339741ec489c43a5153bbd984e944402265854e to return None
in the event of a capture timeout. You can view the updated source to detectnet.py here:
# capture the next image
img = input.Capture()
if img is None: # timeout
continue
Please add that if img is None:
check to your code. If the camera is always timing out, check that it works with nvgstcapture-1.0
tool - and if that doesn't work, there is an issue with your camera or it's connection.
Thank you @dusty-nv . Firstly, I checked detectnet.py and these lines were already there:
while True:
# capture the next image
img = input.Capture()
if img is None: # timeout
continue
# detect objects in the image (with overlay)
detections = net.Detect(img, overlay=args.overlay)
# print the detections
print("detected {:d} objects in image".format(len(detections)))
for detection in detections:
print(detection)
# render the image
output.Render(img)
# update the title bar
output.SetStatus("{:s} | Network {:.0f} FPS".format(args.network, net.GetNetworkFPS()))
# print out performance info
net.PrintProfilerTimes()
# exit on input/output EOS
if not input.IsStreaming() or not output.IsStreaming():
break
Anything else that I am missing ?
Secondly, I ran nvgstcapture-1.0
on terminal. The first time I ran, the video stream or window didn't show up. And then I turned off Jetson nano and check the connection of my CSI camera and ran nvgstcapture-1.0
again. Then I saw the video is streaming. But when I ran my Script:
import jetson.utils
input = jetson.utils.videoSource("csi://0")
output = jetson.utils.videoOutput("display://0")
import jetson.inference
net = jetson.inference.detectNet("ssd-mobilenet-v2",threshold=0.5)
while output.IsStreaming():
img = input.Capture()
detections = net.Detect(img)
output.Render(img)
It still shows
gstCamera::Capture() -- a timeout occurred waiting for the next image buffer
and
File "1.py", line 10, in <module> detections = net.Detect(img) Exception: jetson.utils -- function wasn't passed a valid cudaImage or cudaMemory object
log.txt
Thanks for your help@dusty-nv
If I try usb camerainput = jetson.utils.videoSource("/dev/video1")
instead of csi camera input = jetson.utils.videoSource("csi://0")
, the script ran well. I wonder which part went wrong.
It still shows
gstCamera::Capture() -- a timeout occurred waiting for the next image buffer
andFile "1.py", line 10, in <module> detections = net.Detect(img) Exception: jetson.utils -- function wasn't passed a valid cudaImage or cudaMemory object
@mmhzlrj modify your script to be like this:
while output.IsStreaming():
img = input.Capture()
if img is None:
continue
detections = net.Detect(img)
output.Render(img)
gstCamera::Capture() -- a timeout occurred waiting for the next image buffer and
File "1.py", line 10, in <module> detections = net.Detect(img) Exception: jetson.utils -- function wasn't passed a valid cudaImage or cudaMemory object
Problem solved. Thank you so much @dusty-nv
Hi.
Jetson Nano 2Gb+JetPack 4.6.1 (clean installation)+CSI RPi cam v2
also tried
Jetson Nano 2Gb+JetPack 4.5 (clean installation)+CSI RPi cam v2
Camera streaming is fine on both.
There is an issue with detection networks from the examples folder, for example my_detection.py with SSD-Mobilenet-v2.
log.txt
Commenting out the detection part and adding print(img.format) gives "rgb8". In addition there are a lot of "[gstreamer] gstCamera::Capture() -- a timeout occurred waiting for the next image buffer" during this test run.