Real-Time People Tracking and Counting on Jetson Nano

Code on GitHub: GitHub - JardinRyu/Jetson_Nano_People_Counting: MobileNetV1-SSD + SORT based Real-Time Tracking and Counting on Jetson Nano

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!


im having troubles on downloading some stuff from the code. it states i need to download pycuda.

2 Likes contains pycuda installation.

I am having problem running the script, I am getting this error:

~/Jetson_Nano_People_Counting$ python3
[ 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/”, line 916, in _bootstrap_inner
File “”, line 196, in run
self.trt_ssd = TrtSSD(self.model, INPUT_HW)
File “/home/microstategies/Jetson_Nano_People_Counting/utils/”, line 86, in init
self.engine = self._load_engine()
File “/home/microstategies/Jetson_Nano_People_Counting/utils/”, 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/”, 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.

Aborted (core dumped)

I think you didn’t create a trt model by referring to the install requirements

1 Like

thanks for the reply, but I can not see any installation requirement document. where is it?


1 Like

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?

1 Like

I run and I still get the same error

Same thing, I have done the installation twice, following every step and it does not work

ผมใช้วิธีนี้ แล้วมันสามารถแก้ปัญหาได้ Install PyCUDA on Jetson Nano - Dropout Analytics - Medium

It works for me! Thank you, JardinRyu.

By running the program, I got an error stating “ModuleNotFoundError: No module named 'pycuda”
but I got through this referring to

sudo pip3 install --global-option=build_ext --global-option="-I/usr/local/cuda/include" --global-option="-L/usr/local/cuda/lib64" pycuda