(self, input_nc, output_nc, ngf=64, norm_layer=RAIN,
norm_type_indicator=[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
use_dropout=False, use_attention=True)
| 160 | |
| 161 | class HDNet(nn.Module): |
| 162 | def __init__(self, input_nc, output_nc, ngf=64, norm_layer=RAIN, |
| 163 | norm_type_indicator=[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], |
| 164 | use_dropout=False, use_attention=True): |
| 165 | super(HDNet, self).__init__() |
| 166 | self.input_nc = input_nc |
| 167 | self.norm_namebuffer = ['RAIN'] |
| 168 | self.use_dropout = use_dropout |
| 169 | self.use_attention = use_attention |
| 170 | |
| 171 | norm_type_list = [get_norm_layer('instance'), norm_layer] |
| 172 | # -------------------------------Network Settings------------------------------------- |
| 173 | self.model_layer0 = nn.Conv2d(input_nc, ngf, kernel_size=3, stride=1, padding=1, bias=False) |
| 174 | self.model_layer1 = get_act_conv(nn.LeakyReLU(0.2, True), ngf, ngf*2, 4, 2, 1, False) |
| 175 | self.model_layer1norm = norm_type_list[norm_type_indicator[0]](ngf*2) |
| 176 | |
| 177 | self.model_layer2 = get_act_conv(nn.LeakyReLU(0.2, True), ngf*2, ngf*4, 3, 1, 1, False) |
| 178 | self.model_layer2norm = norm_type_list[norm_type_indicator[1]](ngf*4) |
| 179 | |
| 180 | self.model_layer3 = get_act_conv(nn.LeakyReLU(0.2, True), ngf*4, ngf*8, 4, 2, 1, False) |
| 181 | self.model_layer3norm = norm_type_list[norm_type_indicator[2]](ngf*8) |
| 182 | |
| 183 | self.model_layer4 = get_act_conv(nn.LeakyReLU(0.2, True), ngf*8, ngf*8, 3, 1, 1, False) |
| 184 | self.model_layer4norm = norm_type_list[norm_type_indicator[3]](ngf*8) |
| 185 | |
| 186 | self.model_layer5 = get_act_conv(nn.LeakyReLU(0.2, True), ngf*8, ngf*8, 4, 2, 1, False) |
| 187 | self.model_layer5norm = norm_type_list[norm_type_indicator[4]](ngf*8) |
| 188 | |
| 189 | self.model_layer6 = get_act_conv(nn.LeakyReLU(0.2, True), ngf*8, ngf*8, 3, 1, 1, False) |
| 190 | self.model_layer6norm = norm_type_list[norm_type_indicator[5]](ngf*8) |
| 191 | |
| 192 | self.model_layer71 = get_act_conv(nn.LeakyReLU(0.2, True), ngf*8, ngf*8, 3, 1, 1, False) |
| 193 | self.model_layer72 = get_act_dconv(nn.ReLU(True), ngf*8, ngf*8, 3, 1, 1, False) |
| 194 | self.model_layer72norm = norm_type_list[norm_type_indicator[7]](ngf*8) |
| 195 | |
| 196 | self.model_layer8 = get_act_dconv(nn.ReLU(True), ngf*16, ngf*8, 3, 1, 1, False) |
| 197 | self.model_layer8norm = norm_type_list[norm_type_indicator[8]](ngf*8) |
| 198 | |
| 199 | self.model_layer9 = get_act_dconv(nn.ReLU(True), ngf*16, ngf*8, 4, 2, 1, False) |
| 200 | self.model_layer9norm = norm_type_list[norm_type_indicator[9]](ngf*8) |
| 201 | |
| 202 | self.model_layer10 = get_act_dconv(nn.ReLU(True), ngf*16, ngf*8, 3, 1, 1, False) |
| 203 | self.model_layer10norm = norm_type_list[norm_type_indicator[10]](ngf*8) |
| 204 | |
| 205 | self.model_layer11 = get_act_dconv(nn.ReLU(True), ngf*16, ngf*4, 4, 2, 1, False) |
| 206 | self.model_layer11norm = norm_type_list[norm_type_indicator[11]](ngf*4) |
| 207 | |
| 208 | if use_attention: |
| 209 | self.model_layer11att = DRConv2d(ngf*8, ngf*8, 1, 2) |
| 210 | |
| 211 | self.model_layer12 = get_act_dconv(nn.ReLU(True), ngf*8, ngf*2, 3, 1, 1, False) |
| 212 | self.model_layer12norm = norm_type_list[norm_type_indicator[12]](ngf*2) |
| 213 | |
| 214 | if use_attention: |
| 215 | self.model_layer12att = DRConv2d(ngf*4, ngf*4, 1, 2) |
| 216 | |
| 217 | self.model_layer13 = get_act_dconv(nn.ReLU(True), ngf*4, ngf, 4, 2, 1, False) |
| 218 | self.model_layer13norm = norm_type_list[norm_type_indicator[13]](ngf) |
| 219 | if use_attention: |
no test coverage detected