Pretrained deeplabv3_resnet50_coco is not supported as of now

username: WaterKnight
cooked: <p>I am getting the previous error when I use the following line of code:</p>
<pre><code class="lang-auto">model=torchvision.models.segmentation.deeplabv3_resnet50(pretrained=True)
</code></pre>

username: ptrblck
cooked: <p>This model was added 8 days ago in <a href="https://github.com/pytorch/vision/commit/bf843c664b8ba0ff49d2921237500c77d82f2d04">this PR</a>, so you could install the nightly binary or build from source to use it. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>

username: WaterKnight
cooked: <p>How can I finetuning this model?? <a class="mention" href="/u/ptrblck">@ptrblck</a>  This model return an ordered dict where key out has the output image but values are not 0 or 1 in binary segmentation!</p>

username: ptrblck
cooked: <p>The model wasn’t trained on a binary segmentation use case, but for 20 classes as stated in the docs:</p>
<blockquote>
<p>The pre-trained models have been trained on a subset of COCO train2017, on the 20 categories that are present in the Pascal VOC dataset. You can see more information on how the subset has been selected in  <code>references/segmentation/coco_utils.py</code> .</p>
</blockquote>
<p>Most likely you will get an activation containing the logits for these 20 classes (in dim1).<br>
If you are dealing with a binary segmentation use case, you could set <code>num_classes=2</code> (for a binary multi-class segmentation using <code>nn.CrossEntropyLoss</code>) or <code>num_classes=1</code> (for a binary segmentation using <code>nn.BCEWithLogitsLoss</code>) in the instantiation of the model.</p>

username: WaterKnight
cooked: <p>Understood, I got this working this morning.</p>
<p>However, I tried to make it work with resnet34 as backbone and it throws me Dilatation&gt;1 not supported.</p>
<p>There is a pull request that solves this:</p>
<aside class="onebox githubpullrequest">
  <header class="source">
      <a href="https://github.com/pytorch/vision/pull/2115#commits-pushed-e0f24f5" target="_blank" rel="nofollow noopener">github.com/pytorch/vision</a>
  </header>
  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Pull Request">
    <svg width="60" height="60" class="github-icon" viewbox="0 0 12 16" aria-hidden="true"><path d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/pytorch/vision/pull/2115" target="_blank" rel="nofollow noopener">ResNet BasicBlock dilation</a>
    </h4>

    <div class="branches">
      <code>pytorch:master</code> ← <code>christian-rauch:resnet_dilation</code>
    </div>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2020-04-17" data-time="19:05:38" data-timezone="UTC">07:05PM - 17 Apr 20 UTC</span>
      </div>

      <div class="user">
        <a href="https://github.com/christian-rauch" target="_blank" rel="nofollow noopener">
          <img alt="christian-rauch" src="https://avatars0.githubusercontent.com/u/8226248?v=4" class="onebox-avatar-inline" width="20" height="20">
          christian-rauch
        </a>
      </div>

      <div class="lines" title="1 commits changed 1 files with 2 additions and 4 deletions">
        <a href="https://github.com/pytorch/vision/pull/2115/files" target="_blank" rel="nofollow noopener">
          <span class="added">+2</span>
          <span class="removed">-4</span>
        </a>
      </div>
    </div>

  </div>
</div>
  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>


username: WaterKnight
cooked: <aside class="quote no-group" data-username="ptrblck" data-post="4" data-topic="77240">
<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>The pre-trained models have been trained on a subset of COCO train2017, on the 20 categories that are present in the Pascal VOC dataset. You can see more information on how the subset has been selected in <code>references/segmentation/coco_utils.py</code> .</p>
</blockquote>
</aside>
<p>Could the backbone weights work with my problem? So just deeplab head weights need to get retrained!</p>
<p>Is this right?</p>

username: ptrblck
cooked: <p>That should be possible, yes.</p>

username: WaterKnight
cooked: <aside class="quote no-group" data-username="ptrblck" data-post="2" data-topic="77240">
<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 install the nightly binary or build from source to use it.</p>
</blockquote>
</aside>
<p>!pip install git+https://github.com/pytorch/vision.git@nightly</p>
<p>Is not working! How can i install just turchvision nightly?</p>

username: ptrblck
cooked: <p>Please refer to the <a href="https://pytorch.org/get-started/locally/">install instructions</a>.</p>

username: WaterKnight
cooked: <p>It looks like pretrained deeplabv3_resnet50 have been added to torchvision 0.6. However, when I try to use them it says that they is not implemented</p>

username: ptrblck
cooked: <p>Could you post the installed torchvision version via <code>print(torchvision.__version__)</code>?</p>

username: WaterKnight
cooked: <aside class="quote no-group quote-modified" data-username="ptrblck" data-post="11" data-topic="77240">
<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>print(torchvision.<strong>version</strong>)</p>
</blockquote>
</aside>
<p>This is the version that gets printed: 0.6.0a0+82fd1c8</p>

username: ptrblck
cooked: <p>This is a pre-release version, so you would have to update to <code>0.6</code> or the nightly binary.</p>

username: WaterKnight
cooked: <aside class="quote no-group" data-username="albanD" data-post="8" data-topic="77757" data-full="true">
<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/alband/48/215_2.png" class="avatar"><a href="https://discuss.pytorch.org/t/installing-torchaudio-with-pytorch-1-5-0-lead-to-downgrade/77757/8">Installing torchaudio with pytorch 1.5.0 lead to downgrade</a></div>
<blockquote>
<p>Hi,</p>
<p>We updated all the linux binaries now. So all should work fine. Can you double check that it works on your side?</p>
</blockquote>
</aside>
<p>It was installed from pytorch channel on anaconda<br>
after the solution. How can I install it properly?</p>

username: WaterKnight
cooked: <p>I installed from pip now and says: <code>0.6.0</code>.</p>
<p>However, I am getting same error: <code>NotImplementedError: pretrained deeplabv3_resnet50_coco is not supported as of now</code></p>

username: ptrblck
cooked: <p>You are right. The model didn’t make it into <code>0.6.0</code> and missed the code freeze apparently by a day, so you would still need to install the latest nightly.</p>