一、安裝pytorch
1、官網地址https://pytorch.org/
2、根據自己的需求選擇
說明:
PyTorch Build
就是選擇下載穩定版(Stable
)還是預覽版(Preview
),這里一般選擇穩定版(Stable
)YourOS
不多說,選擇自己對應的操作系統類型Package
:下載方式,教程提供的是Conda
方式,這里我們使用Pip
方式Language
:即選擇你的python
版本(Anaconda
下載后自帶python
,可以在cmd
輸入python --version
查看自己的python
版本)CUDA
:如果要下載gpu
版本,那么就選擇你對應的cuda
的版本(不知道自己cuda
版本的請戳:https://www.jianshu.com/p/d3b9419a0f89);如果下載cpu
版本,那么選擇 NoneRun this Command
:當你選擇好版本后,會自動再次生成下載安裝PyTorch
的命令
3、安照命令安裝:
二、下載YOLOv5 github項目
1、地址:https://github.com/ultralytics/yolov5
2、驗證:
import torch #查看版本 print(torch.__version__) #查看gpu是否可用 print(torch.cuda.is_available()) #返回設備gpu個數 print(torch.cuda.device_count())
3、運行detect.py文件
檢測結果: