ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
48.66k stars 15.92k forks source link

OpenBlas issue and GPU not working on jetson Nano #3603

Closed Ammad53 closed 2 years ago

Ammad53 commented 3 years ago

❔Question

Facing these issues. OpenBlas warning GPU not working Due to this, it is taking 3 sec for singe detection. I have provided snippets of the my virtual env Thanks for helping me out

Additional context

Virtual Env installation that i did apt install python3.8 python3.8-venv python3-venv python3.8 -m venv env source env/bin/activate python3 --version

(env) tttt@tttt-desktop:~/Desktop/detection_framework$ pip list Package Version


absl-py 0.12.0 cachetools 4.2.2 certifi 2021.5.30 chardet 4.0.0 cycler 0.10.0 google-auth 1.31.0 google-auth-oauthlib 0.4.4 grpcio 1.38.0 idna 2.10 kiwisolver 1.3.1 Markdown 3.3.4 matplotlib 3.4.2 numpy 1.20.3 oauthlib 3.1.1 opencv-python 4.5.2.54 pandas 1.2.4 Pillow 8.2.0 pip 21.1.1 protobuf 3.17.3 pyasn1 0.4.8 pyasn1-modules 0.2.8 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2021.1 PyYAML 5.4.1 requests 2.25.1 requests-oauthlib 1.3.0 rsa 4.7.2 scipy 1.6.3 seaborn 0.11.1 setuptools 56.0.0 six 1.16.0 tensorboard 2.5.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 thop 0.0.31.post2005241907 torch 1.8.1 torchvision 0.9.1 tqdm 4.61.1 typing-extensions 3.10.0.0 urllib3 1.26.5 Werkzeug 2.0.1 wheel 0.36.2

Running Cpu

python3 detection_framework/detect.py --weights burn_best.pt --source videos/video6.mov Using torch 1.8.1 CPU

Fusing layers...

OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. Model Summary: 232 layers, 7246518 parameters, 0 gradients, 16.8 GFLOPS

OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. video 1/1 (1/500) /home/tttt/Desktop/detection_framework/videos/video6.mov: 640x640 1 Burns, Done. (2.894s)

(env) tttt@tttt-desktop:~/Desktop/detection_framework$ python3 detection_framework/detect.py --weights burn_best.pt --source videos/video6.mov --device 0 Traceback (most recent call last): File "detection_framework/detect.py", line 215, in detect() File "detection_framework/detect.py", line 40, in detect device = select_device(opt.device) File "/home/tttt/Desktop/detection_framework/detection_framework/utils/torch_utils.py", line 47, in select_device assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device # check availablity AssertionError: CUDA unavailable, invalid device 0 requested

(env) tttt@tttt-desktop:~/Desktop/detection_framework$ nvcc -V bash: nvcc: command not found

Similar issues https://github.com/ultralytics/yolov5/issues/474

https://github.com/ultralytics/yolov5/issues/2863

glenn-jocher commented 3 years ago

@Ammad53 your code is out of date. To update:

Ammad53 commented 3 years ago

@glenn-jocher this is the latest pull. Same issue.

python3 detect.py --weights burn_deep.pt --source video6.mov Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, half=False, hide_conf=False, hide_labels=False, imgsz=640, iou_thres=0.45, line_thickness=3, max_det=1000, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='video6.mov', update=False, view_img=False, weights=['burn_deep.pt']) YOLOv5 πŸš€ v5.0-184-g3133607 torch 1.8.1 CPU

Fusing layers... OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. Model Summary: 232 layers, 7246518 parameters, 0 gradients OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. video 1/1 (1/500) /home/tttt/thesis/yolov5/video6.mov: 640x640 1 Burn, Done. (2.031s) OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. ^Cvideo 1/1 (2/500) /home/tttt/thesis/yolov5/video6.mov: Traceback (most recent call last): File "detect.py", line 204, in detect(vars(opt)) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, *kwargs) File "detect.py", line 91, in detect pred = model(img, augment=augment)[0] File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/home/tttt/thesis/yolov5/models/yolo.py", line 123, in forward return self.forward_once(x, profile) # single-scale inference, train File "/home/tttt/thesis/yolov5/models/yolo.py", line 154, in forward_once x = m(x) # run File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "/home/tttt/thesis/yolov5/models/common.py", line 121, in forward y1 = self.cv3(self.m(self.cv1(x))) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/container.py", line 119, in forward input = module(input) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/home/tttt/thesis/yolov5/models/common.py", line 104, in forward return x + self.cv2(self.cv1(x)) if self.add else self.cv2(self.cv1(x)) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/home/tttt/thesis/yolov5/models/common.py", line 45, in fuseforward return self.act(self.conv(x)) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, **kwargs) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "/home/tttt/Downloads/env/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 395, in _conv_forward return F.conv2d(input, weight, bias, self.stride, KeyboardInterrupt ^C (env) tttt@tttt-desktop:~/thesis/yolov5$ ^C (env) tttt@tttt-desktop:~/thesis/yolov5$

glenn-jocher commented 3 years ago

@Ammad53 it appears you may have environment problems. Please ensure you meet all dependency requirements if you are attempting to run YOLOv5 locally. If in doubt, create a new virtual Python 3.8 environment, clone the latest repo (code changes daily), and pip install -r requirements.txt again. We also highly recommend using one of our verified environments below.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are passing. These tests evaluate proper operation of basic YOLOv5 functionality, including training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu.

Ammad53 commented 3 years ago

Any tutorial, how to run Yolov5 on jetson nano from scratch? I will try again creating a new virtual environment redo the steps. First time i did pip install requirement. Secondly why isnt it running Gpu for detection. Any solution?

Ammad53 commented 3 years ago

lasted pull pip install -r requirements.txt Requirement already satisfied: matplotlib>=3.2.2 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (3.4.2) Requirement already satisfied: numpy>=1.18.5 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 5)) (1.20.3) Requirement already satisfied: opencv-python>=4.1.2 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 6)) (4.5.2.54) Requirement already satisfied: Pillow in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (8.2.0) Requirement already satisfied: PyYAML>=5.3.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 8)) (5.4.1) Requirement already satisfied: scipy>=1.4.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 9)) (1.6.3) Requirement already satisfied: torch>=1.7.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (1.8.1) Requirement already satisfied: torchvision>=0.8.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 11)) (0.9.1) Requirement already satisfied: tqdm>=4.41.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 12)) (4.61.1) Requirement already satisfied: tensorboard>=2.4.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 15)) (2.5.0) Requirement already satisfied: seaborn>=0.11.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 19)) (0.11.1) Requirement already satisfied: pandas in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 20)) (1.2.4) Requirement already satisfied: thop in /home/tttt/Downloads/env/lib/python3.8/site-packages (from -r requirements.txt (line 30)) (0.0.31.post2005241907) Requirement already satisfied: kiwisolver>=1.0.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (1.3.1) Requirement already satisfied: pyparsing>=2.2.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (2.4.7) Requirement already satisfied: python-dateutil>=2.7 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (2.8.1) Requirement already satisfied: cycler>=0.10 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 4)) (0.10.0) Requirement already satisfied: typing-extensions in /home/tttt/Downloads/env/lib/python3.8/site-packages (from torch>=1.7.0->-r requirements.txt (line 10)) (3.10.0.0) Requirement already satisfied: setuptools>=41.0.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (56.0.0) Requirement already satisfied: requests<3,>=2.21.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (2.25.1) Requirement already satisfied: wheel>=0.26 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.36.2) Requirement already satisfied: markdown>=2.6.8 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (3.3.4) Requirement already satisfied: protobuf>=3.6.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (3.17.3) Requirement already satisfied: werkzeug>=0.11.15 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (2.0.1) Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.8.0) Requirement already satisfied: absl-py>=0.4 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.12.0) Requirement already satisfied: google-auth<2,>=1.6.3 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.31.0) Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.4.4) Requirement already satisfied: grpcio>=1.24.3 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.38.0) Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.6.1) Requirement already satisfied: pytz>=2017.3 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from pandas->-r requirements.txt (line 20)) (2021.1) Requirement already satisfied: six in /home/tttt/Downloads/env/lib/python3.8/site-packages (from absl-py>=0.4->tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.16.0) Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.2.8) Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 15)) (4.2.2) Requirement already satisfied: rsa<5,>=3.1.4 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 15)) (4.7.2) Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.3.0) Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 15)) (0.4.8) Requirement already satisfied: chardet<5,>=3.0.2 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.4.1->-r requirements.txt (line 15)) (4.0.0) Requirement already satisfied: idna<3,>=2.5 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.4.1->-r requirements.txt (line 15)) (2.10) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.4.1->-r requirements.txt (line 15)) (1.26.5) Requirement already satisfied: certifi>=2017.4.17 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.4.1->-r requirements.txt (line 15)) (2021.5.30) Requirement already satisfied: oauthlib>=3.0.0 in /home/tttt/Downloads/env/lib/python3.8/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 15)) (3.1.1) WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available. You should consider upgrading via the '/home/tttt/Downloads/env/bin/python3.8 -m pip install --upgrade pip' command.

glenn-jocher commented 3 years ago

@Ammad53 oh, I did not realize you were on jetson nano. It's a popular deployment target but we do not have an official consolidated tutorial for it yet. This is actually one of the reasons we've launched the EXPORT competition, to be able to create official export tutorials to the most popular destinations:

Compete and Win

We are super excited about our first-ever Ultralytics YOLOv5 πŸš€ EXPORT Competition with $10,000 in cash prizes!

Ammad53 commented 3 years ago

@glenn-jocher Same issues again on Jetpack 4.4.1 secondly, how can I enable GPU in it

python jetsonInfo.py
NVIDIA Jetson Nano (Developer Kit Version)
 L4T 32.4.4 [ JetPack 4.4.1 ]
   Ubuntu 18.04.5 LTS
   Kernel Version: 4.9.140-tegra
 CUDA 10.2.89
   CUDA Architecture: 5.3
 OpenCV version: 4.1.1
   OpenCV Cuda: NO
 CUDNN: 8.0.0.180
 TensorRT: 7.1.3.0
 Vision Works: 1.6.0.501
 VPI: 0.4.4
 Vulcan: 1.2.70

jetpack4.txt

Ammad53 commented 3 years ago

Run on docker container too. Gpu not working. Any solution Error UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from But nvcc shpows that Cuda installed. root@f44cb67ac6b7:/yolov5/docker_yolov5/standard# python3 detect.py --source ./data/images/zidane.jpg --conf 0.5 Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.5, device='', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='./data/images/zidane.jpg', update=False, view_img=False, weights='yolov5s.pt') /usr/local/lib/python3.6/dist-packages/torch/cuda/init.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at /media/nvidia/WD_NVME/PyTorch/JetPack_4.4.1/pytorch-v1.7.0/c10/cuda/CUDAFunctions.cpp:100.) return torch._C._cuda_getDeviceCount() > 0 YOLOv5 \U0001f680 v5.0-75-g91547ed torch 1.7.0 CPU

Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt to yolov5s.pt... 100%|######################################| 14.1M/14.1M [00:02<00:00, 7.33MB/s]

Fusing layers... Model Summary: 224 layers, 7266973 parameters, 0 gradients image 1/1 /yolov5/docker_yolov5/standard/data/images/zidane.jpg: 384x640 2 persons, 1 tie, Done. (1.313s) Results saved to runs/detect/exp Done. (1.469s) root@f44cb67ac6b7:/yolov5/docker_yolov5/standard# python3 detect.py --source ./data/images/zidane.jpg --conf 0.5 --device 0 Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.5, device='0', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='./data/images/zidane.jpg', update=False, view_img=False, weights='yolov5s.pt') /usr/local/lib/python3.6/dist-packages/torch/cuda/init.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at /media/nvidia/WD_NVME/PyTorch/JetPack_4.4.1/pytorch-v1.7.0/c10/cuda/CUDAFunctions.cpp:100.) return torch._C._cuda_getDeviceCount() > 0 Traceback (most recent call last): File "detect.py", line 181, in detect(opt=opt) File "detect.py", line 29, in detect device = select_device(opt.device) File "/yolov5/docker_yolov5/standard/utils/torch_utils.py", line 71, in select_device assert torch.cuda.is_available(), f'CUDA unavailable, invalid device {device} requested' # check availability AssertionError: CUDA unavailable, invalid device 0 requested root@f44cb67ac6b7:/yolov5/docker_yolov5/standard# nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2019 NVIDIA Corporation Built on Wed_Oct_23_21:14:42_PDT_2019 Cuda compilation tools, release 10.2, V10.2.89

Ammad53 commented 3 years ago

Latest jetpack 4.5 and Nvcc configured everthing. Cant get gpu to work! j0 j1 j2 j3

hoavt-54 commented 3 years ago

@Ammad53: I managed to get it running on GPUs by installing PyTorch for Jetson nano: https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-8-0-now-available/72048 The only drawback is that this version running on Python 3.6 and you have to fix the version of matplotlib to 3.2.2 because the later version of matplotlib does not work on Python 3.6.

github-actions[bot] commented 3 years ago

πŸ‘‹ Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 πŸš€ resources:

Access additional Ultralytics ⚑ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐!

PiotrG1996 commented 2 years ago

@Ammad53: I managed to get it running on GPUs by installing PyTorch for Jetson nano: https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-8-0-now-available/72048 The only drawback is that this version running on Python 3.6 and you have to fix the version of matplotlib to 3.2.2 because the later version of matplotlib does not work on Python 3.6.

Seems like Jetson Nano is not using GPU (I've checked out in jtop) while inferencing... According to what performance should be given out (~0.030s = 30ms = 33 FPS). Instead of 33 FPS, it's always below 10 FPS (I implemented my own function to take a closer look at why it's not running well on an IP camera set up at 25 fps, results below 10 fps as well).

What may go wrong @glenn-jocher ?

TERMINAL:

python3 detect.py --source 0 --view-img --weights yolov5s.engine --imgsz 320 --device 0 --class 0 --conf-thres 0.4 --half

detect: weights=['yolov5s.engine'], source=0, data=data/coco128.yaml, imgsz=[320, 320], conf_thres=0.4, iou_thres=0.45, max_det=1000, device=0, view_img=True, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=[0], agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=True, dnn=False

Python 3.7.0 required by YOLOv5, but Python 3.6.9 is currently installed YOLOv5 πŸš€ v6.1-135-g7926afc torch 1.8.0 CUDA:0 (NVIDIA Tegra X1, 3964MiB)

Loading yolov5s.engine for TensorRT inference... [TensorRT] INFO: [MemUsageChange] Init CUDA: CPU +202, GPU +0, now: CPU 287, GPU 3272 (MiB) [TensorRT] INFO: Loaded engine size: 18 MB [TensorRT] INFO: [MemUsageSnapshot] deserializeCudaEngine begin: CPU 306 MiB, GPU 3312 MiB [TensorRT] WARNING: Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors. [TensorRT] INFO: [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +158, GPU +5, now: CPU 471, GPU 3339 (MiB) [TensorRT] INFO: [MemUsageChange] Init cuDNN: CPU +241, GPU +128, now: CPU 712, GPU 3467 (MiB) [TensorRT] INFO: [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU +0, now: CPU 711, GPU 3467 (MiB) [TensorRT] INFO: [MemUsageSnapshot] deserializeCudaEngine end: CPU 711 MiB, GPU 3467 MiB [TensorRT] INFO: [MemUsageSnapshot] ExecutionContext creation begin: CPU 1955 MiB, GPU 3477 MiB [TensorRT] INFO: [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU -6, now: CPU 1955, GPU 3472 (MiB) [TensorRT] INFO: [MemUsageChange] Init cuDNN: CPU +0, GPU -1, now: CPU 1955, GPU 3471 (MiB) [TensorRT] INFO: [MemUsageSnapshot] ExecutionContext creation end: CPU 1956 MiB, GPU 3477 MiB [ WARN:0] global /home/jetson/opencv/modules/videoio/src/cap_gstreamer.cpp (1081) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1 1/1: 0... Success (inf frames 1280x720 at 7.50 FPS)

glenn-jocher commented 2 years ago

@PiotrG1996 the device listed on this line is the device used for inference:

YOLOv5 πŸš€ v6.1-135-g7926afc torch 1.8.0 CUDA:0 (NVIDIA Tegra X1, 3964MiB)

Note your source is limited to 7.5 FPS

PiotrG1996 commented 2 years ago

I really don't understand what limits me from reaching a higher FPS rate. Based on the source below, it should be possible to utilize Jetson Nano performance much better. How do I fix this blocker, stopping me from better results?

ALXMAMAEV - TensorRT Jetson Nano Benchmark

screen_info

@PiotrG1996 the device listed on this line is the device used for inference:

YOLOv5 πŸš€ v6.1-135-g7926afc torch 1.8.0 CUDA:0 (NVIDIA Tegra X1, 3964MiB)

Note your source is limited to 7.5 FPS

glenn-jocher commented 2 years ago

@PiotrG1996 I would raise your question directly on the 3rd party repo

PiotrG1996 commented 2 years ago

That's perhaps what I would do as well.

I just couldn't figure out, where is the difference between camera frame rate and inference output?

1 frame can be processed in 0.03s? 5 frames = 0.15s? 25 frames = 0.75s?

How to improve this camera frame rate based on the tensorRT yolv5s.engine running on Jetson Nano? (Default code implementation from Ultralytics repository)


glenn-jocher commented 8 months ago

@PiotrG1996 If the NMS (non-maximum suppression) time limit is being exceeded, it may indicate a bottleneck in the post-processing step of the inference pipeline rather than the inference itself. This could be limiting the FPS results. I recommend checking the post-processing code and profiling the execution to identify any potential improvements. Additionally, optimizing the NMS algorithm or the TensorRT engine configuration may help improve the overall performance.