This repository provides a real-time people tracking and counting system.
It detects people based on SSD-Mobilenetv1-coco and uses SORT to track and count.
Hope you like the project and feel free to contribute to it!
I am having problem running the script, I am getting this error:
~/Jetson_Nano_People_Counting$ python3 usbcam_tracking.py
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
TrtThread: loading the TRT SSD engine…
frame number 0
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python3.6/threading.py”, line 916, in _bootstrap_inner
self.run()
File “usbcam_tracking.py”, line 196, in run
self.trt_ssd = TrtSSD(self.model, INPUT_HW)
File “/home/microstategies/Jetson_Nano_People_Counting/utils/ssd.py”, line 86, in init
self.engine = self._load_engine()
File “/home/microstategies/Jetson_Nano_People_Counting/utils/ssd.py”, line 56, in _load_engine
with open(TRTbin, ‘rb’) as f, trt.Runtime(self.trt_logger) as runtime:
FileNotFoundError: [Errno 2] No such file or directory: ‘ssd/TRT_ssd_mobilenet_v1_coco.bin’
Exception ignored in: <bound method TrtSSD.del of <utils.ssd.TrtSSD object at 0x7f7eb287f0>>
Traceback (most recent call last):
File “/home/microstategies/Jetson_Nano_People_Counting/utils/ssd.py”, line 100, in del
del self.cuda_outputs
AttributeError: cuda_outputs
PyCUDA ERROR: The context stack was not empty upon module cleanup.
A context was still active when the context stack was being
cleaned up. At this point in our execution, CUDA may already
have been deinitialized, so there is no way we can finish
cleanly. The program will be aborted now.
Use Context.pop() to avoid this problem.
I did all the steps with military precision, on multiple attempts on freshly installed jetpack 4.51 and jetpack 4.5 with no success running the usb cam python script. It is simply not working, I wonder if anyone here had any success with it? Can you do it in a docker container?
I got this running people, there are several steps need to b taken into consideration:
first make sure the sd image for the jetson nano is actually Jetpack 4.5.0 (not 4.6)
Absolutely don’t do the “sudo apt-get upgrade”. Upgrading the libraries and dependencies will bring them to the latest state (jetpack 4.6) and that’s somehow is an issue.
Before starting the installation,check if CUDA is included in the PATH by typing:
“nvcc --version” if you didn’t get any infos it means it’s not in PATH. In this case add CUDA to your path manually. I know the installation includes that in the install basics.sh , but it somehow doesn’t work. You can do that with:
export PATH=$PATH:/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
After the first install.sh, you can directly go to /ssd directory and run pycuda script installation by yourself with :
./install_pycuda.sh (this step is also included in the second install.sh script but it doesn’t work for some reason).
now you can go ahead and run the second install.sh in the ssd directory.
You can go on with the building engines after that with the ./build_engines.sh
PS: I did everything using Jetson nano B01 (4g) and with a clean installed image with jetpack 4.5.0
Hi. It works for me on an Jetson Xavier NX devkit with JetPack 4.5. However, the perfomance is so bad (image delay and low fps). How could I improve the perfomance?
I tried again on a Jetson Nano with a MIPI CSI camera and the framerate is good. However, the app crashes after 2 hours running. On the Jetson Xavier NX with USB cam i don’t suffer crashes, but still the low framerate. I’m interested on solve the crashes because I find better performance with CSI camera. Any suggestion? Solution could be a different configuration of pipeline?
Thanks.
I think the app crashes due to heat problems. You can solve that by adding a fan to the Jetson. Otherwise I can’t think of any other reason at the moment.
I am getting PyCUDA ERROR: The context stack was not empty upon module cleanup. When I try to run this with corn. When I run it in the terminal it works fine. Any idea why this can be the case?