MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / __init__

Method __init__

script/feature/dfnet.py:183–207  ·  view source on GitHub ↗
(self, feat_dim=12, places365_model_path='')

Source from the content-addressed store, hash-verified

181 std = [0.229, 0.224, 0.225]
182
183 def __init__(self, feat_dim=12, places365_model_path=''):
184 super(DFNet_s, self).__init__()
185
186 self.layer_to_index = {k: v for v, k in enumerate(vgg16_layers.keys())}
187 self.hypercolumn_indices = [self.layer_to_index[n] for n in self.default_conf['hypercolumn_layers']] # [2, 14, 28]
188
189 # Initialize architecture
190 vgg16 = models.vgg16(pretrained=True)
191
192 self.encoder = nn.Sequential(*list(vgg16.features.children()))
193
194 self.scales = []
195 current_scale = 0
196 for i, layer in enumerate(self.encoder):
197 if isinstance(layer, torch.nn.MaxPool2d):
198 current_scale += 1
199 if i in self.hypercolumn_indices:
200 self.scales.append(2**current_scale)
201
202 ## adaptation layers, see off branches from fig.3 in S2DNet paper
203 self.adaptation_layers = AdaptLayers(self.default_conf['hypercolumn_layers'], self.default_conf['output_dim'])
204
205 # pose regression layers
206 self.avgpool = nn.AdaptiveAvgPool2d(1)
207 self.fc_pose = nn.Linear(512, feat_dim)
208
209 def forward(self, x, return_feature=False, isSingleStream=False, return_pose=True, upsampleH=240, upsampleW=427):
210 '''

Callers

nothing calls this directly

Calls 2

AdaptLayersClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected