vslam从入门到如土:ubuntu18环境下配置YOLOv5

笔者配置:拯救者R7000P

CPU:5800H

GPU:3060

1.anaconda环境配置

#创建conda环境,python=3.8
conda create --name yolov5 python=3.8
#进入yolov5环境
conda activate yolov5

2.下载yolov5

GitHub - ultralytics/yolov5: YOLOv5 in PyTorch > ONNX > CoreML > TFLite

git clone https://github.com/ultralytics/yolov5.git

3.安装环境

cd yolov5
pip install  -U  -r   requirements.txt

4.测试

权重文件下载地址:https://github.com/ultralytics/yolov5/releases/

下载yolov5s.pt并放到yolov5目录下

python detect.py --source data/images/ --weights yolov5s.pt --conf 0.4

5.坑

当你遇上

GeForce RTX 3060 Laptop GPU with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37.
If you want to use the GeForce RTX 3060 Laptop GPU GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

  warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
 


原因:30系显卡不支持cuda11以下版本,而requirements.txt安装的是pytorch1.10.0+cuda10.2vslam从入门到如土:ubuntu18环境下配置YOLOv5_第1张图片

 解决方法:

先卸载pytorch

把requirement里的torch>=1.7.0  ,   torchvision>=0.8.1两项删除

输入:

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install  -U  -r   requirements.txt

此时可以运行yolov5

你可能感兴趣的:(ubuntu,自动驾驶,深度学习)