MCPcopy Create free account
hub / github.com/ZhengPeng7/BiRefNet / __init__

Method __init__

models/refinement/refiner.py:110–129  ·  view source on GitHub ↗
(self, channels)

Source from the content-addressed store, hash-verified

108
109class Decoder(nn.Module):
110 def __init__(self, channels):
111 super(Decoder, self).__init__()
112 self.config = Config()
113 DecoderBlock = eval('BasicDecBlk')
114 LateralBlock = eval('BasicLatBlk')
115
116 self.decoder_block4 = DecoderBlock(channels[0], channels[1])
117 self.decoder_block3 = DecoderBlock(channels[1], channels[2])
118 self.decoder_block2 = DecoderBlock(channels[2], channels[3])
119 self.decoder_block1 = DecoderBlock(channels[3], channels[3]//2)
120
121 self.lateral_block4 = LateralBlock(channels[1], channels[1])
122 self.lateral_block3 = LateralBlock(channels[2], channels[2])
123 self.lateral_block2 = LateralBlock(channels[3], channels[3])
124
125 if self.config.ms_supervision:
126 self.conv_ms_spvn_4 = nn.Conv2d(channels[1], 1, 1, 1, 0)
127 self.conv_ms_spvn_3 = nn.Conv2d(channels[2], 1, 1, 1, 0)
128 self.conv_ms_spvn_2 = nn.Conv2d(channels[3], 1, 1, 1, 0)
129 self.conv_out1 = nn.Sequential(nn.Conv2d(channels[3]//2, 1, 1, 1, 0))
130
131 def forward(self, features):
132 x, x1, x2, x3, x4 = features

Callers

nothing calls this directly

Calls 2

ConfigClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected