in seamseg/modules/fpn.py [0:0]
def __init__(self, in_channels, out_channels=256, extra_scales=0, norm_act=ABN, interpolation="nearest"):
super(FPN, self).__init__()
self.interpolation = interpolation
# Lateral connections and output convolutions
self.lateral = nn.ModuleList([
self._make_lateral(channels, out_channels, norm_act) for channels in in_channels
])
self.output = nn.ModuleList([
self._make_output(out_channels, norm_act) for _ in in_channels
])
if extra_scales > 0:
self.extra = nn.ModuleList([
self._make_extra(in_channels[-1] if i == 0 else out_channels, out_channels, norm_act)
for i in range(extra_scales)
])
self.reset_parameters()