# -*- coding:utf-8 -*-
import os
import xml.etree.ElementTree as ET
import numpy as np
np.set_printoptions(suppress=True, threshold=1000000)
import matplotlib
from PIL import Image
def parse_obj(xml_path, filename):
tree = ET.parse(xml_path + filename)
objects = []
for obj in tree.findall('object'):
obj_struct = {}
obj_struct['name'] = obj.find('name').text
objects.append(obj_struct)
return objects
def read_image(image_path, filename):
im = Image.open(image_path + filename)
W = im.size[0]
H = im.size[1]
area = W * H
im_info = [W, H, area]
return im_info
if __name__ == '__main__':
xml_path = './Annotations/'
filenamess = os.listdir(xml_path)
filenames = []
for name in filenamess:
name = name.replace('.xml', '')
filenames.append(name)
recs = {}
obs_shape = {}
classnames = []
num_objs = {}
obj_avg = {}
for i, name in enumerate(filenames):
recs[name] = parse_obj(xml_path, name + '.xml')
for name in filenames:
for object in recs[name]:
if object['name'] not in num_objs.keys():
num_objs[object['name']] = 1
else:
num_objs[object['name']] += 1
if object['name'] not in classnames:
classnames.append(object['name'])
for name in classnames:
print('{}:{}个'.format(name, num_objs[name]))
print('信息统计算完毕。')
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
道路病害数据集.详细:https://blog.csdn.net/qq_34717531/article/details/139122956?spm=1001.2014.3001.5502。该数据集分为二个部分,JPEGImages和Annotations。 道路病害数据集提供了一个全面而且精确的资源库,用于道路病害检测技术的开发和验证。该数据集包含超过23,000+张高质量的道路病害图像,这些图像涵盖了从城市街道到乡村道路,从高速公路到住宅区的各种道路场景。这样的多样化确保了数据集的广泛适用性和高实用性。 每张图片都经过了精心挑选,并且使用了labelimg工具进行了详细的人工标注。标注信息以XML文件格式存储在Annotations文件夹中,每个文件详细记录了图像中各种病害的位置、类型和其他相关属性,这为使用机器学习和深度学习模型进行道路病害识别提供了必要的地面真相数据。 JPEGImages文件夹内的图像质量高,清晰度好,这对于确保模型能够准确识别和学习道路病害特征至关重要。 免去了收集,挑选,标注道路病害图片的时间,可直接进行工程化应用。
资源推荐
资源详情
资源评论
收起资源包目录
优质道路病害数据集3.zip (2000个子文件)
leishu1.py 1KB
说明.txt 144B
04467.xml 4KB
China_MotorBike_000151.xml 4KB
China_MotorBike_000801.xml 3KB
05701.xml 3KB
China_MotorBike_000296.xml 3KB
China_MotorBike_000195.xml 3KB
China_MotorBike_000976.xml 3KB
04476.xml 2KB
04886.xml 2KB
04936.xml 2KB
04155.xml 2KB
China_MotorBike_000349.xml 2KB
05589.xml 2KB
05392.xml 2KB
04501.xml 2KB
05148.xml 2KB
04285.xml 2KB
05992.xml 2KB
China_MotorBike_000584.xml 2KB
China_MotorBike_000542.xml 2KB
China_MotorBike_000161.xml 2KB
China_MotorBike_000336.xml 2KB
China_MotorBike_000177.xml 2KB
04881.xml 2KB
05326.xml 2KB
04265.xml 2KB
05285.xml 2KB
04240.xml 2KB
05144.xml 2KB
05233.xml 2KB
05790.xml 2KB
04717.xml 2KB
05617.xml 2KB
04712.xml 2KB
05532.xml 2KB
05480.xml 2KB
China_MotorBike_000819.xml 2KB
China_MotorBike_000319.xml 2KB
China_MotorBike_000406.xml 2KB
China_MotorBike_000469.xml 2KB
China_MotorBike_000188.xml 2KB
China_MotorBike_000920.xml 2KB
China_MotorBike_000971.xml 2KB
China_MotorBike_000091.xml 2KB
China_MotorBike_000783.xml 2KB
China_MotorBike_000791.xml 2KB
China_MotorBike_000895.xml 2KB
China_MotorBike_000769.xml 2KB
China_MotorBike_000788.xml 2KB
China_MotorBike_000658.xml 2KB
China_MotorBike_000112.xml 2KB
China_MotorBike_000284.xml 2KB
China_MotorBike_000958.xml 2KB
04400.xml 2KB
05247.xml 2KB
04619.xml 2KB
05512.xml 2KB
05065.xml 2KB
05419.xml 2KB
05125.xml 2KB
05835.xml 2KB
05407.xml 2KB
05644.xml 2KB
China_MotorBike_000397.xml 2KB
05010.xml 2KB
05163.xml 2KB
05627.xml 2KB
China_MotorBike_000965.xml 2KB
China_MotorBike_000029.xml 2KB
China_MotorBike_000339.xml 2KB
China_MotorBike_000295.xml 2KB
China_MotorBike_000881.xml 2KB
China_MotorBike_000243.xml 2KB
China_MotorBike_000471.xml 2KB
China_MotorBike_000266.xml 2KB
China_MotorBike_000424.xml 2KB
China_MotorBike_000042.xml 2KB
China_MotorBike_000299.xml 2KB
China_MotorBike_000890.xml 2KB
04582.xml 1KB
05895.xml 1KB
05223.xml 1KB
04591.xml 1KB
05694.xml 1KB
04190.xml 1KB
05960.xml 1KB
05649.xml 1KB
05035.xml 1KB
05119.xml 1KB
04250.xml 1KB
04829.xml 1KB
04757.xml 1KB
05524.xml 1KB
China_MotorBike_000393.xml 1KB
05846.xml 1KB
05234.xml 1KB
04498.xml 1KB
04228.xml 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
学术菜鸟小晨
- 粉丝: 1w+
- 资源: 5001
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功