参考博客链接:

  1. https://blog.csdn.net/a2008301610258/article/details/45873867
  2. https://github.com/hizhangp/caltech-pedestrian-converter
  3. http://www.kanadas.com/program-e/2015/06/converting_caltech_pedestrian.html

需要实现的功能:

  1. 将seq格式的视频文件提取图片,保存为.jpg格式的图片。
  2. 将vbb格式的bounding box标注文件转换为txt文件,供darknet,caffe-ssd等模型进行训练。

目的:训练yolov3和yolo-v3-tiny,需要大规模的行人检测数据集,因此就选到了Caltech Pedestrian Detection这个数据集。

从seq格式文件提取图片并保存

#-*-coding:utf-8-*-
import os
import numpy as np
import cv2
import os.path
import fnmatch
import shutildef open_save(file,savepath):# read .seq file, and save the images into the savepathf = open(file,'rb')string = str(f.read())splitstring = "\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46"# split .seq file into segment with the image prefixstrlist=string.split(splitstring)f.close()count = 0# delete the image folder path if it existsif os.path.exists(savepath):shutil.rmtree(savepath)# create the image folder pathif not os.path.exists(savepath):os.mkdir(savepath)# deal with file segment, every segment is an image except the first onefor img in strlist:filename = str(count)+'.jpg'filenamewithpath=os.path.join(savepath, filename)# abandon the first one, which is filled with .seq headerif count > 0:i=open(filenamewithpath,'wb+')i.write(splitstring)i.write(img)i.close()count += 1if __name__=="__main__":for i in range(11):rootdir = "./set{:02}/".format(i)print rootdir# walk in the rootdir, take down the .seq filename and filepathfor parent, dirnames, filenames in os.walk(rootdir):for filename in filenames:# check .seq file with suffixif fnmatch.fnmatch(filename,'*.seq'):# take down the filename with path of .seq filethefilename = os.path.join(parent, filename)# create the image folder by combining .seq file path with .seq filenamethesavepath = os.path.join(parent, filename.split('.')[0])print("Filename=" + thefilename)print("Savepath=" + thesavepath)open_save(thefilename,thesavepath)

效果:提取出set00/V000/1.jpg这样命令的图片,这里的图片id和下面生成的bbx的id是一一对应的

从vbb格式文件提取出bounding box

clear
clc
root_dir = 'E:/唐圣钦/person/annotations/';
path1 = dir(root_dir);
for i=3:length(path1)dir1 = path1(i).name;path2 = dir([ root_dir , dir1])for j=3:length(path2)ful_path = [root_dir, dir1, '/', path2(j).name]temp = strsplit(ful_path, '.');save_path = strcat(temp(1), '.txt');save_path = save_path{1}A = vbb('vbbLoad', ful_path );c=fopen(save_path, 'w');for i = 1:A.nFrameiframe = A.objLists(1,i);iframe_data = iframe{1,1};n1length = length(iframe_data);for  j = 1:n1lengthiframe_dataj = iframe_data(j);if iframe_dataj.pos(1) ~= 0  %pos  posvfprintf(c,'%d %f %f %f %f\n', i, iframe_dataj.pos(1),iframe_dataj.pos(2),iframe_dataj.pos(3),iframe_dataj.pos(4));endendendfclose(c);end
end

效果:生成annotations/set00/V000.txt这样的txt文件, 格式:id, x, y, w, h (x,y为左上角坐标)

Caltech Pedestrian Detection数据的预处理相关推荐

  1. 行人检测(Pedestrian Detection)资源

    行人检测(Pedestrian Detection)资源 原文链接 http://hi.baidu.com/susongzhi/item/085983081b006311eafe38e7 一.论文 C ...

  2. 【计算机视觉】论文笔记:Ten years of pedestrian detection, what have we learned?

    最近正在研究行人检测,学习了一篇2014年发表在ECCV上的一篇综述性的文章,是对行人检测过去十年的一个回顾,从dataset,main approaches的角度分析了近10年的40多篇论文提出的方 ...

  3. 行人检测(Pedestrian Detection)资源与更新

    行人检测相关的网站链接:      [1].Caltech Pedestrian Detection Benchmark: http://www.vision.caltech.edu/Image_Da ...

  4. Pedestrian Detection paper

    一.论文 综述类的文章 [1]P.Dollar, C. Wojek,B. Schiele, et al. Pedestrian detection: an evaluation of the stat ...

  5. NMS by Representative Region: Towards Crowded Pedestrian Detection by Proposal Pairing

    NMS by Representative Region: Towards Crowded Pedestrian Detection by Proposal Pairing Abstract 1. I ...

  6. 转:行人检测(Pedestrian Detection)资源

    .论文 CVPR 2012 与行人检测相关的论文 [1] Contextual Boost for Pedestrian Detection  YuanyuanDing, Jing Xiao [2]  ...

  7. F2DNet: Fast Focal Detection Network for Pedestrian Detection

    F2DNet 论文标题:F2DNet: Fast Focal Detection Network for Pedestrian Detection 论文地址:https://arxiv.org/abs ...

  8. 行人检测--What Can Help Pedestrian Detection?

    What Can Help Pedestrian Detection? CVPR2017 本文主要分析 extra features 对于 基于CNN 的行人检测有什么帮助,设计了一个行人检测网络 H ...

  9. Crosstalk Cascades for Frame-Rate Pedestrian Detection 阅读笔记

    Crosstalk Cascades for Frame-Rate Pedestrian Detection (目的:逐步减少输入检测框数量) 1 介绍 (说明已存在方法很慢,引出本文的算法.略... ...

最新文章

  1. 技术图文:如何利用C#实现Huffman编码?
  2. 邮箱@topgrid.cn是什么网站_典 藏 网 站 !
  3. 【 Notes 】INS Preliminary Introduction
  4. JZOJ 4910. 【NOIP2017模拟12.3】子串
  5. HTML 5 Web 存储-localStorage
  6. 某狸子订单系统豪华版/商城/前台程序/会员模块/增加分销模块
  7. 添加的oracle语句,Oracle中Insert语句的总结
  8. JSP 九大内置对象及作用域(源码刨析,建议收藏)
  9. 第一次个人项目【词频统计】——PSP表格
  10. android 开发套件_Android套件
  11. WEB前端、后端的说明
  12. Qt Building the android package failed! 构建失败
  13. OBS录制的时候黑屏怎么办
  14. EcShop二次开发学习方法和Ecshop二次开发必备基础
  15. markdowm快捷键学习
  16. 测试结果OK、NG、NT、POK的意思
  17. Ubuntu系统shipyard安装
  18. 关于Linux中的SIGABRT信号
  19. 数据库基本知识-总结
  20. OpenCV cvBoundingRect应用举例

热门文章

  1. 一个免费的FLV编码工具(以及免费的FLV播放器)
  2. 动态内存的申请和释放
  3. 关于Docker文件系统
  4. IE浏览器中 img ... /标签不显示图片
  5. 使用css做一个右向的三角箭头
  6. ActiviteMQ 对于Consumers pending的限制问题
  7. 滴水逆向win32学习笔记1
  8. 【1312】【例3.4】昆虫繁殖
  9. 中国地表水体、大坝、水库和湖泊数据集
  10. 【Chapter 3: Process】