您的位置:首页 > 其它

faster-rcnn数据替换

2016-04-05 20:16 369 查看
rcnn这个想法最早由Ross(https://github.com/rbgirshick)在2014年提出,提出后风靡了整个目标检测领域,Faster-rcnn是rcnn系列算法的的第三个版本,Ren(https://github.com/ShaoqingRen/faster_rcnn)和Ross同学充分汲取了rcnn和fast-rcnn优点,进一步优化了整个检测算法。运用了rpn网络做proposal提取,替代了前两个rcnn版本使用的selective search,真正做到了end to end。faster-rcnn论文见http://arxiv.org/abs/1506.01497

闲话不多扯,先把demo跑起来,具体见Ren的github主页,按照他的教程安装编译即可。

一、替换成自己的数据集

替换位置:datasets/VOCdevkit2007/VOC2007(2012替换类似)

需要工具:VOCcode包(这个可以在VOC官网上下载)

操作: 在matlab新建一个VOC数据支持结构体,然后保存成xml文件,替换Annotaions文件夹,再新建ImageSets/Main 里面的trainval.txt, test.txt的名字换成你的图像和xml文件的名字。替换JPEGImages文件夹。

xml.annotation.filename = im_name;%图像名字
xml.annotation.source.flickrid = im_id;%图像id
xml.annotation.size.height = 480;
xml.annotation.size.width = 640;
xml.annotation.object(j,1).name = 'car';%类别
xml.annotation.object(j,1).pose = 'Unspecified';
xml.annotation.object(j,1).truncated =  0;
xml.annotation.object(j,1).bndbox.xmin = boxes(j,1);%x1
xml.annotation.object(j,1).bndbox.ymin = boxes(j,2);%y1
xml.annotation.object(j,1).bndbox.xmax = boxes(j,1) + boxes(j,3);%x1+w
xml.annotation.object(j,1).bndbox.ymax = boxes(j,2) + boxes(j,4);%x2+w
VOCwritexml(xml, ['Annotations/' num2str(im_id) '.xml']);%保存为xml文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: