当前位置:网站首页>Construction and practice of yolov7 in hands-on teaching
Construction and practice of yolov7 in hands-on teaching
2022-07-25 13:49:00 【Computer Vision Research Institute】
Pay attention to the parallel stars
Never get lost
Institute of computer vision

official account ID|ComputerVisionGzq
Study Group | Scan the code to get the join mode on the homepage
Computer Vision Institute column
author :Edison_G
yolo Series has become a common target detection network in your study and work , Sure enough ,yolov7 Here we go again . It is said that the author is yolov4 Of , Let's practice .
01
summary
For details, please refer to CSDN Of he_eeeeeeeeeee, You can enter the home page or a more detailed operation process .
Source code :https://github.com/WongKinYiu/yolov7
The paper :https://arxiv.org/abs/2207.02696
02
experiment

Set up the environment , It's directly used here conda According to the source code requirements.txt Just install it .
Data preparation
Off the shelf data (VisDrone)+ The configuration script (yolov7.yaml etc. ):
Data sets : Official VisDrone Format and yolov5 Different , I want to change it
Make your own dataset (lableme Mark your picture +labelme turn yolo Script for ):
It is strongly recommended to use labelme
labelme After the format is marked, one figure corresponds to one json:

yolo The format is that one graph corresponds to one txt:

I transformed it txt and json Under the same folder :

Labeling software :
labelme Just one exe file 50m about , Download address :8q3m,windows Directly execute after uploading and downloading , Very convenient
labelme turn yolov5 Script :
( Only the detected ones are written ,labelme Segmentation 、 Key points, etc. the script has the opportunity to write a general )
import os
import json
import glob
# Input port , It's your pictures and json The file stored , Output txt Also in this folder
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)Training
To configure :train.py+ Dataset configuration file (.yaml)+ Select the configuration file of the network ( The default is yolov7.yaml)
Visdrone Data sets
The data set is taken from the angle of UAV , Chinese cities , Mainly all kinds of cars 、 Human data set
My specific configuration is as follows :

train.py
–cfg Model selection , The default here is yolov7
–data Data format configuration , I have my own VisDrone data format , Training yolo It needs to be changed , Look at the training data set below
–hyp Hyperparameters , I don't care
–batch-size This yolov7 I set it high and easy to explode , Smaller 
VisDrone.yaml

Then you can train


THE END
Please contact the official account for authorization.

The learning group of computer vision research institute is waiting for you to join !
ABOUT
Institute of computer vision
The Institute of computer vision is mainly involved in the field of deep learning , Mainly devoted to face detection 、 Face recognition , Multi target detection 、 Target tracking 、 Image segmentation and other research directions . The Research Institute will continue to share the latest paper algorithm new framework , The difference of our reform this time is , We need to focus on ” Research “. After that, we will share the practice process for the corresponding fields , Let us really experience the real scene of getting rid of the theory , Develop the habit of hands-on programming and brain thinking !
VX:2311123606

边栏推荐
- HTTP cache tongtianpian, there may be something you want
- Prepare for 2022 csp-j1 2022 csp-s1 preliminaries video set
- The migration of arm architecture to alsa lib and alsa utils is smooth
- Uncaught SyntaxError: Octal literals are not allowed in strict mode.
- 刷题-洛谷-P1146 硬币翻转
- Nodejs link MySQL error: Er_ NOT_ SUPPORTED_ AUTH_ MODEError: ER_ NOT_ SUPPORTED_ AUTH_ MODE
- Install oh my Zsh
- uniapp处理后台传输图片
- 安装mujoco报错:distutils.errors.DistutilsExecError: command ‘gcc‘ failed with exit status 1
- 手里有点钱可以投资哪些理财产品?
猜你喜欢

LabVIEW的内部错误

电脑里一辈子都不想删的神仙软件

【配置Hifive1-revB】设备管理器中不识别端口,Can not connect to J-Link via USB的解决办法

QGIS加载在线地图:高德、天地图等

Pytest.mark.parameterize and mock use

刷题-洛谷-P1035 级数求和

VIM basic operation summary

Brush questions - Luogu -p1035 series summation

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

0713RHCSA
随机推荐
嵌入式代码如何进行重构?
Sports luxury or safety luxury? Which type of Asian Dragon and Volvo S60 should we start with?
Pytest.mark.parameterize and mock use
刷题-洛谷-P1085 不高兴的津津
Install mujoco and report an error: distutils.errors DistutilsExecError: command ‘gcc‘ failed with exit status 1
uniapp处理后台传输图片
Prepare for 2022 csp-j1 2022 csp-s1 preliminaries video set
window unbutu20 LTS apt,wget 安装时 DNS 解析错误
mysql 01: source命令
How can information security engineers prepare for the soft exam in the second half of 2022?
stable_ Baselines quick start
IM system - some common problems of message streaming
@Wrap decorator
QGIS loading online map: Gaode, Tiandi map, etc
0715RHCSA
「数字安全」警惕 NFT的七大骗局
Hcip day 9 notes
[configure hifive1 revb] the device manager does not recognize the port, and can not connect to j-link via USB
音视频技术开发周刊 | 255
刷题-洛谷-P1150 Peter的烟
