当前位置:   article > 正文

jetson tx1 部署 yolov5_jetson tx1部署yolov5

jetson tx1部署yolov5

1.源码下载

  1. jetson@jetson-desktop:~/torch$ git clone https://github.com/ultralytics/yolov5.git
  2. Cloning into 'yolov5'...
  3. remote: Enumerating objects: 15368, done.
  4. remote: Counting objects: 100% (13/13), done.
  5. remote: Compressing objects: 100% (13/13), done.
  6. remote: Total 15368 (delta 1), reused 6 (delta 0), pack-reused 15355
  7. Receiving objects: 100% (15368/15368), 14.30 MiB | 2.36 MiB/s, done.
  8. Resolving deltas: 100% (10505/10505), done.
  9. jetson@jetson-desktop:~/torch$

2.修改requirements.txt

  1. jetson@jetson-desktop:~/torch/yolov5$ cat requirements.txt
  2. # YOLOv5 requirements
  3. # Usage: pip install -r requirements.txt
  4. # Base ------------------------------------------------------------------------
  5. #gitpython>=3.1.30
  6. matplotlib>=3.2.2
  7. numpy>=1.18.5
  8. opencv-python>=4.1.1
  9. Pillow>=7.1.2
  10. psutil # system resources
  11. PyYAML>=5.3.1
  12. requests>=2.23.0
  13. scipy>=1.4.1
  14. thop>=0.1.1 # FLOPs computation
  15. torch>=1.7.0 # see https://pytorch.org/get-started/locally (recommended)
  16. torchvision>=0.8.1
  17. tqdm>=4.64.0
  18. # protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012
  19. # Logging ---------------------------------------------------------------------
  20. tensorboard>=2.4.1
  21. # clearml>=1.2.0
  22. # comet
  23. # Plotting --------------------------------------------------------------------
  24. pandas>=1.1.4
  25. seaborn>=0.11.0
  26. # Export ----------------------------------------------------------------------
  27. # coremltools>=6.0 # CoreML export
  28. # onnx>=1.12.0 # ONNX export
  29. # onnx-simplifier>=0.4.1 # ONNX simplifier
  30. # nvidia-pyindex # TensorRT export
  31. # nvidia-tensorrt # TensorRT export
  32. # scikit-learn<=1.1.2 # CoreML quantization
  33. # tensorflow>=2.4.1 # TF exports (-cpu, -aarch64, -macos)
  34. # tensorflowjs>=3.9.0 # TF.js export
  35. # openvino-dev # OpenVINO export
  36. # Deploy ----------------------------------------------------------------------
  37. #setuptools>=65.5.1 # Snyk vulnerability fix
  38. setuptools
  39. # tritonclient[all]~=2.24.0
  40. # Extras ----------------------------------------------------------------------
  41. # ipython # interactive notebook
  42. # mss # screenshots
  43. # albumentations>=1.0.3
  44. # pycocotools>=2.0.6 # COCO mAP
  45. # ultralytics # HUB https://hub.ultralytics.com
  46. jetson@jetson-desktop:

3.安装依赖

jetson@jetson-desktop:~/torch/yolov5$ pip3 install -r requirements.txt  -i  http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

4.移植权重,进行检测

将之前训练的权重best.pt上传yolov5路径下。

5.报错修改

  1. jetson@jetson-desktop:~/torch/yolov5$ python3 detect.py --weights best.pt --sourc 001.jpg
  2. Traceback (most recent call last):
  3. File "detect.py", line 45, in <module>
  4. from models.common import DetectMultiBackend
  5. File "/home/jetson/torch/yolov5/models/common.py", line 24, in <module>
  6. from PIL import Image
  7. File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  8. File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  9. File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
  10. File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
  11. File "/home/jetson/.local/lib/python3.6/site-packages/Pillow-9.5.0-py3.6-linux-aarch64.egg/PIL/Image.py", line 59, in <module>
  12. File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  13. File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
  14. File "<frozen importlib._bootstrap>", line 894, in _find_spec
  15. File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
  16. File "<frozen importlib._bootstrap_external>", line 1131, in _get_spec
  17. File "<frozen importlib._bootstrap_external>", line 1112, in _legacy_get_spec
  18. File "<frozen importlib._bootstrap>", line 441, in spec_from_loader
  19. File "<frozen importlib._bootstrap_external>", line 544, in spec_from_file_location
  20. File "/home/jetson/.local/lib/python3.6/site-packages/Pillow-9.5.0-py3.6-linux-aarch64.egg/PIL/_deprecate.py", line 1
  21. SyntaxError: future feature annotations is not defined
  22. jetson@jetson-desktop:~/torch/yolov5$

修改

  1. jetson@jetson-desktop:~/torch$ pip3 install pillow==8.4.0
  2. WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
  3. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
  4. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
  5. Defaulting to user installation because normal site-packages is not writeable
  6. Collecting pillow==8.4.0
  7. Downloading Pillow-8.4.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB)
  8. |████████████████████████████████| 3.0 MB 27 kB/s
  9. Installing collected packages: pillow
  10. Attempting uninstall: pillow
  11. Found existing installation: Pillow 9.5.0
  12. Uninstalling Pillow-9.5.0:
  13. Successfully uninstalled Pillow-9.5.0
  14. Successfully installed pillow-8.4.0
  15. jetson@jetson-desktop:~/torch$

6.预测视频

 python detect.py --weights best.pt --source daming.mp4

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/569597
推荐阅读
相关标签
  

闽ICP备14008679号