PyTorch torchVision Object Detection finetuning tutorial

username: wh0978449773
cooked: <p>I am from Taiwan so my English is not very good !<br>
I practicing the TorchVision Object DeteCtion Finetuning Tutorial on PyTorch<br>
but I encountered an error that says 'module ‘email.utils’ has no attribute ‘collate_fn’."<br>
Because I imported collat_fn, but I still got an error when debugging.<br>
I’m not sure what to do.<br>
Thanks to everyone for their answers.<br>
If anyone needs my code, you can leave a message below."<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/8/d83d674bb4f692226060e0d0a7fd66aaf8b0891b.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/d83d674bb4f692226060e0d0a7fd66aaf8b0891b" title="截圖 2023-10-19 上午12.28.54"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/8/d83d674bb4f692226060e0d0a7fd66aaf8b0891b_2_690x391.jpeg" alt="截圖 2023-10-19 上午12.28.54" data-base62-sha1="uQWGMnVE2jT4E1L2dQRXJaM8QNJ" width="690" height="391" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/8/d83d674bb4f692226060e0d0a7fd66aaf8b0891b_2_690x391.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/d/8/d83d674bb4f692226060e0d0a7fd66aaf8b0891b_2_1035x586.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/d/8/d83d674bb4f692226060e0d0a7fd66aaf8b0891b_2_1380x782.jpeg 2x" data-dominant-color="232424"><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">截圖 2023-10-19 上午12.28.54</span><span class="informations">1920×1088 133 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>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/9/b90bc5a1664688cace6603848cec4961ad90386c.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/b90bc5a1664688cace6603848cec4961ad90386c" title="截圖 2023-10-19 上午12.23.33"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/9/b90bc5a1664688cace6603848cec4961ad90386c_2_690x391.jpeg" alt="截圖 2023-10-19 上午12.23.33" data-base62-sha1="qoZyjk25lEqYRhIH7ENop7ztpqk" width="690" height="391" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/9/b90bc5a1664688cace6603848cec4961ad90386c_2_690x391.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/b/9/b90bc5a1664688cace6603848cec4961ad90386c_2_1035x586.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/b/9/b90bc5a1664688cace6603848cec4961ad90386c_2_1380x782.jpeg 2x" data-dominant-color="242525"><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">截圖 2023-10-19 上午12.23.33</span><span class="informations">1920×1088 145 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>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/3/33d4b2d33569605b286e56eda7311bb4cb956b5a.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/33d4b2d33569605b286e56eda7311bb4cb956b5a" title="截圖 2023-10-19 上午12.29.03"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/33d4b2d33569605b286e56eda7311bb4cb956b5a_2_690x391.jpeg" alt="截圖 2023-10-19 上午12.29.03" data-base62-sha1="7ow3rlW0tfcN973dmfbyNzC0Hea" width="690" height="391" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/33d4b2d33569605b286e56eda7311bb4cb956b5a_2_690x391.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/33d4b2d33569605b286e56eda7311bb4cb956b5a_2_1035x586.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/33d4b2d33569605b286e56eda7311bb4cb956b5a_2_1380x782.jpeg 2x" data-dominant-color="232424"><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">截圖 2023-10-19 上午12.29.03</span><span class="informations">1920×1088 134 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>

username: ptrblck
cooked: <p>It seems the <code>email.utils</code> module does not provide the <code>collate_fn</code> method so make sure you are using the right module and check if you would have a namespace conflict.<br>
I.e. could you explain where exactly your <code>collate_fn</code> is defined?</p>

username: wh0978449773
cooked: <aside class="quote no-group" data-username="ptrblck" data-post="2" data-topic="190224">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p>could you explai</p>
</blockquote>
</aside>
<p>I define my collate_fn in ex2.py<br>
Below is my screenshot<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/c/2ce0a40b959d616902fd89e47f74f53316fc4823.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ce0a40b959d616902fd89e47f74f53316fc4823" title="截圖 2023-10-19 下午4.48.12"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2ce0a40b959d616902fd89e47f74f53316fc4823_2_674x500.png" alt="截圖 2023-10-19 下午4.48.12" data-base62-sha1="6p0iySTdWEc7u4JV0TGP1Ql6YfN" width="674" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2ce0a40b959d616902fd89e47f74f53316fc4823_2_674x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2ce0a40b959d616902fd89e47f74f53316fc4823_2_1011x750.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/2/c/2ce0a40b959d616902fd89e47f74f53316fc4823_2_1348x1000.png 2x" data-dominant-color="262828"><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">截圖 2023-10-19 下午4.48.12</span><span class="informations">1500×1112 109 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>

username: wh0978449773
cooked: <p>This is my code, and if anybody finds any errors, please let me know. Thank you, everyone!</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/chenggg0830/Vision">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="16" height="16">

      <a href="https://github.com/chenggg0830/Vision" 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/ff1f043290262fa2fe2586f93c7f5ce37bbe79d3207db9eb143eae7b23ad2b8e/chenggg0830/Vision" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/chenggg0830/Vision" target="_blank" rel="noopener nofollow ugc">GitHub - chenggg0830/Vision: PyTorch torchVision Object Detection finetuning...</a></h3>

  <p>PyTorch torchVision Object Detection finetuning tutorial - GitHub - chenggg0830/Vision: PyTorch torchVision Object Detection finetuning tutorial</p>


  </article>

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

  <div style="clear: both"></div>
</aside>