赞
踩
1.源码下载
- jetson@jetson-desktop:~/torch$ git clone https://github.com/ultralytics/yolov5.git
- Cloning into 'yolov5'...
- remote: Enumerating objects: 15368, done.
- remote: Counting objects: 100% (13/13), done.
- remote: Compressing objects: 100% (13/13), done.
- remote: Total 15368 (delta 1), reused 6 (delta 0), pack-reused 15355
- Receiving objects: 100% (15368/15368), 14.30 MiB | 2.36 MiB/s, done.
- Resolving deltas: 100% (10505/10505), done.
- jetson@jetson-desktop:~/torch$
2.修改requirements.txt
- jetson@jetson-desktop:~/torch/yolov5$ cat requirements.txt
- # YOLOv5 requirements
- # Usage: pip install -r requirements.txt
-
- # Base ------------------------------------------------------------------------
- #gitpython>=3.1.30
- matplotlib>=3.2.2
- numpy>=1.18.5
- opencv-python>=4.1.1
- Pillow>=7.1.2
- psutil # system resources
- PyYAML>=5.3.1
- requests>=2.23.0
- scipy>=1.4.1
- thop>=0.1.1 # FLOPs computation
- torch>=1.7.0 # see https://pytorch.org/get-started/locally (recommended)
- torchvision>=0.8.1
- tqdm>=4.64.0
- # protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012
-
- # Logging ---------------------------------------------------------------------
- tensorboard>=2.4.1
- # clearml>=1.2.0
- # comet
-
- # Plotting --------------------------------------------------------------------
- pandas>=1.1.4
- seaborn>=0.11.0
-
- # Export ----------------------------------------------------------------------
- # coremltools>=6.0 # CoreML export
- # onnx>=1.12.0 # ONNX export
- # onnx-simplifier>=0.4.1 # ONNX simplifier
- # nvidia-pyindex # TensorRT export
- # nvidia-tensorrt # TensorRT export
- # scikit-learn<=1.1.2 # CoreML quantization
- # tensorflow>=2.4.1 # TF exports (-cpu, -aarch64, -macos)
- # tensorflowjs>=3.9.0 # TF.js export
- # openvino-dev # OpenVINO export
-
- # Deploy ----------------------------------------------------------------------
- #setuptools>=65.5.1 # Snyk vulnerability fix
- setuptools
- # tritonclient[all]~=2.24.0
-
- # Extras ----------------------------------------------------------------------
- # ipython # interactive notebook
- # mss # screenshots
- # albumentations>=1.0.3
- # pycocotools>=2.0.6 # COCO mAP
- # ultralytics # HUB https://hub.ultralytics.com
- 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.报错修改
- jetson@jetson-desktop:~/torch/yolov5$ python3 detect.py --weights best.pt --sourc 001.jpg
- Traceback (most recent call last):
- File "detect.py", line 45, in <module>
- from models.common import DetectMultiBackend
- File "/home/jetson/torch/yolov5/models/common.py", line 24, in <module>
- from PIL import Image
- File "<frozen importlib._bootstrap>", line 971, in _find_and_load
- File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
- File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
- File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
- 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>
- File "<frozen importlib._bootstrap>", line 971, in _find_and_load
- File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
- File "<frozen importlib._bootstrap>", line 894, in _find_spec
- File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
- File "<frozen importlib._bootstrap_external>", line 1131, in _get_spec
- File "<frozen importlib._bootstrap_external>", line 1112, in _legacy_get_spec
- File "<frozen importlib._bootstrap>", line 441, in spec_from_loader
- File "<frozen importlib._bootstrap_external>", line 544, in spec_from_file_location
- File "/home/jetson/.local/lib/python3.6/site-packages/Pillow-9.5.0-py3.6-linux-aarch64.egg/PIL/_deprecate.py", line 1
- SyntaxError: future feature annotations is not defined
- jetson@jetson-desktop:~/torch/yolov5$
修改
- jetson@jetson-desktop:~/torch$ pip3 install pillow==8.4.0
- WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
- Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
- To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
- Defaulting to user installation because normal site-packages is not writeable
- Collecting pillow==8.4.0
- Downloading Pillow-8.4.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.0 MB)
- |████████████████████████████████| 3.0 MB 27 kB/s
- Installing collected packages: pillow
- Attempting uninstall: pillow
- Found existing installation: Pillow 9.5.0
- Uninstalling Pillow-9.5.0:
- Successfully uninstalled Pillow-9.5.0
- Successfully installed pillow-8.4.0
- jetson@jetson-desktop:~/torch$
6.预测视频
python detect.py --weights best.pt --source daming.mp4
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。