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.2

 解决方法:

先卸载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

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值