1.参考以下链接,安装anaconda:
https://www.bilibili.com/video/BV1z24y1b7Qm/?p=2&spm_id_from=pageDriver
2.参考以下链接,安装vscode+编译器选择+anaconda环境变量更改
https://www.bilibili.com/video/BV1bQ4y1n7sn?p=4&vd_source=57e45c6d673d6cbd7f32de3f945fc220
3.参考以下链接教程,安装好cuda11.3.0,cudnn8.2.1
Win10配置Yolov5虚拟环境之(安装CUDA和cuDNN和pytorch)_虚拟环境下载的cuda在哪-优快云博客
4.在anaconda prompt终端,运行以下命令安装与cuda与cudnn版本相匹配的pytorch
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
5.由于yolov5s中requirements.txt配置起来总是自动安装最新版本,因此,这里提供一个适合yolov5s-6.1版本的requirements.txt文件,省得运行起来各种报错,具体如下:
# pip install -r requirements.txt
# Base ----------------------------------------
matplotlib==3.5.2
numpy==1.19.5
opencv-python==4.9.0.80
Pillow==9.5.0
PyYAML==6.0.1
requests==2.25.1
scipy==1.10.1
torch==1.11.0
torchvision==0.12.0
tqdm==4.61.2
timm==0.9.16
einops==0.7.0
# Logging -------------------------------------
tensorboard==2.9.1
# wandb
# Plotting ------------------------------------
pandas==1.2.5
seaborn==0.11.0
# Export --------------------------------------
# coremltools==4.1 # CoreML export
# onnx==1.9.0 # ONNX export
# onnx-simplifier==0.3.6 # ONNX simplifier
# scikit-learn==0.19.2 # CoreML quantization
# tensorflow==2.4.1 # TFLite export
# tensorflowjs==3.9.0 # TF.js export
# openvino-dev # OpenVINO export
# Extras --------------------------------------
# albumentations==1.0.3
# Cython # for pycocotools https://github.com/cocodataset/cocoapi/issues/172
# pycocotools==2.0 # COCO mAP
# roboflow
thop==0.1.1.post2209072238 # FLOPs computation