YOLOv4-tiny size mismatch error

ajaykumaar: <p>Hii,<br>
I’m trying to create an object detector with YOLOv4-tiny and I got the weights and cfg file from the below links.</p>
<p><a href="https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights" rel="noopener nofollow ugc">https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-</a></p>
<aside class="onebox githubblob" data-onebox-src="https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny.cfg">
  <header class="source">

      <a href="https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny.cfg" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny.cfg" target="_blank" rel="noopener nofollow ugc">AlexeyAB/darknet/blob/master/cfg/yolov4-tiny.cfg</a></h4>


      <pre><code class="lang-cfg">[net]
# Testing
#batch=1
#subdivisions=1
# Training
batch=64
subdivisions=1
width=416
height=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

learning_rate=0.00261
burn_in=1000

</code></pre>



  This file has been truncated. <a href="https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny.cfg" target="_blank" rel="noopener nofollow ugc">show original</a>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
<p>
I get an error while loading the weights to Darknet model.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/9/6/967e9c5e073e0f1c432a9ae1cd3c1697074c63f2.png" data-download-href="https://discuss.pytorch.org/uploads/default/967e9c5e073e0f1c432a9ae1cd3c1697074c63f2" title="dbt"><img src="https://discuss.pytorch.org/uploads/default/original/3X/9/6/967e9c5e073e0f1c432a9ae1cd3c1697074c63f2.png" alt="dbt" data-base62-sha1="ltkSK9XeJCU5wPqKIdgY5Sbvwhs" width="690" height="268" data-dominant-color="532521"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">dbt</span><span class="informations">911×355 10.2 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>How do i resolve this?</p>
<p>Thanks in advance</p>

ptrblck: <p>Unfortunately I don’t know how to resolve this issue as I’m not familiar with your code, but the error is most likely raised by the <code>view_as</code> operation, which tries to <code>view</code> the parameter in an invalid shape.<br>
You should thus either fix the slicing operation on <code>weights</code> or the <code>conv_layer.weight</code> shape.</p>

ajaykumaar: <p>Hi <a class="mention" href="/u/ptrblck">@ptrblck</a>,<br>
Thank you for ur reply. Yeah right, the issue was due to invalid shape because of a bug in the architecture. Now it works fine.<br>
Thank you.</p>

Sathish_Basavaraju: <p>Hi <a class="mention" href="/u/ajaykumaar">@ajaykumaar</a> ,</p>
<p>I am facing the same issue. Could you please explain, how you solved the problem?<br>
Thank you.</p>