JardinRyu / Jetson_Nano_People_Counting

MobileNetV1-SSD + SORT based Real-Time Tracking and Counting on Jetson Nano
111 stars 32 forks source link

Jetson nano -- Getting error #8

Closed Mony24 closed 2 years ago

Mony24 commented 2 years ago

Getting following error while running progarm on Jetson Nano B01 (Linux -------nvidia 4.9.253-tegra #1 SMP PREEMPT Mon Jul 26 12:13:06 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux). Please help how to solve the error.

sudo python3 mipicam_tracking.py Traceback (most recent call last): File "mipicam_tracking.py", line 8, in from filterpy.kalman import KalmanFilter File "/usr/local/lib/python3.6/dist-packages/filterpy/kalman/init.py", line 22, in from .EKF import File "/usr/local/lib/python3.6/dist-packages/filterpy/kalman/EKF.py", line 28, in from filterpy.stats import logpdf File "/usr/local/lib/python3.6/dist-packages/filterpy/stats/init.py", line 22, in from .stats import File "/usr/local/lib/python3.6/dist-packages/filterpy/stats/stats.py", line 32, in from scipy.stats import norm, multivariate_normal File "/usr/lib/python3/dist-packages/scipy/stats/init.py", line 348, in from .stats import * File "/usr/lib/python3/dist-packages/scipy/stats/stats.py", line 177, in from . import distributions File "/usr/lib/python3/dist-packages/scipy/stats/distributions.py", line 13, in from . import _continuous_distns File "/usr/lib/python3/dist-packages/scipy/stats/_continuous_distns.py", line 15, in from scipy._lib._numpy_compat import broadcast_to File "/usr/lib/python3/dist-packages/scipy/_lib/_numpy_compat.py", line 10, in from numpy.testing.nosetester import import_nose ModuleNotFoundError: No module named 'numpy.testing.nosetester'

Mony24 commented 2 years ago

Waiting for response and solution on reported issue.

JardinRyu commented 2 years ago

I think it can be solved by changing the numpy version. ex) pip3 install numpy==1.18

Mony24 commented 2 years ago

Thanks for the information and acknowledgement. First we have to look for the following error. It is not recognizing code with import * like below.

from filterpy.kalman import KalmanFilter File "/usr/local/lib/python3.6/dist-packages/filterpy/kalman/init.py", line 22, in from .EKF import *

Please inform us how to solve this problem. Have you not observed such errors in Jetson nano?

Mony24 commented 2 years ago

Thanks for information. first we have to look for following error. It is not recognizing code with import like below. from filterpy.kalman import KalmanFilter File "/usr/local/lib/python3.6/dist-packages/filterpy/kalman/init.py", line 22, in from .EKF import

JardinRyu commented 2 years ago

Can you check the error log after changing numpy version?

Mony24 commented 2 years ago

The numpy version is 1.18.5 only.

JardinRyu commented 2 years ago

Are you still getting this error? ModuleNotFoundError: No module named 'numpy.testing.nosetester'

Mony24 commented 2 years ago

First we have to look for the following error. It is not recognizing code with import * like below.

from filterpy.kalman import KalmanFilter File "/usr/local/lib/python3.6/dist-packages/filterpy/kalman/init.py", line 22, in from .EKF import * All errors are the same as before.

JardinRyu commented 2 years ago

Nope. This error occurs because of the numpy version. Reinstall numpy as follow: pip3 install numpy==1.16.1

Mony24 commented 2 years ago

After installing numpy==1.16.1, rebooting, following error observed.

---:~/Jetson_Nano_People_Counting-main$ sudo python3 mipicam_tracking.py GST_ARGUS: Creating output stream CONSUMER: Waiting until producer is connected... GST_ARGUS: Available Sensor modes : GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings: Camera index = 0 Camera mode = 5 Output Stream W = 1280 H = 720 seconds to Run = 0 Frame Rate = 120.000005 GST_ARGUS: Setup Complete, Starting captures for 0 seconds GST_ARGUS: Starting repeat capture requests. CONSUMER: Producer has connected; continuing. [ 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 "mipicam_tracking.py", line 196, in run self.trt_ssd = TrtSSD(self.model, INPUT_HW) File "/---/---/Jetson_Nano_People_Counting-main/utils/ssd.py", line 86, in init self.engine = self._load_engine() File "/---/---/Jetson_Nano_People_Counting-main/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 0x7f6d7cdcf8>> Traceback (most recent call last): File "/---/---/Jetson_Nano_People_Counting-main/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.

Aborted

JardinRyu commented 2 years ago

You need to create the TRT_ssd_mobilenet_v1_coco.bin file with the following command:

cd ssd/
./install.sh
./build_engines.sh

I think you didn't install the requirement. See README.md.

Mony24 commented 2 years ago

Installed earlier. Following error observed in build_engines.sh

./install.sh Patch 'graphsurgeon.py' in TensorRT patching file /usr/lib/python3.6/dist-packages/graphsurgeon/node_manipulation.py Reversed (or previously applied) patch detected! Skipping patch. 1 out of 1 hunk ignored Making symbolic link of libflattenconcat.so ** Installation done ---:~/Jetson_Nano_People_Counting-main/ssd$ ./build_engines.sh

Using output node NMS Converting to UFF graph Warning: No conversion function registered for layer: NMS_TRT yet. Converting NMS as custom op: NMS_TRT WARNING:tensorflow:From /usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py:226: The name tf.AttrValue is deprecated. Please use tf.compat.v1.AttrValue instead.

Warning: No conversion function registered for layer: FlattenConcat_TRT yet. Converting concat_box_conf as custom op: FlattenConcat_TRT Warning: No conversion function registered for layer: GridAnchor_TRT yet. Converting MultipleGridAnchorGenerator as custom op: GridAnchor_TRT Warning: No conversion function registered for layer: FlattenConcat_TRT yet. Converting concat_box_loc as custom op: FlattenConcat_TRT DEBUG [/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py:143] Marking ['NMS'] as outputs No. nodes: 350 UFF Output written to /home/rrs/Jetson_Nano_People_Counting-main/ssd/ssd_mobilenet_v1_coco.uff UFF Text Output written to /home/rrs/Jetson_Nano_People_Counting-main/ssd/ssd_mobilenet_v1_coco.pbtxt [TensorRT] INFO: [MemUsageChange] Init CUDA: CPU +203, GPU +0, now: CPU 413, GPU 2432 (MiB) Traceback (most recent call last): File "build_engine.py", line 304, in main() File "build_engine.py", line 289, in main builder.max_workspace_size = 1 << 28 AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'max_workspace_size'

On Thu, Mar 17, 2022 at 8:37 AM JeongWon Ryu @.***> wrote:

You need to create the TRT_ssd_mobilenet_v1_coco.bin file with the following command:

cd ssd/ ./install.sh ./build_engines.sh

I think you didn't install the requirement. See README.md.

— Reply to this email directly, view it on GitHub https://github.com/JardinRyu/Jetson_Nano_People_Counting/issues/8#issuecomment-1070076669, or unsubscribe https://github.com/notifications/unsubscribe-auth/APOH2JCS4OGBISY3ENM4LADVAKOYPANCNFSM5PD4CQNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

JardinRyu commented 2 years ago

As you can see if you refer to this issue https://github.com/NVIDIA-AI-IOT/torch2trt/issues/557, it is a TensorRT version difference issue included in JetPack version.

Mony24 commented 2 years ago

Thanks. As in original post mention, code is for Jetson Nano B01. Assume that it will work. as if code is for Jetson Nano B01, then this also may be included.

Similar available code was use from other source and tried to use. Same error observed. Tried with different TensorRT but still problem is same. Please suggest how to resolve for Jetson Nano B01.

Mony24 commented 2 years ago

Waiting for response and solution on reported issue.

Mony24 commented 2 years ago

I have visited your pull commnet link and corrected code. (link--- https://github.com/edisanch/Jetson_Nano_People_Counting/pull/1/commits/5fee53a7ccc9f9b87baa8ee68e67c8eb1775b5ff ) Getting following error message with /build_engine.py

config.max_workspace_size = 1 << 28^ TabError: inconsistent use of tabs and spaces in indentation

All code corrected as posted by "Weihao Yuan". Similar error observation as above.

On Thu, Mar 17, 2022 at 10:35 AM JeongWon Ryu @.***> wrote:

As you can see if you refer to this issue NVIDIA-AI-IOT/torch2trt#557 https://github.com/NVIDIA-AI-IOT/torch2trt/issues/557, it is a TensorRT version difference issue included in JetPack version.

— Reply to this email directly, view it on GitHub https://github.com/JardinRyu/Jetson_Nano_People_Counting/issues/8#issuecomment-1070330090, or unsubscribe https://github.com/notifications/unsubscribe-auth/APOH2JDHITZPZAAIOYTPDL3VAK4RRANCNFSM5PD4CQNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

alaansheikhani commented 2 years ago

I got this running with these steps:

  1. first make sure the sd image for the jetson nano is actually Jetpack 4.5.0 (not 4.6)
  2. 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.
  3. 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
  4. 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).
  5. now you can go ahead and run the second install.sh in the ssd directory.
  6. 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

Mony24 commented 2 years ago

Thanks. After implementing all as mentioned. Following message is observed. Program either stuck or ended with the card off.

@.:~$ cd /home/abc/Jetson_Nano_People_Counting-main @.:~/Jetson_Nano_People_Counting-main$ sudo python3 mipicam_tracking.py [sudo] password for abc: GST_ARGUS: Creating output stream CONSUMER: Waiting until producer is connected... GST_ARGUS: Available Sensor modes : GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings: Camera index = 0 Camera mode = 5 Output Stream W = 1280 H = 720 seconds to Run = 0 Frame Rate = 120.000005 GST_ARGUS: Setup Complete, Starting captures for 0 seconds GST_ARGUS: Starting repeat capture requests. CONSUMER: Producer has connected; continuing. [ 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 ERROR: timeout waiting for img from child TrtThread: start running...

----- stuck or error observed ------

Jetpack version verified as below.

@.***:~/Jetson_Nano_People_Counting-main$ sudo apt-cache show nvidia-jetpack Package: nvidia-jetpack Version: 4.5.1-b17 Architecture: arm64 Maintainer: NVIDIA Corporation Installed-Size: 194 Depends: nvidia-cuda (= 4.5.1-b17).....

alaansheikhani commented 2 years ago

I think the jetson nano is trying to find your cameras but something wrong is happening. Are you sure your pi camera is correctly connected? here is an advice: install this utility ($ sudo apt install v4l-utils) then list all the cameras connected to ur jetson with: $ v4l2-ctl --list-devices this will give you an overview to which are active or connected and their location.

Mony24 commented 2 years ago

Using IMX219-B0179 camera. Working fine with CSI-camera-master program.

Finally program working.

change made at "conf_th=0.5" change to 0.3/0.4/0.6 trt_thread = TrtThread(condition, cam, model, conf_th=0.5)

Gstreamer/program does not end/stop even we terminate the program at command line. This happed with other program also. Hope program will be available with Jetpack 4.6 or above.

Thanks for all responses.

Mony24 commented 2 years ago

Please suggest commands/program modification which display the real time counting and write video in files.

Mony24 commented 2 years ago

Please suggest commands/program modification which display the real time counting and write video in files.