技术专栏
关于运动跟踪及行人检测数据集的介绍
DanceTrack 运动跟踪数据集
简介
DanceTrack 是一个大规模的多对象跟踪数据集。用于在遮挡、频繁交叉、同样服装和多样化身体姿态条件下对人进行跟踪。强调运动分析在多对象跟踪中的重要性。
GitHub地址:https://github.com/DanceTrack/DanceTrack
数据集下载地址:https://pan.baidu.com/s/19O3IvYNzzrcLqlODHKYUwA
提取码:awew
转为Labelme标注的物体检测数据集格式
import sysimport base64import osimport cv2import shutilimport globmodule_path = os.path.abspath(os.path.join('..'))if module_path not in sys.path:sys.path.append(module_path)import jsonfrom PIL import ImageImage.MAX_IMAGE_PIXELS = NonexmlpathNames_path='../train1/*/gt/gt.txt'xmlpathNames=glob.glob(xmlpathNames_path)print(xmlpathNames)version = '3.16.7'flags = {}lineColor = [0, 255, 0, 128]fillColor = [255, 0, 0, 128]image_t='../images/'os.makedirs(image_t,exist_ok=True)for xmlpathName in xmlpathNames:xmlpathName=xmlpathName.replace("\\","/")dancetrack_name=xmlpathName.split("/")[-3]dic_info = {}with open(xmlpathName) as fs:lines = fs.readlines()lines = sorted(lines)for line in lines:line = line.replace("\n", '')line_info = line.split(',')frame = line_info[0]frame_image_name = '{:0>8d}'.format(int(frame)) + ".jpg"box = [int(line_info[2]), int(line_info[3]), int(line_info[2]) + int(line_info[4]),int(line_info[3]) + int(line_info[5])]if frame_image_name in dic_info:box_list = dic_info[frame_image_name]box_list.append(box)dic_info[frame_image_name] = box_listelse:box_list = [box]dic_info[frame_image_name] = box_listfor image_name in dic_info.keys():dic = {}dic['version'] = versiondic['flags'] = flagsdic['shapes'] = []img_path = "../train1/"+dancetrack_name+"/img1/" + image_nameimg_new_name = dancetrack_name + "_" + image_nameimg_new_path = image_t + img_new_nametry:shutil.copy(img_path, image_t + img_new_name)except :continueimg = cv2.imread(img_new_path)imageHeight, imageWidth, _ = img.shapefor data in dic_info[image_name]:shape = {}shape['label'] = 'person'shape['line_color'] = Noneshape['fill_color'] = Nonex1 = int(data[0])y1 = int(data[1])x2 = int(data[2])y2 = int(data[3])shape['points'] = [[x1, y1], [x2, y2]]shape['shape_type'] = 'rectangle'shape['flags'] = {}dic['shapes'].append(shape)dic['lineColor'] = lineColordic['fillColor'] = fillColordic['imagePath'] = img_new_namedic['imageData'] = base64.b64encode(open('{}'.format(img_new_path), "rb").read()).decode('utf-8')dic['imageHeight'] = imageHeightdic['imageWidth'] = imageWidthfw = open('{}json'.format(img_new_path.replace(img_new_path.split('.')[-1], "")), 'w')json.dump(dic, fw)fw.close()
WiderPerson行人检测数据集
简介
WiderPerson 是关于户外行人检测的基准数据集。该数据集图像场景多样,不再局限于交通场景。该数据集包含 13,382 张图像,40 万个遮挡物的标注,其中 8,000 张图像用于训练,1,000 张图像用于验证,4,382 张图像用于测试。与 CityPersons 和 WIDER FACE 数据集类似,该数据集不公布测试图像的 bounding box ground truth。该数据集包含密集的行人和各种遮挡,适合进行户外环境的行人检测评估。
官网地址:http://www.cbsr.ia.ac.cn/users/sfzhang/WiderPerson/
百度网盘:https://pan.baidu.com/s/1ulMlbw_zhNUYwdyXONLrwg
提取码:uq3u
转为Labelme标注的物体检测数据集格式
import osimport numpy as npimport scipy.io as sioimport shutilfrom lxml.etree import Element, SubElement, tostringfrom xml.dom.minidom import parseStringimport cv2import base64import jsonif __name__ == '__main__':# < class_label =1: pedestrians > 行人# < class_label =2: riders > 骑车的# < class_label =3: partially-visible persons > 遮挡的部分行人# < class_label =4: ignore regions > 一些假人,比如图画上的人# < class_label =5: crowd > 拥挤人群,直接大框覆盖了version = '3.16.7'flags = {}lineColor = [0, 255, 0, 128]fillColor = [255, 0, 0, 128]classes = {'1': 'person','2': 'person','3': 'person','4': 'person','5': 'person',# 不需要哪个类的话直接删去} # 这里如果自己只要人,可以把1-5全标记为people,也可以根据自己场景需要筛选VOCRoot = './images/' # 生成的voc2007的位置os.makedirs(VOCRoot,exist_ok=True)widerDir = './WiderPerson' # widerperson文件夹所在的路径wider_path = './WiderPerson/train.txt' # widerperson文件夹所中训练集+验证集txt标签所在位置with open(wider_path, 'r') as f:imgIds = [x for x in f.read().splitlines()]for imgId in imgIds:objCount = 0 # 一个标志位,用来判断该img是否包含我们需要的标注filename = imgId + '.jpg'img_path = './WiderPerson/images/' + filenamefile_new_name='wider_'+filenameprint('Img :%s' % img_path)img = cv2.imread(img_path)width = img.shape[1] # 获取图片尺寸height = img.shape[0] # 获取图片尺寸 360dic = {}dic['version'] = versiondic['flags'] = flagsdic['shapes'] = []label_path = img_path.replace('images', 'Annotations') + '.txt'with open(label_path) as file:line = file.readline()count = int(line.split('\n')[0]) # 里面行人个数lines = file.readlines()for line in lines:cls_id = line.split(' ')[0]if cls_id not in classes:print(cls_id)continueshape = {}shape['label'] = cls_name = classes[cls_id]shape['line_color'] = Noneshape['fill_color'] = Nonex1 = int(line.split(' ')[1]) + 1y1 = int(line.split(' ')[2]) + 1x2 = int(line.split(' ')[3]) + 1y2 = int(line.split(' ')[4].split('\n')[0]) + 1shape['points'] = [[x1, y1], [x2, y2]]shape['shape_type'] = 'rectangle'shape['flags'] = {}dic['shapes'].append(shape)dic['lineColor'] = lineColordic['fillColor'] = fillColordic['imagePath'] = filenamedic['imageData'] = base64.b64encode(open('{}'.format(img_path), "rb").read()).decode('utf-8')dic['imageHeight'] = heightdic['imageWidth'] = widthsuffix=(VOCRoot + file_new_name).split('.')[-1]fw = open('{}'.format((VOCRoot + file_new_name).replace(suffix,"json")), 'w')json.dump(dic, fw)fw.close()shutil.copy(img_path, VOCRoot + file_new_name)
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
点赞
收藏
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据相关专栏
-
浏览量:5325次2021-02-04 16:47:25
-
浏览量:7002次2024-02-05 10:11:42
-
浏览量:1632次2023-09-08 14:00:44
-
浏览量:1470次2024-03-05 16:55:32
-
浏览量:11630次2021-04-27 00:28:09
-
浏览量:2594次2023-02-17 11:37:20
-
浏览量:2380次2023-04-14 10:12:00
-
浏览量:1268次2023-01-12 17:13:47
-
浏览量:1776次2023-11-18 14:30:59
-
浏览量:6142次2021-05-02 18:00:46
-
浏览量:5977次2021-02-18 16:03:22
-
浏览量:2265次2018-01-17 12:06:58
-
浏览量:954次2023-09-01 11:37:24
-
浏览量:3862次2019-11-13 09:07:39
-
浏览量:2217次2023-10-09 18:13:57
-
浏览量:3752次2023-11-25 17:47:33
-
浏览量:4738次2021-01-28 17:24:58
-
浏览量:1743次2023-08-30 10:30:16
-
浏览量:2532次2024-03-14 18:20:47
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
风清扬
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注

微信扫码分享
QQ好友