尝试跑YOLOv5项目

一、从GitHub上下载项目https://github.com/ultralytics/yolov5

选择v5版本的,用Pycharm打开,选择建好的Conda—pytorch1(python=3.8)环境(在上篇配置pytorch中安装的)

二、安装相应的包(作者提供了requirment.txt文件)

①根据pycharm自带的上方智能提示install

或②用命令行pip install -r requirements.txt安装

——在该步骤主要出现两种报错

Ⅰpip不提供,使用国内镜像下载即可成功

Ⅱ pycocotools问题,“ERROR: Failed building wheel for pycocotools”

error:Microsoft Visual C+ 14. 0 or greater is required. Cet it with Microsoft C-t Build Tools : https://visualstudio.microsof t.com'visualt

主要因为pycocotools的维护者不再提供Windows平台的支持,下载VisualStudio生成工具2019成功,注意不用下载VisualStudio profession“VisualStudio 2022”

 错误解决之后,所有包成功安装

二、在detect.py中run

出现错误就百度解决

运行成功结果

 三、分析

——输入的是图片、视频都可以,在yolov5-5.0/data/images/;输出结果保存在yolov5-5.0/runs/detect/expx,运行一次就有一次结果

——detect.py文件中,可修改参数:

 conf-thres:置信度,默认0.25代表检测图片中的事物超过0.25可信度时就显示检测出来

猜你喜欢

转载自blog.csdn.net/qq_51141671/article/details/131438079