def __init__(self, num_input_features, growth_rate, bn_size, drop_rate, memory_efficient=False): super(_DenseLayerCOB, self).__init__() self.add_module('norm1', BatchNorm2dCOB(num_input_features)), self.add_module('relu1', ReLUCOB(inplace=True)), self.add_module( 'conv1', Conv2dCOB(num_input_features, bn_size * growth_rate, kernel_size=1, stride=1, bias=False)), self.add_module('norm2', BatchNorm2dCOB(bn_size * growth_rate)), self.add_module('relu2', ReLUCOB(inplace=True)), self.add_module( 'conv2', Conv2dCOB(bn_size * growth_rate, growth_rate, kernel_size=3, stride=1, padding=1, bias=False)), self.drop_rate = float(drop_rate) self.memory_efficient = memory_efficient self.concat = Concat() self.dropout = DropoutCOB(self.drop_rate)
def __init__(self, in_channels=3): super(DenseNet, self).__init__() self.conv1 = Conv2dCOB(in_channels=in_channels, out_channels=3, kernel_size=3, padding=1) self.conv2 = Conv2dCOB(in_channels=3, out_channels=3, kernel_size=3, padding=1) self.conv3 = Conv2dCOB(in_channels=6, out_channels=3, kernel_size=3, padding=1) self.conv4 = Conv2dCOB(in_channels=3, out_channels=3, kernel_size=3, padding=1) self.relu1 = ReLUCOB() self.relu2 = ReLUCOB() self.relu3 = ReLUCOB() self.relu4 = ReLUCOB() self.concat1 = Concat() self.flatten = FlattenCOB() self.fc1 = LinearCOB(in_channels * 32 * 32, 10)
def __init__(self, in_ch, out_ch, bilinear=False): super().__init__() self.upsample = None if bilinear: self.upsample = UpsampleCOB(scale_factor=2, mode='bilinear', align_corners=True) else: self.upsample = ConvTranspose2dCOB(in_ch, in_ch // 2, kernel_size=2, stride=2) self.conv = DoubleConvCOB(in_ch, out_ch) self.cat = Concat()
def __init__(self, num_layers, num_input_features, bn_size, growth_rate, drop_rate, memory_efficient=False): super(_DenseBlockCOB, self).__init__() for i in range(num_layers): layer = _DenseLayerCOB( num_input_features + i * growth_rate, growth_rate=growth_rate, bn_size=bn_size, drop_rate=drop_rate, memory_efficient=memory_efficient, ) self.add_module('denselayer%d' % (i + 1), layer) self.concat = Concat()
def __init__(self): super(DenseNet4, self).__init__() self.conv1 = Conv2dCOB(in_channels=1, out_channels=3, kernel_size=3, padding=1) self.conv2 = Conv2dCOB(in_channels=3, out_channels=3, kernel_size=3, padding=1) self.conv3 = Conv2dCOB(in_channels=6, out_channels=3, kernel_size=3, padding=1) self.relu1 = ReLUCOB() self.relu2 = ReLUCOB() self.relu3 = ReLUCOB() self.concat1 = Concat()
def __init__(self): super(SplitConcatModel, self).__init__() self.conv1 = Conv2dCOB(in_channels=1, out_channels=3, kernel_size=3, padding=1) self.conv21 = Conv2dCOB(in_channels=3, out_channels=3, kernel_size=3, padding=1) self.conv22 = Conv2dCOB(in_channels=3, out_channels=3, kernel_size=3, padding=1) self.conv3 = Conv2dCOB(in_channels=6, out_channels=3, kernel_size=3, padding=1) self.relu1 = ReLUCOB() self.relu21 = ReLUCOB() self.relu22 = ReLUCOB() self.concat1 = Concat()