def __init__(self, in_channels, out_channels, strides, bottleneck, conv1_stride, data_format="channels_last", **kwargs): super(SEPreResUnit, self).__init__(**kwargs) self.resize_identity = (in_channels != out_channels) or (strides != 1) if bottleneck: self.body = PreResBottleneck(in_channels=in_channels, out_channels=out_channels, strides=strides, conv1_stride=conv1_stride, data_format=data_format, name="body") else: self.body = PreResBlock(in_channels=in_channels, out_channels=out_channels, strides=strides, data_format=data_format, name="body") self.se = SEBlock(channels=out_channels, data_format=data_format, name="se") if self.resize_identity: self.identity_conv = conv1x1(in_channels=in_channels, out_channels=out_channels, strides=strides, data_format=data_format, name="identity_conv")
def __init__(self, in_channels_low, in_channels_high, out_channels, classes, data_format="channels_last", **kwargs): super(CFFBlock, self).__init__(**kwargs) self.up = InterpolationBlock(scale_factor=2, data_format=data_format, name="up") self.conv_low = conv3x3_block(in_channels=in_channels_low, out_channels=out_channels, padding=2, dilation=2, activation=None, data_format=data_format, name="conv_low") self.conv_hign = conv1x1_block(in_channels=in_channels_high, out_channels=out_channels, activation=None, data_format=data_format, name="conv_hign") self.activ = nn.ReLU() self.conv_cls = conv1x1(in_channels=out_channels, out_channels=classes, data_format=data_format, name="conv_cls")
def __init__(self, classes, data_format="channels_last", **kwargs): super(ICHeadBlock, self).__init__(**kwargs) self.cff_12 = CFFBlock(in_channels_low=128, in_channels_high=64, out_channels=128, classes=classes, data_format=data_format, name="cff_12") self.cff_24 = CFFBlock(in_channels_low=256, in_channels_high=256, out_channels=128, classes=classes, data_format=data_format, name="cff_24") self.up_x2 = InterpolationBlock(scale_factor=2, data_format=data_format, name="up_x2") self.up_x8 = InterpolationBlock(scale_factor=4, data_format=data_format, name="up_x8") self.conv_cls = conv1x1(in_channels=128, out_channels=classes, data_format=data_format, name="conv_cls")