关于运动跟踪及行人检测数据集的介绍

关于运动跟踪及行人检测数据集的介绍 风清扬 2023-06-08 09:42:33 493

DanceTrack 运动跟踪数据集

简介

DanceTrack 是一个大规模的多对象跟踪数据集。用于在遮挡、频繁交叉、同样服装和多样化身体姿态条件下对人进行跟踪。强调运动分析在多对象跟踪中的重要性。
在这里插入图片描述

GitHub地址:https://github.com/DanceTrack/DanceTrack
数据集下载地址:https://pan.baidu.com/s/19O3IvYNzzrcLqlODHKYUwA
提取码:awew

转为Labelme标注的物体检测数据集格式
  1. import sys
  2. import base64
  3. import os
  4. import cv2
  5. import shutil
  6. import glob
  7. module_path = os.path.abspath(os.path.join('..'))
  8. if module_path not in sys.path:
  9. sys.path.append(module_path)
  10. import json
  11. from PIL import Image
  12. Image.MAX_IMAGE_PIXELS = None
  13. xmlpathNames_path='../train1/*/gt/gt.txt'
  14. xmlpathNames=glob.glob(xmlpathNames_path)
  15. print(xmlpathNames)
  16. version = '3.16.7'
  17. flags = {}
  18. lineColor = [0, 255, 0, 128]
  19. fillColor = [255, 0, 0, 128]
  20. image_t='../images/'
  21. os.makedirs(image_t,exist_ok=True)
  22. for xmlpathName in xmlpathNames:
  23. xmlpathName=xmlpathName.replace("\\","/")
  24. dancetrack_name=xmlpathName.split("/")[-3]
  25. dic_info = {}
  26. with open(xmlpathName) as fs:
  27. lines = fs.readlines()
  28. lines = sorted(lines)
  29. for line in lines:
  30. line = line.replace("\n", '')
  31. line_info = line.split(',')
  32. frame = line_info[0]
  33. frame_image_name = '{:0>8d}'.format(int(frame)) + ".jpg"
  34. box = [int(line_info[2]), int(line_info[3]), int(line_info[2]) + int(line_info[4]),
  35. int(line_info[3]) + int(line_info[5])]
  36. if frame_image_name in dic_info:
  37. box_list = dic_info[frame_image_name]
  38. box_list.append(box)
  39. dic_info[frame_image_name] = box_list
  40. else:
  41. box_list = [box]
  42. dic_info[frame_image_name] = box_list
  43. for image_name in dic_info.keys():
  44. dic = {}
  45. dic['version'] = version
  46. dic['flags'] = flags
  47. dic['shapes'] = []
  48. img_path = "../train1/"+dancetrack_name+"/img1/" + image_name
  49. img_new_name = dancetrack_name + "_" + image_name
  50. img_new_path = image_t + img_new_name
  51. try:
  52. shutil.copy(img_path, image_t + img_new_name)
  53. except :
  54. continue
  55. img = cv2.imread(img_new_path)
  56. imageHeight, imageWidth, _ = img.shape
  57. for data in dic_info[image_name]:
  58. shape = {}
  59. shape['label'] = 'person'
  60. shape['line_color'] = None
  61. shape['fill_color'] = None
  62. x1 = int(data[0])
  63. y1 = int(data[1])
  64. x2 = int(data[2])
  65. y2 = int(data[3])
  66. shape['points'] = [[x1, y1], [x2, y2]]
  67. shape['shape_type'] = 'rectangle'
  68. shape['flags'] = {}
  69. dic['shapes'].append(shape)
  70. dic['lineColor'] = lineColor
  71. dic['fillColor'] = fillColor
  72. dic['imagePath'] = img_new_name
  73. dic['imageData'] = base64.b64encode(
  74. open('{}'.format(img_new_path), "rb").read()).decode('utf-8')
  75. dic['imageHeight'] = imageHeight
  76. dic['imageWidth'] = imageWidth
  77. fw = open('{}json'.format(img_new_path.replace(img_new_path.split('.')[-1], "")), 'w')
  78. json.dump(dic, fw)
  79. 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标注的物体检测数据集格式
  1. import os
  2. import numpy as np
  3. import scipy.io as sio
  4. import shutil
  5. from lxml.etree import Element, SubElement, tostring
  6. from xml.dom.minidom import parseString
  7. import cv2
  8. import base64
  9. import json
  10. if __name__ == '__main__':
  11. # < class_label =1: pedestrians > 行人
  12. # < class_label =2: riders > 骑车的
  13. # < class_label =3: partially-visible persons > 遮挡的部分行人
  14. # < class_label =4: ignore regions > 一些假人,比如图画上的人
  15. # < class_label =5: crowd > 拥挤人群,直接大框覆盖了
  16. version = '3.16.7'
  17. flags = {}
  18. lineColor = [0, 255, 0, 128]
  19. fillColor = [255, 0, 0, 128]
  20. classes = {'1': 'person',
  21. '2': 'person',
  22. '3': 'person',
  23. '4': 'person',
  24. '5': 'person',
  25. # 不需要哪个类的话直接删去
  26. } # 这里如果自己只要人,可以把1-5全标记为people,也可以根据自己场景需要筛选
  27. VOCRoot = './images/' # 生成的voc2007的位置
  28. os.makedirs(VOCRoot,exist_ok=True)
  29. widerDir = './WiderPerson' # widerperson文件夹所在的路径
  30. wider_path = './WiderPerson/train.txt' # widerperson文件夹所中训练集+验证集txt标签所在位置
  31. with open(wider_path, 'r') as f:
  32. imgIds = [x for x in f.read().splitlines()]
  33. for imgId in imgIds:
  34. objCount = 0 # 一个标志位,用来判断该img是否包含我们需要的标注
  35. filename = imgId + '.jpg'
  36. img_path = './WiderPerson/images/' + filename
  37. file_new_name='wider_'+filename
  38. print('Img :%s' % img_path)
  39. img = cv2.imread(img_path)
  40. width = img.shape[1] # 获取图片尺寸
  41. height = img.shape[0] # 获取图片尺寸 360
  42. dic = {}
  43. dic['version'] = version
  44. dic['flags'] = flags
  45. dic['shapes'] = []
  46. label_path = img_path.replace('images', 'Annotations') + '.txt'
  47. with open(label_path) as file:
  48. line = file.readline()
  49. count = int(line.split('\n')[0]) # 里面行人个数
  50. lines = file.readlines()
  51. for line in lines:
  52. cls_id = line.split(' ')[0]
  53. if cls_id not in classes:
  54. print(cls_id)
  55. continue
  56. shape = {}
  57. shape['label'] = cls_name = classes[cls_id]
  58. shape['line_color'] = None
  59. shape['fill_color'] = None
  60. x1 = int(line.split(' ')[1]) + 1
  61. y1 = int(line.split(' ')[2]) + 1
  62. x2 = int(line.split(' ')[3]) + 1
  63. y2 = int(line.split(' ')[4].split('\n')[0]) + 1
  64. shape['points'] = [[x1, y1], [x2, y2]]
  65. shape['shape_type'] = 'rectangle'
  66. shape['flags'] = {}
  67. dic['shapes'].append(shape)
  68. dic['lineColor'] = lineColor
  69. dic['fillColor'] = fillColor
  70. dic['imagePath'] = filename
  71. dic['imageData'] = base64.b64encode(
  72. open('{}'.format(img_path), "rb").read()).decode('utf-8')
  73. dic['imageHeight'] = height
  74. dic['imageWidth'] = width
  75. suffix=(VOCRoot + file_new_name).split('.')[-1]
  76. fw = open('{}'.format((VOCRoot + file_new_name).replace(suffix,"json")), 'w')
  77. json.dump(dic, fw)
  78. fw.close()
  79. shutil.copy(img_path, VOCRoot + file_new_name)
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包 点赞 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
关于作者
风清扬

风清扬

暂无个性签名~

原创10
阅读6.5k
收藏0
点赞1
评论0
打赏用户 0
我要创作
分享技术经验,可获取创作收益
分类专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
风清扬
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区