共1209张。标注文件为YOLO适用的txt格式以及VOC格式。可以直接用于模型训练。
类别:缺失和不缺失。
输电线螺栓销钉缺失检测数据集介绍
数据集名称
输电线螺栓销钉缺失检测数据集(Transmission Line Bolt Pin Absence Detection Dataset)
数据集概述
该数据集专为输电线螺栓销钉缺失检测设计,包含1209张高清图像及其对应的YOLO TXT和VOC XML格式标签文件,标签类别包括两种状态:缺失(Absent)和不缺失(Present)。该数据集适用于使用深度学习和机器学习方法进行输电线螺栓销钉缺失检测的任务,特别是适用于基于YOLO系列(如YOLOv5、YOLOv6、YOLOv7、YOLOv8等)以及其他支持VOC格式的目标检测模型的训练。
数据集特点
- 高清图像:所有图像均为高清画质,确保螺栓销钉及其缺失情况的细节清晰可见。
- 详细标注:每张图像都有对应的YOLO TXT和VOC XML格式标签文件,标注了螺栓销钉的状态信息。
- 标准化格式:标签文件采用YOLO TXT和VOC XML格式,方便直接用于模型训练。
- 明确的状态分类:分为缺失(Absent)和不缺失(Present)两类,有助于模型的学习和泛化能力提升。
数据集构成
- 图像数量:1209张高清图像
- 类别:
- 缺失(Absent)
- 不缺失(Present)
- 标签格式:YOLO TXT格式和VOC XML格式
- 数据划分:
- 训练集:主要部分用于模型训练
- 验证集:用于调整模型超参数和防止过拟合
- 测试集:用于最终评估模型性能
数据集用途
- 螺栓销钉缺失检测:可用于训练模型识别输电线螺栓销钉的缺失情况,提高检测精度。
- 质量控制:帮助电力部门及时发现和处理螺栓销钉的缺失问题,提高输电线路的安全性和可靠性。
- 自动化检测:结合自动化设备,实现螺栓销钉缺失的实时检测,提高检测效率。
- 研究与开发:作为基准数据集,支持学术研究和技术开发,推动目标检测技术在输电线螺栓销钉缺失检测中的应用。
- 教育与培训:作为教学资源,帮助学生和从业人员理解并掌握螺栓销钉缺失检测的相关技术和方法。
示例代码
以下是一个简单的Python脚本示例,用于加载数据集中的图像及其对应的标签,并绘制出标注的边界框:
1import os
2import cv2
3import numpy as np
4import matplotlib.pyplot as plt
5from xml.etree import ElementTree as ET
6
7# 数据集目录路径
8data_dir = 'path/to/transmission_line_bolt_pin_absence_detection_dataset'
9train_image_dir = os.path.join(data_dir, 'images/train')
10train_xml_label_dir = os.path.join(data_dir, 'labels/xml/train')
11train_txt_label_dir = os.path.join(data_dir, 'labels/txt/train')
12
13# 选取一张图像及其标签文件
14image_files = os.listdir(train_image_dir)
15image_file = image_files[0] # 假设取第一张图
16image_path = os.path.join(train_image_dir, image_file)
17
18xml_label_file = os.path.splitext(image_file)[0] + '.xml'
19xml_label_path = os.path.join(train_xml_label_dir, xml_label_file)
20
21txt_label_file = os.path.splitext(image_file)[0] + '.txt'
22txt_label_path = os.path.join(train_txt_label_dir, txt_label_file)
23
24# 加载图像
25image = cv2.imread(image_path)
26
27# 从VOC XML文件加载标签
28def parse_xml(xml_file):
29 tree = ET.parse(xml_file)
30 root = tree.getroot()
31 objects = []
32 for obj in root.findall('object'):
33 name = obj.find('name').text
34 bbox = obj.find('bndbox')
35 xmin = int(bbox.find('xmin').text)
36 ymin = int(bbox.find('ymin').text)
37 xmax = int(bbox.find('xmax').text)
38 ymax = int(bbox.find('ymax').text)
39 objects.append((name, (xmin, ymin, xmax, ymax)))
40 return objects
41
42# 从YOLO TXT文件加载标签
43def parse_yolo(txt_file, width, height):
44 with open(txt_file, 'r') as f:
45 lines = f.readlines()
46 objects = []
47 for line in lines:
48 class_id, x_center, y_center, box_width, box_height = map(float, line.strip().split())
49 x_min = int((x_center - box_width / 2) * width)
50 y_min = int((y_center - box_height / 2) * height)
51 x_max = int((x_center + box_width / 2) * width)
52 y_max = int((y_center + box_height / 2) * height)
53 objects.append((int(class_id), (x_min, y_min, x_max, y_max)))
54 return objects
55
56# 解析VOC XML标签
57xml_objects = parse_xml(xml_label_path)
58
59# 解析YOLO TXT标签
60txt_objects = parse_yolo(txt_label_path, image.shape[1], image.shape[0])
61
62# 绘制图像和边界框
63plt.figure(figsize=(10, 10))
64plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
65plt.axis('off')
66
67colors = {0: 'red', 1: 'blue'} # 缺失红色,不缺失蓝色
68names = ['Absent', 'Present']
69
70for name, (xmin, ymin, xmax, ymax) in xml_objects:
71 plt.gca().add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, edgecolor='black', facecolor='none'))
72 plt.text(xmin, ymin, name, color='black', fontsize=8)
73
74for class_id, (xmin, ymin, xmax, ymax) in txt_objects:
75 plt.gca().add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, edgecolor=colors[class_id], facecolor='none'))
76 plt.text(xmin, ymin, names[class_id], color=colors[class_id], fontsize=8)
77
78plt.show()
数据集使用指南
- 数据准备:确认数据集路径是否正确,并且图像和标签文件均存在指定的目录下。
- 数据划分:数据集可以根据需要划分为训练集、验证集和测试集。通常建议至少保留一部分数据作为独立的测试集来评估模型的泛化能力。
- 配置文件:确保YOLOv5/v6/v7/v8等模型配置文件中的数据集路径和类别名称与数据集中的标签一致。
- 模型训练:使用YOLO框架或其他支持VOC格式的框架加载数据集,并开始训练模型。确保模型配置文件中数据集路径正确。
- 模型测试:使用已经训练好的模型进行测试,评估模型在测试集上的性能。
数据集结构示例
1├── transmission_line_bolt_pin_absence_detection_dataset
2│ ├── images
3│ │ ├── train
4│ │ │ ├── 00000.jpg
5│ │ │ ├── 00001.jpg
6│ │ │ └── ...
7│ │ ├── val
8│ │ │ ├── 00000.jpg
9│ │ │ ├── 00001.jpg
10│ │ │ └── ...
11│ │ └── test
12│ │ ├── 00000.jpg
13│ │ ├── 00001.jpg
14│ │ └── ...
15│ ├── labels
16│ │ ├── xml
17│ │ │ ├── train
18│ │ │ │ ├── 00000.xml
19│ │ │ │ ├── 00001.xml
20│ │ │ │ └── ...
21│ │ │ ├── val
22│ │ │ │ ├── 00000.xml
23│ │ │ │ ├── 00001.xml
24│ │ │ │ └── ...
25│ │ │ └── test
26│ │ │ ├── 00000.xml
27│ │ │ ├── 00001.xml
28│ │ │ └── ...
29│ │ ├── txt
30│ │ │ ├── train
31│ │ │ │ ├── 00000.txt
32│ │ │ │ ├── 00001.txt
33│ │ │ │ └── ...
34│ │ │ ├── val
35│ │ │ │ ├── 00000.txt
36│ │ │ │ ├── 00001.txt
37│ │ │ │ └── ...
38│ │ │ └── test
39│ │ │ ├── 00000.txt
40│ │ │ ├── 00001.txt
41│ │ │ └── ...
42│ └── data.yaml # 包含类别定义和数据路径
引用出处
为了确保正确引用该数据集,请查看原始数据集发布者的具体要求。如果该数据集来自某个特定的研究项目或竞赛,引用格式可能类似于以下示例:
1@misc{dataset_paper,
2 title={Title of the Data Set},
3 author={Author Names},
4 year={Publication Year},
5 publisher={Publishing Institution},
6 url={URL of the data set}
7}
总结
输电线螺栓销钉缺失检测数据集为螺栓销钉缺失检测提供了专业的数据支持。通过高分辨率图像和详细的YOLO TXT及VOC XML格式标注信息,该数据集能够帮助训练和评估模型在识别螺栓销钉缺失方面的能力。无论是对于学术研究还是工业应用,该数据集都是一个极具价值的研究资源。