当前位置:网站首页>[target detection] yolov5 Runtong visdrone data set
[target detection] yolov5 Runtong visdrone data set
2022-07-25 16:47:00 【zstar-_】
background
stay YOLOv5 Official 6.1 In the version , I find Data There are so many in the catalogue 5 Data sets , Including UAV aerial photo data set VisDrone And remote sensing data sets xView, This reflects that the official is also secretly making efforts in small target detection .
This blog will record how to use YOLOv5 Run through VisDrone Data sets .
I have uploaded the data set to the online disk , Readers who need it can download :
https://pan.baidu.com/s/1UNQlZGHZlAZs412tbnpAxg?pwd=8888
Data set structure

The data set is divided into four files :
- VisDrone2019-DET-train: Training set
- VisDrone2019-DET-val: Verification set
- VisDrone2019-DET-test-dev: Test set ( With label )
- VisDrone2019-DET-test-challenge: Test set ( Without a label )
Unlabeled test sets are used for VisDrone2021 The challenge , If you don't participate in the competition, you don't need to use .
Dataset processing
and VOC The dataset is the same ,VisDrone The data annotation of is xml form , You need to convert it into YOLOv5 The required txt Format
In the official offering VisDrone.yaml below , Scripts for data processing have been provided , Make simple modifications based on it .
Create in the root directory visdrone2yolo.py:
from utils.general import download, os, Path
def visdrone2yolo(dir):
from PIL import Image
from tqdm import tqdm
def convert_box(size, box):
# Convert VisDrone box to YOLO xywh box
dw = 1. / size[0]
dh = 1. / size[1]
return (box[0] + box[2] / 2) * dw, (box[1] + box[3] / 2) * dh, box[2] * dw, box[3] * dh
(dir / 'labels').mkdir(parents=True, exist_ok=True) # make labels directory
pbar = tqdm((dir / 'annotations').glob('*.txt'), desc=f'Converting {
dir}')
for f in pbar:
img_size = Image.open((dir / 'images' / f.name).with_suffix('.jpg')).size
lines = []
with open(f, 'r') as file: # read annotation.txt
for row in [x.split(',') for x in file.read().strip().splitlines()]:
if row[4] == '0': # VisDrone 'ignored regions' class 0
continue
cls = int(row[5]) - 1 # Category No -1
box = convert_box(img_size, tuple(map(int, row[:4])))
lines.append(f"{
cls} {
' '.join(f'{
x:.6f}' for x in box)}\n")
with open(str(f).replace(os.sep + 'annotations' + os.sep, os.sep + 'labels' + os.sep), 'w') as fl:
fl.writelines(lines) # write label.txt
dir = Path('D:/Desktop/Work/Dataset/VisDrone') # datasets Under the folder Visdrone2019 Folder Directory
# Convert
for d in 'VisDrone2019-DET-train', 'VisDrone2019-DET-val', 'VisDrone2019-DET-test-dev':
visdrone2yolo(dir / d) # convert VisDrone annotations to YOLO labels
After running , You can see that and... Are generated under each data set images Corresponding labels

Create your own data path file
stay data Create below mydata.yaml( It can also be modified directly VisDrone.yaml)
Type in the following :
train: D:/Dataset/VisDrone/VisDrone2019-DET-train/images # train images (relative to 'path') 6471 images
val: D:/Dataset/VisDrone/VisDrone2019-DET-val/images # val images (relative to 'path') 548 images
test: D:/Dataset/VisDrone/VisDrone2019-DET-test-dev/images # test images (optional) 1610 images
# Classes
nc: 10 # number of classes
names: [ 'pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', 'awning-tricycle', 'bus', 'motor' ]
notes : Replace the path here with your own path .
Start training
stay train.py in , It is mainly necessary to modify several quantities shown in the red box below .
batch-size and workers The two parameters are flexibly selected according to your computer configuration .
It is worth noting that YOLOv5 5.0 The default size of the input image of version is 640, stay YOLOv5 6.1 In the version , The default size is changed to 960, This also reflects the official strategy to deal with small target detection .
After setting up , Just start training .
Video detection
After model training , function detect.py It can detect pictures or videos .
When using , Mainly modify the first three parameters , Meaning and train.py It's similar to .
in addition , For dense small targets , Data labels and confidence levels generated by default during output may block the target , Affect perception .
You can modify the following hide-labels and hide-conf Two attributes , In this way, labels and confidence levels can be hidden .
Enjoy yourself!
边栏推荐
- C#入门基础教程
- [image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code
- easyui下拉框,增加以及商品的上架,下架
- 3D semantic segmentation - PVD
- Various useful forms of London Silver K-line chart
- 文字翻译软件-文字批量翻译转换器免费
- IAAs infrastructure cloud cloud network
- [MySQL] takes you to the database
- Ilssi certification | the course of Six Sigma DMAIC
- In the eyes of 100 users, there are 100 QQS
猜你喜欢

WPF 实现用户头像选择器

7. Dependency injection

自定义mvc项目登录注册和树形菜单

3D语义分割——PVD

3D 语义分割——Scribble-Supervised LiDAR Semantic Segmentation

谁动了我的内存,揭秘 OOM 崩溃下降 90% 的秘密

Rebudget: balance efficiency and fairness in market-based multi-core resource allocation by reallocating the budget at run time

2D 语义分割——DeepLabV3plus 复现

Fudan University EMBA peer topic: always put the value of consumers in the most important position

Emqx cloud update: more parameters are added to log analysis, which makes monitoring, operation and maintenance easier
随机推荐
异常处理机制专题1
[redis] redis installation
Test framework unittest test test suite, results output to file
【知识图谱】实践篇——基于医疗知识图谱的问答系统实践(Part4):结合问题分类的问题解析与检索语句生成
【目标检测】YOLOv5跑通VOC2007数据集(修复版)
[cloud co creation] explore how gaussdb helps ICBC create core financial data
Fastadmin TP installation uses Baidu rich text editor ueeditor
3D semantic segmentation - scribed supervised lidar semantic segmentation
Today, I went to oppo for an interview and was asked numbly
在华为昇腾Ascend910上复现swin_transformer
伦敦银K线图的各种有用形态
百度富文本编辑器UEditor 图片宽度100%自适应,手机端
为什么 4EVERLAND 是 Web 3.0 的最佳云计算平台
Register service instances in ngmodule through dependency injection
Is the win11 dynamic tile gone? Method of restoring dynamic tile in Win 11
Use huggingface to quickly load pre training models and datasets in moment pool cloud
What is the shortcut key for win11 Desktop Switching? Win11 fast desktop switching method
Enterprise live broadcast: witness focused products, praise and embrace ecology
测试框架-unittest-命令行操作、断言方法
Ilssi certification | the course of Six Sigma DMAIC