Feature maps for a resnet Faster-RCNN

username: abenju
cooked: <p>Hi there, apologies if this is a weird question, but I’m not very experienced and haven’t had much luck getting an answer.</p>
<p>I need to make a Faster-RCNN with a resnet101 backbone and no FPN (I plan to deal with scales otherwise) but I’m not entirely sure where I should be taking the feature maps from. I was thinking of using torchvision’s implementation of a Faster-RCNN.</p>
<p>I though of taking them from “conv4” or “conv5”, but I noticed examples that I believe used the result of the adaptive pooling. I imagined this would make it more flexible in terms of input image size, but I don’t know if it would be enough information for the RPN.</p>
<p>I’ve also seen examples written in other frameworks that seem to concatenate the outputs of conv4 and 5 somehow.</p>
<p>Thank you in advance</p>

username: bulatnv
cooked: <p>Hello, abenju!</p>
<p>I can suggest you to have a look for mask rcnn finetuning tutorial.<br>
<a href="https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html" class="onebox" target="_blank" rel="noopener nofollow ugc">https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html</a></p>
<p>And if you want to change inner layers you probably should rewrite RCNN class in torchvision.</p><aside class="onebox githubblob">
  <header class="source">
      <a href="https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py" target="_blank" rel="noopener nofollow ugc">pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py</a></h4>
<pre><code class="lang-py">import torch
from torch import nn
import torch.nn.functional as F

from torchvision.ops import MultiScaleRoIAlign

from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url

from .anchor_utils import AnchorGenerator
from .generalized_rcnn import GeneralizedRCNN
from .rpn import RPNHead, RegionProposalNetwork
from .roi_heads import RoIHeads
from .transform import GeneralizedRCNNTransform
from .backbone_utils import resnet_fpn_backbone, _validate_trainable_layers, mobilenet_backbone


__all__ = [
    "FasterRCNN", "fasterrcnn_resnet50_fpn", "fasterrcnn_mobilenet_v3_large_320_fpn",
    "fasterrcnn_mobilenet_v3_large_fpn"
</code></pre>

  This file has been truncated. <a href="https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py" target="_blank" rel="noopener nofollow ugc">show original</a>

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

<p>About making flexible input image sizes, no need to worry, because there already implemented tranformation layers at the beggining and at the and of faster rcnn model. All you need to do is just set min_size and max_size.<br>
Again, have a look at this link:</p><aside class="onebox githubblob">
  <header class="source">
      <a href="https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py" target="_blank" rel="noopener nofollow ugc">pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py</a></h4>
<pre><code class="lang-py">import torch
from torch import nn
import torch.nn.functional as F

from torchvision.ops import MultiScaleRoIAlign

from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url

from .anchor_utils import AnchorGenerator
from .generalized_rcnn import GeneralizedRCNN
from .rpn import RPNHead, RegionProposalNetwork
from .roi_heads import RoIHeads
from .transform import GeneralizedRCNNTransform
from .backbone_utils import resnet_fpn_backbone, _validate_trainable_layers, mobilenet_backbone


__all__ = [
    "FasterRCNN", "fasterrcnn_resnet50_fpn", "fasterrcnn_mobilenet_v3_large_320_fpn",
    "fasterrcnn_mobilenet_v3_large_fpn"
</code></pre>

  This file has been truncated. <a href="https://github.com/pytorch/vision/blob/master/torchvision/models/detection/faster_rcnn.py" target="_blank" rel="noopener nofollow ugc">show original</a>

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

<p>Sorry for my english, hope I could help you somehow.</p>