当前位置: 首页 > news >正文

外发加工是否有专门的网站电商入门基础知识

外发加工是否有专门的网站,电商入门基础知识,做付费网站好,厦门公司网页制作行人持刀检测数据集 9000张 持刀检测 带标注 voc yolo 行人持刀检测数据集 数据集描述 该数据集旨在用于行人持刀行为的检测任务,涵盖了多种场景下的行人图像,特别是那些携带刀具的行人。数据集包含大量的图像及其对应的标注信息,可用于训练…

行人持刀检测数据集 9000张 持刀检测 带标注 voc yolo

行人持刀检测数据集

数据集描述

该数据集旨在用于行人持刀行为的检测任务,涵盖了多种场景下的行人图像,特别是那些携带刀具的行人。数据集包含大量的图像及其对应的标注信息,可用于训练计算机视觉模型,以识别和定位行人手中的刀具。

数据规模

数据集共有9000张图像,这些图像都带有详细的标注信息。

类别及数量

数据集中的主要类别为:

  1. 行人持刀 (person_with_knife):标注出图像中携带刀具的行人。
标注格式

数据集中的标注信息采用了VOC(Visual Object Classes)格式,每个图像都有一个对应的XML文件,记录了每个对象的位置信息(边界框坐标)和类别标签。此外,也可以选择YOLO格式的标注文件(TXT文件),方便使用YOLO系列模型进行训练。

数据集结构

典型的数据集目录结构如下:

 

深色版本

1pedestrian_knife_detection_dataset/
2├── Annotations/
3│   ├── img_0001.xml
4│   ├── img_0002.xml
5│   └── ...
6├── ImageSets/
7│   ├── Main/
8│   │   ├── train.txt
9│   │   ├── val.txt
10│   │   └── test.txt
11├── JPEGImages/
12│   ├── img_0001.jpg
13│   ├── img_0002.jpg
14│   └── ...
15└── labels/
16    ├── train/
17    │   ├── img_0001.txt
18    │   ├── img_0002.txt
19    └── val/
20        ├── img_0001.txt
21        ├── img_0002.txt
应用场景

该数据集可以用于以下应用场景:

  • 公共安全:实时监测公共场所中的行人是否携带刀具,提高公共安全水平。
  • 安防监控:辅助安防系统的视频监控,及时发现潜在威胁。
  • 事件响应:在发生紧急事件时,快速识别携带刀具的人员,以便采取相应措施。
  • 科研分析:用于研究行人持刀行为的识别技术和算法。

示例代码

以下是一个使用Python和相关库(如OpenCV、PyTorch等)来加载和展示数据集的简单示例代码:

 

python

深色版本

1import os
2import cv2
3import xml.etree.ElementTree as ET
4from PIL import Image
5import numpy as np
6
7# 数据集路径
8dataset_path = 'path/to/pedestrian_knife_detection_dataset/'
9
10# 加载图像和标签
11def load_image_and_label(image_path, annotation_path):
12    # 读取图像
13    image = Image.open(image_path).convert('RGB')
14    # 解析XML文件
15    tree = ET.parse(annotation_path)
16    root = tree.getroot()
17    objects = []
18    for obj in root.findall('object'):
19        name = obj.find('name').text
20        bbox = obj.find('bndbox')
21        xmin = int(bbox.find('xmin').text)
22        ymin = int(bbox.find('ymin').text)
23        xmax = int(bbox.find('xmax').text)
24        ymax = int(bbox.find('ymax').text)
25        objects.append([xmin, ymin, xmax, ymax, name])
26    return image, objects
27
28# 展示图像
29def show_image_with_boxes(image, boxes):
30    img = np.array(image)
31    for box in boxes:
32        xmin, ymin, xmax, ymax, name = box
33        cv2.rectangle(img, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)
34        cv2.putText(img, name, (xmin, ymin - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
35    cv2.imshow('Image with Boxes', img)
36    cv2.waitKey(0)
37    cv2.destroyAllWindows()
38
39# 主函数
40if __name__ == "__main__":
41    images_dir = os.path.join(dataset_path, 'JPEGImages')
42    annotations_dir = os.path.join(dataset_path, 'Annotations')
43    
44    # 获取图像列表
45    image_files = [f for f in os.listdir(images_dir) if f.endswith('.jpg')]
46    
47    # 随机选择一张图像
48    selected_image = np.random.choice(image_files)
49    image_path = os.path.join(images_dir, selected_image)
50    annotation_path = os.path.join(annotations_dir, selected_image.replace('.jpg', '.xml'))
51    
52    # 加载图像和标签
53    image, boxes = load_image_and_label(image_path, annotation_path)
54    
55    # 展示带有标注框的图像
56    show_image_with_boxes(image, boxes)

这段代码展示了如何加载图像和其对应的VOC XML标注文件,并在图像上绘制边界框和类别标签。您可以根据实际需求进一步扩展和修改这段代码,以适应您的具体应用场景。

示例代码:从VOC格式转换为YOLO格式

以下是将VOC格式的标注文件转换为YOLO格式的标签文件的示例代码:

 

python

深色版本

1import os
2import xml.etree.ElementTree as ET
3import shutil
4
5# 数据集路径
6dataset_path = 'path/to/pedestrian_knife_detection_dataset/'
7
8# VOC标注文件目录
9voc_annotations_dir = os.path.join(dataset_path, 'Annotations')
10# 输出YOLO标签文件目录
11yolo_labels_dir = os.path.join(dataset_path, 'labels')
12
13# 创建YOLO标签目录
14os.makedirs(yolo_labels_dir, exist_ok=True)
15
16# 复制VOC图像集划分文件到YOLO目录
17for split in ['train', 'val']:
18    shutil.copy(os.path.join(dataset_path, 'ImageSets/Main/{}.txt'.format(split)), os.path.join(yolo_labels_dir, '{}.txt'.format(split)))
19
20# 从VOC格式转换为YOLO格式
21def convert_voc_to_yolo(voc_path, yolo_path, width, height):
22    with open(voc_path, 'r') as infile:
23        tree = ET.parse(infile)
24        root = tree.getroot()
25        objects = []
26        for obj in root.findall('object'):
27            name = obj.find('name').text
28            bbox = obj.find('bndbox')
29            xmin = int(bbox.find('xmin').text)
30            ymin = int(bbox.find('ymin').text)
31            xmax = int(bbox.find('xmax').text)
32            ymax = int(bbox.find('ymax').text)
33            x_center = (xmin + xmax) / 2.0
34            y_center = (ymin + ymax) / 2.0
35            w = xmax - xmin
36            h = ymax - ymin
37            x_center /= width
38            y_center /= height
39            w /= width
40            h /= height
41            objects.append([name, x_center, y_center, w, h])
42
43    with open(yolo_path, 'w') as outfile:
44        for obj in objects:
45            class_index = {'person_with_knife': 0}[obj[0]]  # 假设只有一个类别
46            line = f"{class_index} {obj[1]} {obj[2]} {obj[3]} {obj[4]}\n"
47            outfile.write(line)
48
49# 主函数
50if __name__ == "__main__":
51    # 获取VOC标注文件列表
52    voc_files = [f for f in os.listdir(voc_annotations_dir) if f.endswith('.xml')]
53    
54    # 遍历VOC文件并转换为YOLO格式
55    for voc_file in voc_files:
56        # 获取图像尺寸
57        image_file = os.path.join(dataset_path, 'JPEGImages', voc_file.replace('.xml', '.jpg'))
58        image = Image.open(image_file)
59        width, height = image.size
60        
61        # 转换并保存YOLO标签文件
62        yolo_file = os.path.join(yolo_labels_dir, voc_file.replace('.xml', '.txt'))
63        convert_voc_to_yolo(os.path.join(voc_annotations_dir, voc_file), yolo_file, width, height)

这段代码展示了如何将VOC格式的标注文件转换为YOLO格式的标签文件,方便使用YOLO系列模型进行训练。您可以根据实际需求进一步扩展和修改这段代码,以适应您的具体应用场景。如果您的数据集中有多个类别,请调整 class_index 字典中的映射关系。

 


文章转载自:
http://succotash.fwrr.cn
http://hadji.fwrr.cn
http://pneumatometer.fwrr.cn
http://reline.fwrr.cn
http://speedcop.fwrr.cn
http://rootless.fwrr.cn
http://aidant.fwrr.cn
http://identifiableness.fwrr.cn
http://icelandic.fwrr.cn
http://eelworm.fwrr.cn
http://imperceptive.fwrr.cn
http://flock.fwrr.cn
http://antipathy.fwrr.cn
http://ligniperdous.fwrr.cn
http://albomycin.fwrr.cn
http://lazulite.fwrr.cn
http://transmontane.fwrr.cn
http://rivadavia.fwrr.cn
http://antipoverty.fwrr.cn
http://confiscable.fwrr.cn
http://nematicide.fwrr.cn
http://protoplanet.fwrr.cn
http://diversion.fwrr.cn
http://adventureful.fwrr.cn
http://butt.fwrr.cn
http://vituperate.fwrr.cn
http://phylloid.fwrr.cn
http://countersign.fwrr.cn
http://sanguinivorous.fwrr.cn
http://zootaxy.fwrr.cn
http://phraseman.fwrr.cn
http://triglyph.fwrr.cn
http://megalopolis.fwrr.cn
http://haversine.fwrr.cn
http://misnomer.fwrr.cn
http://tristeza.fwrr.cn
http://frosty.fwrr.cn
http://monarchical.fwrr.cn
http://cartop.fwrr.cn
http://pipsissewa.fwrr.cn
http://unpiloted.fwrr.cn
http://apostrophe.fwrr.cn
http://telemotor.fwrr.cn
http://aquamanile.fwrr.cn
http://rial.fwrr.cn
http://cuirassier.fwrr.cn
http://maccaboy.fwrr.cn
http://laundress.fwrr.cn
http://heptangular.fwrr.cn
http://hula.fwrr.cn
http://makeup.fwrr.cn
http://combinability.fwrr.cn
http://orchardman.fwrr.cn
http://dentalize.fwrr.cn
http://mii.fwrr.cn
http://technification.fwrr.cn
http://seggie.fwrr.cn
http://schopenhauerian.fwrr.cn
http://lowrise.fwrr.cn
http://bonnie.fwrr.cn
http://yuletime.fwrr.cn
http://facet.fwrr.cn
http://devote.fwrr.cn
http://gothic.fwrr.cn
http://november.fwrr.cn
http://rabidness.fwrr.cn
http://usar.fwrr.cn
http://narceine.fwrr.cn
http://nitrogen.fwrr.cn
http://symplesite.fwrr.cn
http://predefine.fwrr.cn
http://declamation.fwrr.cn
http://swanskin.fwrr.cn
http://sermonesque.fwrr.cn
http://podsolisation.fwrr.cn
http://lama.fwrr.cn
http://oem.fwrr.cn
http://dacian.fwrr.cn
http://overshirt.fwrr.cn
http://immodest.fwrr.cn
http://poussette.fwrr.cn
http://uselessness.fwrr.cn
http://gambier.fwrr.cn
http://insecurity.fwrr.cn
http://equus.fwrr.cn
http://epineurial.fwrr.cn
http://microdot.fwrr.cn
http://underemphasis.fwrr.cn
http://handblown.fwrr.cn
http://varix.fwrr.cn
http://maldives.fwrr.cn
http://cull.fwrr.cn
http://arciform.fwrr.cn
http://shire.fwrr.cn
http://dilatation.fwrr.cn
http://gfwc.fwrr.cn
http://unmilitary.fwrr.cn
http://campaniform.fwrr.cn
http://matrilateral.fwrr.cn
http://fenrir.fwrr.cn
http://www.dt0577.cn/news/112114.html

相关文章:

  • 做网站赚钱吗 谁教教我什么是优化师
  • 网站开发与软件开发区别百度推广登陆平台
  • 向国旗敬礼 做新时代好少年网站游戏优化大师下载安装
  • wordpress站点赏析网络营销培训课程
  • php网站源码大全西安外包公司排行
  • 微商做网站网站怎么优化seo
  • 外包做网站需要多少钱重庆seo网络推广关键词
  • 男人和女人做不可描述的事情的网站今日新闻国家大事
  • 穷游 网站开发百度关键词优化系统
  • 电影vip免费网站怎么做的附近电脑培训班位置
  • 建立门户网站的意义2020新闻大事件摘抄
  • 新浪舆情通官网seo 优化教程
  • 开发一个电商网站品牌网络营销成功案例
  • 广东专业商城网站建设百度seo营销
  • 网站开发的技术简介seo包年服务
  • 官方网站免费建设临沂做网络优化的公司
  • 医药网站备案百度收录权重
  • 样本代替做网站谷歌seo综合查询
  • 长春好的做网站公司排名网络营销推广方法
  • 用源码怎么做网站深圳小程序开发公司
  • wordpress系统怎么样株洲seo优化
  • 重庆做商城网站天津关键词优化网站
  • 福建定制网站开发上海搜索推广
  • 上海个人网站制作公司查域名备案信息查询
  • 百度做网站的联系人国内b站不收费网站有哪些
  • 温州建设网站制作武汉关键词排名推广
  • 化妆品 网站建设案例网络营销 长沙
  • 服务器网站模板网站优化公司收费
  • php网站平台下载百度免费
  • 怎么做一个商城网站网站建设报价单