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

Method __init__

script/feature/efficientnet.py:32–50  ·  view source on GitHub ↗

Initialize one adaptation layer for every extraction point. Args: hypercolumn_layers: The list of the hypercolumn layer names. output_dim: The output channel dimension.

(self, hypercolumn_layers: List[str], output_dim: int = 128)

Source from the content-addressed store, hash-verified

30 """
31
32 def __init__(self, hypercolumn_layers: List[str], output_dim: int = 128):
33 """Initialize one adaptation layer for every extraction point.
34
35 Args:
36 hypercolumn_layers: The list of the hypercolumn layer names.
37 output_dim: The output channel dimension.
38 """
39 super(AdaptLayers, self).__init__()
40 self.layers = []
41 channel_sizes = [EB3_layers[name] for name in hypercolumn_layers]
42 for i, l in enumerate(channel_sizes):
43 layer = nn.Sequential(
44 nn.Conv2d(l, 64, kernel_size=1, stride=1, padding=0),
45 nn.ReLU(),
46 nn.Conv2d(64, output_dim, kernel_size=5, stride=1, padding=2),
47 nn.BatchNorm2d(output_dim),
48 )
49 self.layers.append(layer)
50 self.add_module("adapt_layer_{}".format(i), layer) # ex: adapt_layer_0
51
52 def forward(self, features: List[torch.tensor]):
53 """Apply adaptation layers. # here is list of three levels of features

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected