当前位置:网站首页>手把手教学Yolov7的搭建及实践
手把手教学Yolov7的搭建及实践
2022-07-25 13:47:00 【计算机视觉研究院】
关注并星标
从此不迷路
计算机视觉研究院

公众号ID|ComputerVisionGzq
学习群|扫码在主页获取加入方式
计算机视觉研究院专栏
作者:Edison_G
yolo系列已经成了大家学习工作中常用的目标检测网络,果然,yolov7又来了。听说这个作者是yolov4的,我们就实践下。
01
概述
具体内容可以参考CSDN的he_eeeeeeeeeee,进入主页既可以或更加详细的操作流程。
源码:https://github.com/WongKinYiu/yolov7
论文:https://arxiv.org/abs/2207.02696
Yolov7:最新最快的实时检测框架,最详细分析解释(附源代码)
02
实验

搭建环境,这里直接用conda按照源码requirements.txt安装就行。
数据准备
现成数据(VisDrone)+配置脚本(yolov7.yaml等):
数据集:官方的VisDrone格式和yolov5的不同,要转换一下
制作自己数据集(lableme标注自己图片+labelme转yolo的脚本):
强烈建议用labelme
labelme格式标注完就是一张图对应一个json:

yolo格式是一个图对应一个txt:

我是把转化完的txt和json都同一个文件夹下:

标注软件:
labelme就一个exe文件50m左右,下载地址:8q3m,windows上下载后直接执行,非常方便
labelme转yolov5脚本:
(只写了检测的,labelme的分割、关键点等等脚本有机会写个总的)
import os
import json
import glob
#输入口,就是你图片和json存放的那个文件,输出的txt也在这个文件夹里
labelme_dir=r"C:\Users\ttao\Pictures\my_"
def get_labelme_data(labelme_dir):
with open(labelme_dir) as f:
j=json.load(f)
out_data=[]
img_h =j["imageHeight"]
img_w =j["imageWidth"]
for shape in j["shapes"]:
label=shape["label"]
points=shape["points"]
x,y,x2,y2=points[0][0],points[0][1],points[1][0],points[1][1]
x_c=(x+x2)//2
y_c=(y+y2)//2
w=abs(x-x2)
h=abs(y-y2)
out_data.append([label,x_c,y_c,w,h])
return img_h,img_w,out_data
def rename_Suffix(in_,mode=".txt"):
in_=in_.split('.')
return in_[0]+mode
def make_yolo_data(in_dir):
json_list=glob.glob(os.path.join(in_dir,'*.json'))
for json_ in json_list:
json_path=os.path.join(in_dir,json_)
json_txt=rename_Suffix(json_)
img_h,img_w,labelme_datas=get_labelme_data(json_path)
with open(os.path.join(in_dir,json_txt),'w+') as f:
for labelme_data in labelme_datas:
label=labelme_data[0]
x_c=labelme_data[1]/img_w
y_c=labelme_data[2]/img_h
w=labelme_data[3]/img_w
h=labelme_data[4]/img_h
f.write("{} {} {} {} {}\n".format(label,x_c,y_c,w,h))
f.close()
if __name__ == '__main__':
make_yolo_data(labelme_dir)训练
配置:train.py+数据集配置文件(.yaml)+选择网络的配置文件(默认为yolov7.yaml)
Visdrone数据集
数据集是无人机角度拍摄的,中国各城市的,主要是各种汽车、人等数据集
我具体配置情况如下:

train.py
–cfg 模型选择,这里默认是yolov7
–data 数据格式配置,我这里是自己的VisDrone数据格式,训练yolo的要改,看下面训练自己数据集
–hyp 超参数,先不管
–batch-size 这个yolov7我设高了容易爆,小点
VisDrone.yaml

然后就可以训练了


THE END
转载请联系本公众号获得授权

计算机视觉研究院学习群等你加入!
ABOUT
计算机视觉研究院
计算机视觉研究院主要涉及深度学习领域,主要致力于人脸检测、人脸识别,多目标检测、目标跟踪、图像分割等研究方向。研究院接下来会不断分享最新的论文算法新框架,我们这次改革不同点就是,我们要着重”研究“。之后我们会针对相应领域分享实践过程,让大家真正体会摆脱理论的真实场景,培养爱动手编程爱动脑思考的习惯!
VX:2311123606

边栏推荐
- The simplest solution of the whole network 1045 access denied for user [email protected] (using password:YES)
- Hcip day 10 notes
- Nodejs link MySQL error: Er_ NOT_ SUPPORTED_ AUTH_ MODEError: ER_ NOT_ SUPPORTED_ AUTH_ MODE
- How happy is the frisbee bureau? 2022 youth trendy Sports Report
- hcip第八天笔记
- Excel record macro
- Applet sharing function
- Blocking queue for concurrent programming
- 伯克利博士『机器学习工程』大实话;AI副总裁『2022 ML就业市场』分析;半导体创业公司大列表;大规模视频人脸属性数据集;前沿论文 | ShowMeAI资讯日报
- window unbutu20 LTS apt,wget 安装时 DNS 解析错误
猜你喜欢

Uncaught SyntaxError: Octal literals are not allowed in strict mode.

In order to improve efficiency, there are various problems when using parallelstream

JS Array indexOf includes sort() 冒号排序 快速排序 去重和随机样本 random
HTTP cache tongtianpian, there may be something you want

0715RHCSA

Preparing for the soft test for junior programmers in the second half of 2022

GCD details

6.27 uniapp project history

【力扣】645.错误的集合

redis集群的三种方式
随机推荐
Error of Tencent cloud [100007] this env is not enable anonymous login
GCD details
I2C can also be powered on by bus!
高版本MySQL服务端安装不上怎么办,忘记密码(MySQL8.0.29)?
Business visualization - make your flowchart'run'(3. Branch selection & cross language distributed operation node)
HTTP cache tongtianpian, there may be something you want
JS array indexof includes sort() colon sort quick sort de duplication and random sample random
刷题-洛谷-P1035 级数求和
Mxnet implementation of densenet (dense connection network)
刷题-洛谷-P1150 Peter的烟
Numpy quick start
The simplest solution of the whole network 1045 access denied for user [email protected] (using password:YES)
Workplace "digital people" don't eat or sleep 007 work system, can you "roll" them?
MXNet对DenseNet(稠密连接网络)的实现
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
Based on Baiwen imx6ull_ Ap3216 experiment driven by Pro development board
From input URL to web page display
Nodejs link MySQL error: Er_ NOT_ SUPPORTED_ AUTH_ MODEError: ER_ NOT_ SUPPORTED_ AUTH_ MODE
互斥锁、自旋锁、读写锁……理清它们的区别和应用
并发编程之阻塞队列
