当前位置:网站首页>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

边栏推荐
- 移动端网站,独立APP,网站排名策略有哪些?
- 电脑里一辈子都不想删的神仙软件
- 职场「数字人」不吃不睡007工作制,你「卷」得过它们吗?
- Leetcode 113. path sum II
- leetcode202---快乐数
- GCD details
- [configure hifive1 revb] the device manager does not recognize the port, and can not connect to j-link via USB
- LabVIEW的内部错误
- NoSQL, relational database, row and column database comparison and analogy
- 【配置Hifive1-revB】设备管理器中不识别端口,Can not connect to J-Link via USB的解决办法
猜你喜欢

2022年下半年软考信息安全工程师如何备考?
![[configure hifive1 revb] the device manager does not recognize the port, and can not connect to j-link via USB](/img/55/a8acdd63a17bf9e3072c9a04babe79.png)
[configure hifive1 revb] the device manager does not recognize the port, and can not connect to j-link via USB

刷题-洛谷-P1059 明明的随机数

Install mujoco and report an error: distutils.errors DistutilsExecError: command ‘gcc‘ failed with exit status 1

刷题-洛谷-P1035 级数求和

adb通过Wi-Fi连接小米手机

MXNet对DenseNet(稠密连接网络)的实现

0713RHCSA

Brush questions - Luogu -p1152 happy jump

Nodejs link MySQL error: Er_ NOT_ SUPPORTED_ AUTH_ MODEError: ER_ NOT_ SUPPORTED_ AUTH_ MODE
随机推荐
Pycharm cannot input Chinese solution
Brush questions - Luogu -p1035 series summation
飞盘局有多快乐?2022年轻人新潮运动报告
Install mujoco and report an error: distutils.errors DistutilsExecError: command ‘gcc‘ failed with exit status 1
0713RHCSA
Pytest.mark.parameterize and mock use
Numpy快速入门
Brush questions - Luogu -p1047 trees outside the school gate
Vscode plug-in development
hcip第八天笔记
DNS resolution error during windows unbutu20 lts apt, WGet installation
Hcip day 9 notes
Based on Baiwen imx6ull_ Ap3216 experiment driven by Pro development board
IM system - some common problems of message streaming
Brush questions - Luogu -p1075 prime factor decomposition
hcip第九天笔记
NoSQL, relational database, row and column database comparison and analogy
G027-op-ins-rhel-04 RedHat openstack creates a customized qcow2 format image
2022年下半年软考初级程序员备考
Uniapp handles background transfer pictures
