光伏板缺陷红外检测数据集 包含以下4个数据文件: /train:训练集 /valid:验证集 /test:测试集 README.txt:数据说明 【数据说明】检测目标以Pascal VOC格式进行标注,对每个图像进行以下预处理,统一调整大小为640x640。数据集共包含11599+光伏板红外图像样张,其中train包含11400+红外图像样张(带xml标注),valid包含119+红外图像样张(带xml标注),test包含80+红外图像样张(带xml标注),也可以自行划分训练集、验证集和测试集,数据集的增广方法如下: * Rotation: Between -45° and +45° * Brightness: Between -25% and +25% 最后,目标检测对应的缺陷类别包含2大类,分别为热点和局部热斑。

光伏板缺陷红外检测数据集
数据集描述
该数据集是一个专门用于光伏板缺陷红外图像检测的数据集,旨在帮助研究人员和开发者训练和评估基于深度学习的目标检测模型。光伏板是太阳能发电系统中的关键组件,其性能直接影响整个系统的效率。通过红外成像技术,可以有效检测光伏板上的热点和局部热斑等缺陷,从而及时发现并处理潜在问题。数据集提供了大量的高分辨率红外图像,并且所有标注都是通过Pascal VOC格式进行的,确保了高质量的标注信息。
数据规模
- 总样本数量:11,599+张红外图像 
  
- 训练集 (train):11,400+张红外图像(带xml标注)
 - 验证集 (valid):119+张红外图像(带xml标注)
 - 测试集 (test):80+张红外图像(带xml标注)
 
 - 数据量:具体大小未提供
 - 标注格式:Pascal VOC格式XML标注
 - 目标类别: 
  
- 热点 (Hot Spot)
 - 局部热斑 (Local Hot Spot)
 
 
图像特性
- 统一预处理:每张图像都经过预处理,统一调整大小为640x640像素。
 - 多样化场景:覆盖了不同类型的光伏板、不同的光照条件以及各种背景环境下的红外图像情况。
 - 高质量手工标注:每张图像都有详细的边界框标注,支持直接用于训练目标检测模型。
 - 真实拍摄:所有图像均为实际拍摄的真实场景,增强了模型在实际应用中的鲁棒性。
 - 数据增广:数据集进行了以下增广方法: 
  
- 旋转 (Rotation):角度范围为-45°到+45°
 - 亮度 (Brightness):变化范围为-25%到+25%
 
 
应用场景
- 光伏系统维护:通过自动检测光伏板上的热点和局部热斑,辅助运维人员及时发现和处理故障,提高光伏系统的可靠性和发电效率。
 - 智能巡检:集成到无人机或机器人巡检系统中,实现自动化巡检,减少人工成本。
 - 科研分析:用于研究目标检测算法在特定工业应用场景中的表现,特别是在复杂背景和光照条件下的鲁棒性。
 - 故障预警:通过早期检测光伏板上的温度异常,提前预警潜在故障,减少系统停机时间。
 
数据集结构
典型的数据集目录结构如下:
1solar_panel_defect_infrared_dataset/
2├── train/
3│   ├── images/
4│   │   ├── img_00001.jpg
5│   │   ├── img_00002.jpg
6│   │   └── ...
7│   ├── annotations/
8│   │   ├── img_00001.xml
9│   │   ├── img_00002.xml
10│   │   └── ...
11├── valid/
12│   ├── images/
13│   │   ├── img_00001.jpg
14│   │   ├── img_00002.jpg
15│   │   └── ...
16│   ├── annotations/
17│   │   ├── img_00001.xml
18│   │   ├── img_00002.xml
19│   │   └── ...
20├── test/
21│   ├── images/
22│   │   ├── img_00001.jpg
23│   │   ├── img_00002.jpg
24│   │   └── ...
25│   ├── annotations/
26│   │   ├── img_00001.xml
27│   │   ├── img_00002.xml
28│   │   └── ...
29├── README.txt  # 数据说明文件 
数据说明
- 检测目标:以Pascal VOC格式进行标注。
 - 图像预处理:每张图像都经过预处理,统一调整大小为640x640像素。
 - 数据集内容: 
  
- 训练集 (train):包含11,400+张红外图像样张(带xml标注)。
 - 验证集 (valid):包含119+张红外图像样张(带xml标注)。
 - 测试集 (test):包含80+张红外图像样张(带xml标注)。
 
 - 目标标签:目标检测对应的缺陷类别包含2大类,分别为热点 (Hot Spot) 和局部热斑 (Local Hot Spot)。
 - 数据增广:数据集进行了以下增广方法: 
  
- 旋转 (Rotation):角度范围为-45°到+45°
 - 亮度 (Brightness):变化范围为-25%到+25%
 
 - 自行划分:用户可以根据需要自行划分训练集、验证集和测试集。
 
示例代码
以下是一个使用Python和相关库(如OpenCV、PIL等)来加载和展示数据集的简单示例代码:
1import os
2import cv2
3import numpy as np
4from PIL import Image
5import xml.etree.ElementTree as ET
6
7# 数据集路径
8dataset_path = 'path/to/solar_panel_defect_infrared_dataset/'
9
10# 加载图像和边界框标注
11def load_image_and_boxes(image_path, annotation_path):
12    # 读取图像
13    image = Image.open(image_path).convert('RGB')
14    
15    # 解析VOC标注文件
16    tree = ET.parse(annotation_path)
17    root = tree.getroot()
18    boxes = []
19    for obj in root.findall('object'):
20        class_name = obj.find('name').text
21        bbox = obj.find('bndbox')
22        xmin = int(bbox.find('xmin').text)
23        ymin = int(bbox.find('ymin').text)
24        xmax = int(bbox.find('xmax').text)
25        ymax = int(bbox.find('ymax').text)
26        boxes.append([class_name, xmin, ymin, xmax, ymax])
27    return image, boxes
28
29# 展示图像和边界框
30def show_image_with_boxes(image, boxes):
31    img = np.array(image)
32    for box in boxes:
33        class_name, xmin, ymin, xmax, ymax = box
34        cv2.rectangle(img, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)
35        label = f'{class_name}'
36        cv2.putText(img, label, (xmin, ymin - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
37    
38    cv2.imshow('Image with Boxes', img)
39    cv2.waitKey(0)
40    cv2.destroyAllWindows()
41
42# 主函数
43if __name__ == "__main__":
44    subset = 'train'  # 可以选择 'train', 'valid', 或 'test'
45    images_dir = os.path.join(dataset_path, subset, 'images')
46    annotations_dir = os.path.join(dataset_path, subset, 'annotations')
47    
48    # 获取图像列表
49    image_files = [f for f in os.listdir(images_dir) if f.endswith('.jpg')]
50    
51    # 随机选择一张图像
52    selected_image = np.random.choice(image_files)
53    image_path = os.path.join(images_dir, selected_image)
54    annotation_path = os.path.join(annotations_dir, selected_image.replace('.jpg', '.xml'))
55    
56    # 加载图像和边界框
57    image, boxes = load_image_and_boxes(image_path, annotation_path)
58    
59    # 展示带有边界框的图像
60    show_image_with_boxes(image, boxes) 
这段代码展示了如何加载图像和其对应的边界框标注文件,并在图像上绘制边界框。您可以根据实际需求进一步扩展和修改这段代码,以适应您的具体应用场景。
示例代码:使用预训练模型进行推理
以下是使用预训练模型进行推理的示例代码。这里我们假设您使用的是基于YOLOv5的模型,但您可以根据需要选择其他支持目标检测的模型。
1import torch
2import cv2
3import numpy as np
4from PIL import Image
5import yolov5  # 请确保已安装yolov5库
6
7# 数据集路径
8dataset_path = 'path/to/solar_panel_defect_infrared_dataset/'
9
10# 加载预训练模型
11model = yolov5.load('path/to/pretrained/yolov5_weights.pt')  # 替换成实际的预训练模型路径
12model.eval()
13
14# 主函数
15if __name__ == "__main__":
16    subset = 'train'  # 可以选择 'train', 'valid', 或 'test'
17    images_dir = os.path.join(dataset_path, subset, 'images')
18    
19    # 获取图像列表
20    image_files = [f for f in os.listdir(images_dir) if f.endswith('.jpg')]
21    
22    # 随机选择一张图像
23    selected_image = np.random.choice(image_files)
24    image_path = os.path.join(images_dir, selected_image)
25    
26    # 读取并预处理图像
27    image = Image.open(image_path).convert('RGB')
28    
29    # 使用预训练模型进行推理
30    results = model(image)
31    
32    # 处理预测结果
33    boxes = results.xyxy[0].cpu().numpy()
34    
35    # 在图像上绘制边界框
36    img = np.array(image)
37    for box in boxes:
38        xmin, ymin, xmax, ymax, conf, class_id = box
39        class_name = results.names[int(class_id)]
40        label = f'{class_name} {conf:.2f}'
41        cv2.rectangle(img, (int(xmin), int(ymin)), (int(xmax), int(ymax)), (0, 255, 0), 2)
42        cv2.putText(img, label, (int(xmin), int(ymin) - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
43    
44    # 显示结果
45    cv2.imshow('Image with Boxes', img)
46    cv2.waitKey(0)
47    cv2.destroyAllWindows() 
这段代码展示了如何使用预训练的YOLOv5模型进行推理,并显示和保存推理结果。您可以根据实际需求进一步扩展和修改这段代码,以适应您的具体应用场景。如果您需要使用其他模型进行更高级的功能,如模型微调或增量训练,可以参考相应模型的官方文档来进行相应的配置和操作。







![[产品管理-32]:NPDP新产品开发 - 30 - 文化、团队与领导力 - 领导力与团队的可持续发展](https://i-blog.csdnimg.cn/direct/367bd116d6c743f1b85e1dd702d542e2.png)





![[Java并发编程] synchronized(含与ReentrantLock的区别)](https://i-blog.csdnimg.cn/direct/e71b6dbf13de416280461074513e1034.png)





