你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
王斌_ICT - 研究领域:深度学习,目标检测
赞同来自: caffe 、王蒙蒙 、徐国智_受限的玻尔兹曼 、caney
close all; clear all; clc hThresh = 50; %save the iamges continue gtboxes whos hight is larger than hThresh srcImgPath = '..\myData\USA\images'; srcAnoPath = '..\myData\USA\annotation'; outImgPath = '..\myData\USA_RCNN\images'; outAnoPath = '..\myData\USA_RCNN\annotation'; fpAnno = fopen('..\myData\USA_RCNN\train.txt','wt'); if ~exist(outImgPath,'dir') mkdir(outImgPath); end if ~exist(outAnoPath,'dir') mkdir(outAnoPath); end srcList = dir(srcImgPath); srcNum = length(srcList)-2; count = 1; for i = 1:srcNum if mod(i,1000)==0 fprintf('CurNum:%d\n',i); end curAnno = sprintf('%s\\Id.txt', srcAnoPath,i); curImgName = sprintf('%s\\Id.jpg', srcImgPath,i); txtData = importdata(curAnno); if isstruct(txtData) srcList = txtData.textdata(2:end); gtList = find(strcmp(srcList,'person')); gtBoxes = txtData.data(gtList,1:4); gtBoxes = gtBoxes(find(gtBoxes(:,4)>=hThresh),1:4); if isempty(gtBoxes) continue; end fprintf(fpAnno,'Id\n',count); choseId = sprintf('%s\\Id.xml',outAnoPath,count); fp = fopen(choseId,'wt'); curImg = imread(curImgName); [imgH,imgW,channel] = size(curImg); fprintf(fp, '<annotation>\n'); fprintf(fp, '\t<folder>Daimler</folder>\n'); fprintf(fp, '\t<filename>Daimler</filename>\n'); fprintf(fp, '\t<source>\n'); fprintf(fp, '\t\t<database>Daimler</database>\n'); fprintf(fp, '\t</source>\n'); fprintf(fp, '\t<size>\n'); fprintf(fp, '\t\t<width>%d</width>\n',imgW); fprintf(fp, '\t\t<height>%d</height>\n',imgH); fprintf(fp, '\t\t<depth>3</depth>\n'); fprintf(fp, '\t</size>\n'); for boxId = 1:size(gtBoxes,1) fprintf(fp, '\t<object>\n'); fprintf(fp, '\t\t<name>pedestrian</name>\n'); fprintf(fp, '\t\t<bndbox>\n'); fprintf(fp,'\t\t\t<xmin>%d</xmin>\n',gtBoxes(boxId,1)); fprintf(fp,'\t\t\t<xmax>%d</xmax>\n',gtBoxes(boxId,1)+gtBoxes(boxId,3)); fprintf(fp,'\t\t\t<ymin>%d</ymin>\n',gtBoxes(boxId,2)); fprintf(fp,'\t\t\t<ymax>%d</ymax>\n',gtBoxes(boxId,2)+gtBoxes(boxId,4)); fprintf(fp, '\t\t</bndbox>\n'); fprintf(fp, '\t</object>\n'); end fprintf(fp, '</annotation>\n'); fclose(fp); copyfile(curImgName, sprintf('%s//Id.jpg',outImgPath,count)); count = count+1; end end fclose(fpAnno);
wait_alone - Hello world
赞同来自: 徐国智_受限的玻尔兹曼
要回复问题请先登录或注册
2 个回复
王斌_ICT - 研究领域:深度学习,目标检测
赞同来自: caffe 、王蒙蒙 、徐国智_受限的玻尔兹曼 、caney
wait_alone - Hello world
赞同来自: 徐国智_受限的玻尔兹曼
https://github.com/tzutalin/labelImg