yolo v5 环境配置(gpu版本)

1、yolo v5 环境创建

yolov5缺陷检测案例
概要
本文主要面向第一次使用yolov5,连参数都不会配置的纯小白,记录了我自己初次使用的过程。

从下载yolov5,安装依赖,到训练模型和进行识别。

2、下载yolov5与安装依赖

git方式:

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

从github直接下载zip并解压:

https://github.com/ultralytics/yolov5

使用pycharm直接把这个文件夹作为项目打开。

首次使用我们要使用两个文件,以后会接触其他文件:

train.py 是我们进行训练的脚本
detect.py 是进行检测的脚本

搭建环境第一步是安装显卡驱动,然后要安装cuda toolkit和cudnn。
运行YoloV5可选为CPU或GPU环境。默认CPU环境无需配置,GPU环境需要安装与显卡版本对应的cuda,
1、anaconda 环境创建 一个新的虚拟环境
在这里插入图片描述
2、激活切换环境,
去pytorch官网查询与CUDA相匹配的版本,运行相应命令 (https://pytorch.org/get-started/previous-versions/)
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
验证是否安装了gpu版本
在这里插入图片描述
3、下载yolo v5

4、

pip install -r requirements.txt  -i https://pypi.tuna.tsinghua.edu.cn/simple

(注释掉torch等)
在这里插入图片描述
问题:
AttributeError: module ‘distutils’ has no attribute ‘version’
解决方案:
https://zhuanlan.zhihu.com/p/556704117
在这里插入图片描述

pip install setuptools==58.0.4 -i https://pypi.tuna.tsinghua.edu.cn/simple

在这里插入图片描述

RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.
在这里插入图片描述
https://blog.csdn.net/hjxu2016/article/details/121303818

在这里插入图片描述

在这里插入图片描述

3、训练结果

如下:
在这里插入图片描述
结果解读:
训练次数,GPU消耗
边界框损失,目标检测损失,分类损失,total,targets,P,R,mAP@.5, mAP@.5:.95, 验证集val Box, 验证集val obj, 验证集val cls
mAP@.5:.95。是把iou从0.5~0.95,每隔0.05计算一个map,最后把这些map求平均得到的。
在这里插入图片描述

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年2月24日 下午10:21
下一篇 2023年2月24日 下午10:22

相关推荐