Same DNN model on raspberry and windows laptop produces different output

username: msee19018
cooked: <p>Hello Everyone,<br>
I am running a yolov5 model on raspberry pi 4. I have torch 1.8.0a0+37c1f4a installed on it using a build wheel I found online. I also have same model running on my laptop. It has torch 1.8.0+cpu version.<br>
I am using yolo to detect objects in a video. When i pass a frame from video to both raspberry pi and my laptop their output is different. I have checked input value of frame they are same for both platforms. I have also checked values of weights for some layers of yolo pretrained model they are same on both platforms. I am unable to understand that why output has different values(These values ae significantly different) is different.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/e/0e04436d18b0ce0c25c9b3e276813f53b44bc707.png" data-download-href="https://discuss.pytorch.org/uploads/default/0e04436d18b0ce0c25c9b3e276813f53b44bc707" title="captures"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/e/0e04436d18b0ce0c25c9b3e276813f53b44bc707_2_690x387.png" alt="captures" data-base62-sha1="1ZZOLDfDonYG8s4OiMjTqzp3AGP" width="690" height="387" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/e/0e04436d18b0ce0c25c9b3e276813f53b44bc707_2_690x387.png, https://discuss.pytorch.org/uploads/default/optimized/3X/0/e/0e04436d18b0ce0c25c9b3e276813f53b44bc707_2_1035x580.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/0/e/0e04436d18b0ce0c25c9b3e276813f53b44bc707.png 2x" data-dominant-color="3C3D38"><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">captures</span><span class="informations">1366×768 139 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><br>
I have drawn red contour around the code where difference happen. I am using same code for both devices. I using code from following github repo.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/lpcvai/21LPCVC-UAV_VIdeo_Track-Sample-Solution">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/lpcvai/21LPCVC-UAV_VIdeo_Track-Sample-Solution" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://opengraph.githubassets.com/b6c405f0fec43c9983e48de984789b7abb0dfeeb9db4fa103069c27a2b5a8000/lpcvai/21LPCVC-UAV_VIdeo_Track-Sample-Solution" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/lpcvai/21LPCVC-UAV_VIdeo_Track-Sample-Solution" target="_blank" rel="noopener nofollow ugc">GitHub - lpcvai/21LPCVC-UAV_VIdeo_Track-Sample-Solution</a></h3>

  <p>Contribute to lpcvai/21LPCVC-UAV_VIdeo_Track-Sample-Solution development by creating an account on GitHub.</p>


  </article>

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

  <div style="clear: both"></div>
</aside>
<p>
Thanks for your help.</p>

username: eqy
cooked: <p>Can you provide a small example of how the outputs differ so we can get a better idea of what the issue is? It may also be worthwhile to inspect the intermediate outputs of the model (and the “augmentations” depending on what is in <code>opt.augment</code>) to see where the differences first appear.</p>

username: msee19018
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/1/61b17cd2e93bfb80f736b55cb2f9462c36f40038.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/61b17cd2e93bfb80f736b55cb2f9462c36f40038" title="20210517_205153"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/6/1/61b17cd2e93bfb80f736b55cb2f9462c36f40038_2_690x169.jpeg" alt="20210517_205153" data-base62-sha1="dWezXHKXlMzxb0jzdxUB8JPavoI" width="690" height="169" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/6/1/61b17cd2e93bfb80f736b55cb2f9462c36f40038_2_690x169.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/6/1/61b17cd2e93bfb80f736b55cb2f9462c36f40038_2_1035x253.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/6/1/61b17cd2e93bfb80f736b55cb2f9462c36f40038.jpeg 2x" data-dominant-color="221E1F"><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">20210517_205153</span><span class="informations">1335×328 224 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><br>
Above Image shows output tensor on laptop.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/8/a8e2c0df78614897b83b5108b4c9af09c54b3829.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/a8e2c0df78614897b83b5108b4c9af09c54b3829" title="20210518_000936"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/a/8/a8e2c0df78614897b83b5108b4c9af09c54b3829_2_690x189.jpeg" alt="20210518_000936" data-base62-sha1="o621YUFyPvWyIhZNNx8d8V43wh3" width="690" height="189" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/a/8/a8e2c0df78614897b83b5108b4c9af09c54b3829_2_690x189.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/a/8/a8e2c0df78614897b83b5108b4c9af09c54b3829_2_1035x283.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/a/8/a8e2c0df78614897b83b5108b4c9af09c54b3829_2_1380x378.jpeg 2x" data-dominant-color="43414F"><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">20210518_000936</span><span class="informations">2407×661 621 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><br>
Above image shows output tensor on raspberry pi. Input is same video file. opt.augment is false for both cases.</p>

username: eqy
cooked: <p>I’m not familiar with the shape dimensions here; what do 15120 and 7 correspond to?</p>
<p>Have you tried checking the intermediate outputs of the model (e.g., after each layer) to see where the differences start?</p>

username: msee19018
cooked: <p>Network made 15120 predictions for each image. every prediction have 7 parameters. 4 for bounding box, one for object confidence and two for class confidence. It is detecting objects of only two classes from every image. I have checked output at each layer. I think i have to do that.</p>