I used to work with JP-5.0.1 version for my project and everything had been going well. After I flashed my Orin with JP-5.0.2, I started having same errors on same code after even many times of reflashing.
I am not sure the problem is about CUDA, TensorRT or Jetson-Inference.
-Project includes multi-threading image processing and shows the results with double screen
-Switched to TensorRT-8.4 from 8.3 with JP update
-Installed Deep-learning packages with sudo apt install nvidia-jetpack (Not with SDK Manger because it always gives ip error.)
-Installed OpenCV with different installer.
I actually didin’t upgrade to JetPack 5.0.2, I flashed AGX Orin with SDK Manager by using JetPack 5.0.2 So I installed jetson-inference and compiled from begining.
My steps
Flashed AGX Orin with JetPack 5.0.2 (Only Jetson OS part is choosen, has not choosen Jetson Components part which includes Cuda Cuda-X etc…)
In terminal, I typed sudo apt update & sudo apt install nvidia-jetpack (With this, cuda and tensorrt was installed)
Hi @furkankoc22, are you able to run detectnet/detectnet.py from jetson-inference on some test images or camera stream? Or does this error only happen with your application?
I solved it by removing from global and putting it inside both functions as local variable. It works, but it converts my print outputs and other errors to yellow. So I’m not sure it is a real problem or not. (Polyfit error is about numpy but now it is yellow)
It works so fine with;
only one camera thread, and removing this line
##cv2.putText(img, f’FPS: {int(net.GetNetworkFPS())}', (30, 30), cv2.FONT_HERSHEY_DUPLEX, 1, (255, 0, 0), 2)
I think the reason that it does work when you create detectNet object as a global, is because you are using python threads (i.e. multiple processes) and CUDA isn’t cross-process like that.
In your webcam class, can you try moving the FPS stuff outside of the for d in detections loop?
for d in detections:
try:
cv2.putText(img, f'FPS: {int(net.GetNetworkFPS())}', (30, 30),cv2.FONT_HERSHEY_DUPLEX, 1, (255, 0, 0), 2)
except:
pass
i.e. instead of the above, like this:
try:
cv2.putText(img, f'FPS: {int(net.GetNetworkFPS())}', (30, 30),cv2.FONT_HERSHEY_DUPLEX, 1, (255, 0, 0), 2)
except:
pass
for d in detections:
...