笔者配置:拯救者R7000P
CPU:5800H
GPU:3060
#创建conda环境,python=3.8
conda create --name yolov5 python=3.8
#进入yolov5环境
conda activate yolov5
GitHub - ultralytics/yolov5: YOLOv5 in PyTorch > ONNX > CoreML > TFLite
git clone https://github.com/ultralytics/yolov5.git
cd yolov5
pip install -U -r requirements.txt
权重文件下载地址:https://github.com/ultralytics/yolov5/releases/
下载yolov5s.pt并放到yolov5目录下
python detect.py --source data/images/ --weights yolov5s.pt --conf 0.4
当你遇上
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