def __init__(self, bn=False): super(MCNN_1, self).__init__() self.branch0 = nn.Sequential( Conv2d(1, 24, 5, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(24, 48, 3, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(48, 24, 3, same_padding=True, bn=bn), Conv2d(24, 12, 3, same_padding=True, bn=bn)) self.fuse = nn.Sequential(Conv2d(12, 1, 1, same_padding=True, bn=bn))
def __init__(self, bn=False, cam=False, c=12, step=4): super().__init__() self.branch0 = Column_U(9, c, bn=bn) self.branch1 = Column_U(7, c + step, bn=bn) self.branch2 = Column_U(5, c + step * 2, bn=bn) self.branch3 = Column_U(3, c + step * 3, bn=bn) total_chn = int((c * 4 + step * 6) / 4) #self.fuse = Conv2d(18, 1, 1, relu=True, same_padding=True, bn=bn) self.output = nn.Sequential( Conv2d(total_chn, 18, 1, relu=True, same_padding=True, bn=bn), Conv2d(18, 9, 3, relu=True, same_padding=True, bn=bn), Conv2d(9, 4, 3, relu=True, same_padding=True, bn=bn), Conv2d(4, 1, 3, relu=True, same_padding=True, bn=bn)) #gradcam self.cam = cam self.gradients = {}
def __init__(self, kernel_size, first_out_chn, bn=False): super().__init__() self.entry = Conv2d(1, first_out_chn, kernel_size + 2, same_padding=True, bn=bn) self.red_1 = nn.Sequential( nn.MaxPool2d(2), Conv2d(first_out_chn, 2 * first_out_chn, kernel_size, same_padding=True, bn=bn)) self.red_2 = nn.Sequential( nn.MaxPool2d(2), Conv2d(2 * first_out_chn, first_out_chn, kernel_size, same_padding=True, bn=bn), Conv2d(first_out_chn, int(first_out_chn / 2), kernel_size, same_padding=True, bn=bn)) self.up_1 = Upscale(int(first_out_chn / 2), int(first_out_chn / 2), int(first_out_chn / 2), int(first_out_chn / 4), kernel_size=kernel_size, bn=bn) self.up_2 = Upscale(int(first_out_chn / 4), int(first_out_chn / 4), int(first_out_chn / 4), int(first_out_chn / 4), kernel_size=kernel_size, bn=bn) self.skip_1 = Conv2d(first_out_chn, int(first_out_chn / 4), 1, same_padding=True, bn=bn) self.skip_2 = Conv2d(2 * first_out_chn, int(first_out_chn / 2), 1, same_padding=True, bn=bn)
def __init__(self, bn=False): super(MCNN_4, self).__init__() self.branch0 = nn.Sequential( Conv2d(1, 12, 11, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(12, 24, 9, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(24, 12, 9, same_padding=True, bn=bn), Conv2d(12, 6, 9, same_padding=True, bn=bn)) self.branch1 = nn.Sequential( Conv2d(1, 16, 9, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(16, 32, 7, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(32, 16, 7, same_padding=True, bn=bn), Conv2d(16, 8, 7, same_padding=True, bn=bn)) self.branch2 = nn.Sequential( Conv2d(1, 20, 7, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(20, 40, 5, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(40, 20, 5, same_padding=True, bn=bn), Conv2d(20, 10, 5, same_padding=True, bn=bn)) self.branch3 = nn.Sequential( Conv2d(1, 24, 5, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(24, 48, 3, same_padding=True, bn=bn), nn.MaxPool2d(2), Conv2d(48, 24, 3, same_padding=True, bn=bn), Conv2d(24, 12, 3, same_padding=True, bn=bn)) self.fuse = nn.Sequential(Conv2d(36, 1, 1, same_padding=True, bn=bn))
def __init__(self, bn=False): super().__init__() self.branch0_0 = Conv2d(1, 12, 11, same_padding=True, bn=bn) self.branch0_1 = nn.Sequential( nn.MaxPool2d(2), Conv2d(12, 24, 9, same_padding=True, bn=bn)) self.branch0_2 = nn.Sequential( nn.MaxPool2d(2), Conv2d(24, 12, 9, same_padding=True, bn=bn), Conv2d(12, 6, 9, same_padding=True, bn=bn)) self.branch1_0 = Conv2d(1, 16, 9, same_padding=True, bn=bn) self.branch1_1 = nn.Sequential( nn.MaxPool2d(2), Conv2d(16, 32, 7, same_padding=True, bn=bn)) self.branch1_2 = nn.Sequential( nn.MaxPool2d(2), Conv2d(32, 16, 7, same_padding=True, bn=bn), Conv2d(16, 8, 7, same_padding=True, bn=bn)) self.branch2_0 = Conv2d(1, 20, 7, same_padding=True, bn=bn) self.branch2_1 = nn.Sequential( nn.MaxPool2d(2), Conv2d(20, 40, 5, same_padding=True, bn=bn)) self.branch2_2 = nn.Sequential( nn.MaxPool2d(2), Conv2d(40, 20, 5, same_padding=True, bn=bn), Conv2d(20, 10, 5, same_padding=True, bn=bn)) self.branch3_0 = Conv2d(1, 24, 5, same_padding=True, bn=bn) self.branch3_1 = nn.Sequential( nn.MaxPool2d(2), Conv2d(24, 48, 3, same_padding=True, bn=bn)) self.branch3_2 = nn.Sequential( nn.MaxPool2d(2), Conv2d(48, 24, 3, same_padding=True, bn=bn), Conv2d(24, 12, 3, same_padding=True, bn=bn)) self.reduce_chn_2 = Conv2d(72, 12, 1, same_padding=True, bn=bn) self.reduce_chn_1 = Conv2d(144, 24, 1, same_padding=True, bn=bn) self.fuse = nn.Sequential(Conv2d(36, 24, 1, same_padding=True, bn=bn)) self.up_1 = Upscale(24, 24, 24, 12) self.up_2 = Upscale(12, 12, 12, 6) self.out = Conv2d(6, 1, 1, same_padding=True, bn=False, relu=True)