智慧工业防护数据集,收集各种工业环境,高质量图像(超过8000张最低1080p)丰富的标注实例(超过7万个标注),标注类型包括人,头,脸,眼镜,医用口罩,面罩,耳朵,耳罩,手部,手套,脚,鞋,安全马甲,工具,安全帽,医用服装,安全服共17类别,基本涵盖所有工业场景下搜集的图像,共14GB数据量,voc和yolo格式都有
智慧工业防护数据集介绍
名称
、
智慧工业防护数据集
规模
- 图像数量:超过8000张高质量图像,最低分辨率为1080p。
- 标注实例:超过7万个详细的标注实例。
- 数据量:约14GB。
标注类型
- 人 (Person)
- 头 (Head)
- 脸 (Face)
- 眼镜 (Glasses)
- 医用口罩 (Medical Mask)
- 面罩 (Face Shield)
- 耳朵 (Ear)
- 耳罩 (Ear Muff)
- 手部 (Hand)
- 手套 (Glove)
- 脚 (Foot)
- 鞋 (Shoe)
- 安全马甲 (Safety Vest)
- 工具 (Tool)
- 安全帽 (Helmet)
- 医用服装 (Medical Clothing)
- 安全服 (Safety Clothing)
数据特点
- 多样性:数据集涵盖了多种工业环境,包括但不限于工厂、车间、仓库等,确保模型能够适应不同的实际场景。
- 高分辨率:所有图像均为1080p或更高分辨率,提供了丰富的细节信息,有助于提高检测精度。
- 丰富标注:每张图像都附带了详细的标注信息,包括边界框和类别标签。标注类型覆盖了个人防护装备(PPE)的各个方面,适用于全面的安全监测。
- 多格式支持:数据集同时提供了VOC和YOLO两种标注格式,方便不同框架和库的使用。
应用场景
- 安全监控:自动检测工人是否正确佩戴个人防护装备,如安全帽、手套、口罩等。
- 合规性检查:帮助企业确保工作场所符合安全标准和法规要求。
- 事故预防:通过实时监测和预警系统,减少潜在的安全风险。
- 培训与教育:用于安全培训课程,展示正确的PPE穿戴方式。
- 智能工厂:集成到智能工厂管理系统中,提升整体安全管理水平。
代码示例
下面是一个简单的Python脚本示例,展示如何加载和可视化这些数据集的一部分。我们将使用OpenCV来读取图像,并使用xml.etree.ElementTree
来解析VOC格式的标注文件。此外,我们还将提供一个简化的YOLO格式标注的处理方法。
加载和显示VOC格式的数据
import os
import cv2
from xml.etree import ElementTree as ET
def parse_voc_annotation(xml_file):
tree = ET.parse(xml_file)
root = tree.getroot()
boxes = []
labels = []
for obj in root.findall('object'):
label = obj.find('name').text
bndbox = obj.find('bndbox')
xmin = int(bndbox.find('xmin').text)
ymin = int(bndbox.find('ymin').text)
xmax = int(bndbox.find('xmax').text)
ymax = int(bndbox.find('ymax').text)
boxes.append([xmin, ymin, xmax, ymax])
labels.append(label)
return boxes, labels
def load_voc_data(image_dir, annotation_dir):
images = []
annotations = []
for filename in os.listdir(image_dir):
if filename.endswith('.jpg') or filename.endswith('.png'):
# 加载图像
img_path = os.path.join(image_dir, filename)
image = cv2.imread(img_path)
# 加载对应的annotation
annotation_filename = filename.replace('.jpg', '.xml').replace('.png', '.xml')
annotation_path = os.path.join(annotation_dir, annotation_filename)
boxes, labels = parse_voc_annotation(annotation_path)
images.append(image)
annotations.append((boxes, labels))
return images, annotations
# 假设图像和标注文件分别存储在'image'和'annotation'目录下
image_dir = 'path_to_your_image_directory'
annotation_dir = 'path_to_your_annotation_directory'
images, annotations = load_voc_data(image_dir, annotation_dir)
# 显示第一张图像及其对应的标注框
img = images[0]
boxes, labels = annotations[0]
for box, label in zip(boxes, labels):
cv2.rectangle(img, (box[0], box[1]), (box[2], box[3]), (0, 255, 0), 2)
cv2.putText(img, label, (box[0], box[1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
cv2.imshow('Image with Annotations', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
加载和显示YOLO格式的数据
python
深色版本
def parse_yolo_annotation(txt_file, image_width, image_height):
with open(txt_file, 'r') as f:
lines = f.readlines()
boxes = []
labels = []
for line in lines:
class_id, x_center, y_center, width, height = map(float, line.strip().split())
x_center, y_center, width, height = x_center * image_width, y_center * image_height, width * image_width, height * image_height
xmin = int(x_center - width / 2)
ymin = int(y_center - height / 2)
xmax = int(x_center + width / 2)
ymax = int(y_center + height / 2)
boxes.append([xmin, ymin, xmax, ymax])
labels.append(class_id)
return boxes, labels
def load_yolo_data(image_dir, annotation_dir):
images = []
annotations = []
for filename in os.listdir(image_dir):
if filename.endswith('.jpg') or filename.endswith('.png'):
# 加载图像
img_path = os.path.join(image_dir, filename)
image = cv2.imread(img_path)
image_height, image_width, _ = image.shape
# 加载对应的annotation
annotation_filename = filename.replace('.jpg', '.txt').replace('.png', '.txt')
annotation_path = os.path.join(annotation_dir, annotation_filename)
boxes, labels = parse_yolo_annotation(annotation_path, image_width, image_height)
images.append(image)
annotations.append((boxes, labels))
return images, annotations
# 假设图像和标注文件分别存储在'image'和'annotation'目录下
image_dir = 'path_to_your_image_directory'
annotation_dir = 'path_to_your_annotation_directory'
images, annotations = load_yolo_data(image_dir, annotation_dir)
# 显示第一张图像及其对应的标注框
img = images[0]
boxes, labels = annotations[0]
for box, label in zip(boxes, labels):
cv2.rectangle(img, (box[0], box[1]), (box[2], box[3]), (0, 255, 0), 2)
cv2.putText(img, str(int(label)), (box[0], box[1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (36, 255, 12), 2)
cv2.imshow('Image with Annotations', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
说明
- 路径设置:请根据实际的数据集路径调整
path_to_your_image_directory
和path_to_your_annotation_directory
。 - 文件命名:假设图像文件名分别为
.jpg
或.png
,对应的VOC标注文件为.xml
,YOLO标注文件为.txt
。如果实际命名规则不同,请相应修改代码。 - 可视化:通过绘制边界框和标签,可以直观地看到图像中的标注信息。
这个数据集对于开发和训练高效的工业安全监控系统具有重要的价值,能够帮助企业在保障员工安全的同时,提高生产效率。