电网操作人员/防护用品识别检测数据集 yolo数据集共1800张 6类 防护用具识别数据集/操作人员识别数据集yolov5-v11通用 - write(chunk)
电网操作人员/防护用品识别检测数据集 yolo数据集共1800张 6类 防护用具识别数据集/操作人员识别数据集yolov5-v11通用
电网操作人员/防护用品识别检测数据集 yolo数据集共1800张 6类 防护用具识别数据集/操作人员识别数据集yolov5-v11通用
电网操作人员/防护用品识别检测数据集 yolo数据集共1800张 6类 防护用具识别数据集/操作人员识别数据集yolov5-v11通用
电网操作人员、防护用品识别检测数据集介绍
数据集概述
名称:电网操作人员、防护用品识别检测数据集图像数量:1800张标注对象:
badge:工牌gLove:手套operatingbar:操作杆person:人员powerchecker:电力检测器wrongglove:错误佩戴的手套
标注数量:
badge:561个gLove:1315个operatingbar:648个person:3341个powerchecker:547个wrongglove:3572个
用途:该数据集专为电网操作人员及其防护用品的识别和检测任务设计,适用于电力行业中的安全监控、操作规范检查等领域。通过使用YOLO(You Only Look Once)等目标检测模型,可以实现对电网操作人员及其防护用品的准确检测。
数据集特点
针对性强:专门针对电网操作人员及其防护用品进行标注,适用于特定的应用场景。高质量标注:所有图像都经过专业标注,确保了标注的准确性。实际应用场景:数据来源于真实的电网操作环境,具有很高的实用价值。多样性:
光照条件:包含不同光照条件下的图像,如自然光、人工照明等。背景环境:涵盖不同的背景环境,如变电站、输电线路、维修现场等。姿态和角度:包括不同姿态和角度的操作人员及防护用品,增强了模型的泛化能力。数据增强:通过数据增强技术(如旋转、翻转、缩放等)增加了数据集的多样性和鲁棒性。
主要任务
目标检测:识别并定位图像中的工牌、手套、操作杆、人员、电力检测器以及错误佩戴的手套位置。目标分类:确认检测到的目标是哪种防护用品或操作工具。数量统计:统计图像中各类目标的数量,辅助安全管理决策。
数据集结构
图像数据:包含1800张高分辨率图像,每张图像中可能包含一个或多个目标实例。标注文件:
边界框标注:使用常见的YOLO格式进行边界框标注,每个边界框包含类别标签和坐标信息。类名:
badge:表示工牌gLove:表示手套operatingbar:表示操作杆person:表示人员powerchecker:表示电力检测器wrongglove:表示错误佩戴的手套元数据:可能包含每张图像的相关信息,如采集时间、地点、样本来源等。
应用领域
安全监控:辅助电力公司快速发现和定位操作人员及其防护用品的状态,提高安全监控效率。操作规范检查:支持自动化操作规范检查系统,减少人工操作的风险和成本。培训与教育:结合虚拟现实(VR)或增强现实(AR)技术,提供操作人员的安全培训和教育。学术研究:支持研究人员进行目标检测算法的研究和优化,特别是在工业安全领域的应用。
获取方式
通常情况下,研究人员可以通过以下途径获取该数据集:
请注意,使用时应遵循相应的许可协议和引用要求。
关键代码示例
1. 下载数据集
假设我们已经有了数据集的下载链接,可以使用 Python 的 requests 库来下载数据集:
import requests
import os
import zipfile
# 定义下载链接和保存路径
url = 'http://example.com/path/to/power_grid_dataset.zip' # 替换为实际的下载链接
save_path = './power_grid_dataset.zip'
# 检查是否已经下载过
if not os.path.exists(save_path):
print("Downloading dataset...")
response = requests.get(url, stream=True)
with open(save_path, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
if chunk:
f.write(chunk)
print("Download complete.")
else:
print("Dataset already exists.")
# 解压数据集
with zipfile.ZipFile(save_path, 'r') as zip_ref:
zip_ref.extractall('./power_grid_dataset')
2. 加载和显示图像及其标注
以下是一个加载和显示图像及其标注框的示例:
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import glob
def load_image_and_annotations(image_path, annotation_path):
image = Image.open(image_path).convert("RGB")
with open(annotation_path, 'r') as f:
annotations = [line.strip().split() for line in f.readlines()]
return image, annotations
def display_image_with_annotations(image, annotations):
fig, ax = plt.subplots(1, figsize=(10, 10))
ax.imshow(image)
for annotation in annotations:
class_id, x_center, y_center, width, height = map(float, annotation)
x_min = (x_center - width / 2) * image.width
y_min = (y_center - height / 2) * image.height
x_max = (x_center + width / 2) * image.width
y_max = (y_center + height / 2) * image.height
rect = plt.Rectangle((x_min, y_min), x_max - x_min, y_max - y_min, fill=False, edgecolor='red', linewidth=2)
ax.add_patch(rect)
# 添加类别标签
if class_id == 0:
label = 'badge'
elif class_id == 1:
label = 'gLove'
elif class_id == 2: 拼多多帮助力入口
label = 'operatingbar'
elif class_id == 3:
label = 'person'
elif class_id == 4:
label = 'powerchecker'
elif class_id == 5:
label = 'wrongglove'
else:
label = 'Unknown'
ax.text(x_min, y_min, label, fontsize=12, color='white', bbox=dict(facecolor='red', alpha=0.5))
plt.axis('off')
plt.show()
# 示例路径
image_path = './power_grid_dataset/images/image_0001.jpg'
annotation_path = './power_grid_dataset/annotations/image_0001.txt'
image, annotations = load_image_and_annotations(image_path, annotation_path)
display_image_with_annotations(image, annotations)
3. 使用 YOLOv8 进行目标检测
以下是一个使用 YOLOv8 进行目标检测的简单示例:
安装依赖库 pip install ultralytics 准备配置文件 在 ultralytics 目录下创建一个配置文件 power_grid.yaml,内容如下: train: ./power_grid_dataset/images/train
val: ./power_grid_dataset/images/val
nc: 6
names: ['badge', 'gLove', 'operatingbar', 'person', 'powerchecker', 'wrongglove'] 训练模型 使用 ultralytics 库提供的命令行工具进行训练 yolo train model=yolov8m.pt data=power_grid.yaml epochs=100 imgsz=640 batch=8 评估模型 使用 ultralytics 库提供的命令行工具进行评估: yolo val model=runs/train/exp/weights/best.pt data=power_grid.yaml 推理和可视化
加载模型 from ultralytics import YOLO
# 加载预训练模型
model = YOLO('runs/train/exp/weights/best.pt') 单张图片推理 def predict_and_show(image_path, model):
results = model(image_path)
# 显示结果
for result in results:
result.show()
# 示例路径
image_path = './power_grid_dataset/images/test/image_0001.jpg'
predict_and_show(image_path, model) 批量图片推理 def predict_batch_images(image_folder, model):
images = [os.path.join(image_folder, img) for img in os.listdir(image_folder) if img.endswith('.jpg')]
results = model(images)
# 显示结果
for result in results:
result.show()
# 示例路径
image_folder = './power_grid_dataset/images/test'
predict_batch_images(image_folder, model) 视频推理 import cv2
def predict_video(video_path, model, output_path='output.mp4'):
cap = cv2.VideoCapture(video_path)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = int(cap.get(cv2.CAP_PROP_FPS))
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(output_path, fourcc, fps, (width, height))
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
results = model(frame)
annotated_frame = results[0].plot()
out.write(annotated_frame)
cv2.imshow('Frame', annotated_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
out.release()
cv2.destroyAllWindows()
# 示例路径
video_path = './test_video.mp4'
predict_video(video_path, model)
通过上述步骤,您将拥有一个完整的基于YOLOv8的电网操作人员及其防护用品检测系统,包括数据集准备、模型训练、评估和推理。希望这些代码能帮助您更好地理解和使用该模型!
电网操作人员/防护用品识别检测数据集 yolo数据集共1800张 6类 防护用具识别数据集/操作人员识别数据集yolov5-v11通用
参考文章