FasterRcnn训练数据集参数配置

论坛 期权论坛     
选择匿名的用户   2021-5-29 23:30   437   0
<div class="blogpost-body" id="cnblogs_post_body">
<p>说明:本博文假设你已经做好了自己的数据集,该数据集格式和VOC2007相同。做好数据集后,我们开始训练,下面是训练前的一些修改。<br>本文来自:http://www.lai18.com/content/2526443.html</p>
<h2> </h2>
<h2><strong>1 、VOCdevkit2007\VOCcode\VOCinit.m的修改</strong></h2>
<h3><strong>(1)路径的修改</strong></h3>
<div class="dp-highlighter bg_plain">
  <div class="bar">
   <div class="tools">
    <strong>[plain]</strong>
    <a class="ViewSource" href="http://www.lai18.com/content/2526443.html#" title="view plain">view plain</a>
    <a class="CopyToClipboard" href="http://www.lai18.com/content/2526443.html#" title="copy">copy</a>
    <div>
      
    </div>
   </div>
  </div>
  <ol start="1"><li class="alt">VOCopts.annopath&#61;[VOCopts.datadir VOCopts.dataset &#39;/Annotations/%s.xml&#39;];  </li><li>VOCopts.imgpath&#61;[VOCopts.datadir VOCopts.dataset &#39;/JPEGImages/%s.jpg&#39;];  </li><li class="alt">VOCopts.imgsetpath&#61;[VOCopts.datadir VOCopts.dataset &#39;/ImageSets/Main/%s.txt&#39;];  </li><li>VOCopts.clsimgsetpath&#61;[VOCopts.datadir VOCopts.dataset &#39;/ImageSets/Main/%s_%s.txt&#39;];  </li><li class="alt">VOCopts.clsrespath&#61;[VOCopts.resdir &#39;Main/%s_cls_&#39; VOCopts.testset &#39;_%s.txt&#39;];  </li><li>VOCopts.detrespath&#61;[VOCopts.resdir &#39;Main/%s_det_&#39; VOCopts.testset &#39;_%s.txt&#39;];  </li></ol>
</div>
<p> <br>上面这些路径要正确,第一个是xml标签路径;第二个是图片的路径;第三个是放train.txt、val.txt、test.txt和trainval.txt的路径;第四、五、六个不需要;一般来说这些路径不用修改,你做的数据集格式和VOC2007相同就行。</p>
<h3><strong>(2)训练集文件夹修改</strong></h3>
<div class="dp-highlighter bg_plain">
  <div class="bar">
   <div class="tools">
    <strong>[plain]</strong>
    <a class="ViewSource" href="http://www.lai18.com/content/2526443.html#" title="view plain">view plain</a>
    <a class="CopyToClipboard" href="http://www.lai18.com/content/2526443.html#" title="copy">copy</a>
    <div>
      
    </div>
   </div>
  </div>
  <ol start="1"><li class="alt">VOCopts.dataset &#61; &#39;你的文件夹名&#39;;  </li></ol>
</div>
<p> <br><br>然后将VOC2007路径注释掉,上面“你的文件夹名”是你放Annotations、ImageSets、JPEGImages文件夹的文件夹名。</p>
<h3><strong>(3)标签的修改</strong></h3>
<div class="dp-highlighter bg_plain">
  <div class="bar">
   <div class="tools">
    <strong>[plain]</strong>
    <a class="ViewSource" href="http://www.lai18.com/content/2526443.html#" title="view plain">view plain</a>
    <a class="CopyToClipboard" href="http://www.lai18.com/content/2526443.html#" title="copy">copy</a>
    <div>
      
    </div>
   </div>
  </div>
  <ol start="1"><li class="alt">VOCopts.classes&#61;{...  </li><li>   &#39;你的标签1&#39;  </li><li class="alt">   &#39;你的标签2&#39;  </li><li>   &#39;你的标签3&#39;  </li><li class="alt">   &#39;你的标签4&#39;};  </li></ol>
</div>
<p> 将其改为你的标签。<br><br></p>
<h2>2 、VOCdevkit2007\results</h2>
<p> results下需要新建一个文件夹,名字和xml中的&lt;folder&gt;***&lt;/folder&gt;对应。***文件夹下新建一个Main文件夹。</p>
<h2><strong>3 、VOCdevkit2007\local</strong></h2>
<p> local下需要新建一个文件夹,名字和xml中的&lt;folder&gt;***&lt;/folder&gt;对应。<br><br></p>
<h2><strong>4 、function\fast_rcnn\fast_rcnn_train.m</strong></h2>
<div class="dp-highlighter bg_plain">
  <div class="bar">
   <div class="tools">
    <strong>[plain]</strong>
    <a class="ViewSource" href="http://www.lai18.com/content/2526443.html#" title="view plain">view plain</a>
    <a class="CopyToClipboard" href="http://www.lai18.com/content/2526443.html#" title="copy">copy</a>
    <div>
      
    </div>
   </div>
  </div>
  <ol start="1"><li class="alt">ip.addParamValue(&#39;val_iters&#39;,       500,            &#64;isscalar);   </li><li>ip.addParamValue(&#39;val_interval&#39;,    2000,           &#64;isscalar);  </li></ol>
</div>
<p> <br>可能在randperm(N,k)出现错误,可以将500改小点,比如200.<br><br></p>
<h2><strong>5、function\rpn\proposal_train.m</strong></h2>
<p> 这里的问题和fast_rcnn_train.m一样。</p>
<h2><strong>6.imdb\imdb_eval_voc.m</strong></h2>
<div class="dp-highlighter bg_plain">
  <div class="bar">
   <div class="tools">
    <strong>[plain]</strong>
    <a class="ViewSource" href="http://www.lai18.com/content/2526443.html#" title="view plain">view plain</a>
    <a class="CopyToClipboard" href="http://www.lai18.com/content/2526443.html#" title="copy">copy</a>
    <div>
      
    </div>
   </div>
  </div>
  <ol start="1"><li class="alt">%do_eval &#61; (str2num(year) &lt;&#61; 2007) | ~strcmp(test_set,&#39;test&#39;);  </li><li>do_eval &#61; 1;  </li></ol>
</div>
<p> 注释掉</p>
<div class="dp-highlighter bg_plain">
  <div class="bar">
   <div class="tools">
    <strong>[plain]</strong>
    <a class="ViewSource" href="http://www.lai18.com/content/2526443.html#" title="view plain">view plain</a>
    <a class="CopyToClipboard" href="http://www.lai18.com/conte
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP