Example #1
0
    def __init__(self, in_channels=3, out_channels=5):
        super(VGG3D, self).__init__()

        self.conv1 = Sequential(
            Conv3d(in_channels, 64, kernel_size=(1, 3, 3), padding=(0, 1, 1)),
            InstanceNorm3d(64, True), ReLU(True),
            Conv3d(64, 64, kernel_size=(1, 3, 3), padding=(0, 1, 1)),
            InstanceNorm3d(64, True), ReLU(True),
            Conv3d(64, 64, kernel_size=(1, 3, 3), padding=(0, 1, 1)),
            InstanceNorm3d(64, True), ReLU(True),
            MaxPool3d(kernel_size=(1, 2, 2), stride=(1, 2, 2)))
        self.conv2 = Sequential(
            Conv3d(64, 128, kernel_size=(1, 3, 3), padding=(0, 1, 1)),
            InstanceNorm3d(128, True), ReLU(True),
            Conv3d(128, 128, kernel_size=(1, 3, 3), padding=(0, 1, 1)),
            InstanceNorm3d(128, True), ReLU(True),
            Conv3d(128, 128, kernel_size=(1, 3, 3), padding=(0, 1, 1)),
            InstanceNorm3d(128, True), ReLU(True),
            MaxPool3d(kernel_size=(1, 2, 2), stride=(1, 2, 2)))

        self.conv3 = Sequential(Conv3d(128, 256, kernel_size=3, padding=1),
                                InstanceNorm3d(256, True), ReLU(True),
                                Conv3d(256, 256, kernel_size=3, padding=1),
                                InstanceNorm3d(256, True), ReLU(True),
                                Conv3d(256, 256, kernel_size=3, padding=1),
                                InstanceNorm3d(256, True), ReLU(True),
                                MaxPool3d(2, stride=2))

        self.avgpool = AdaptiveAvgPool3d(1, 1, 1)
        self.fc = Linear(256, out_channels)
Example #2
0
    def __init__(self, pv):
        super(AlexNetExplicitTaco, self).__init__()
        self.conv1 = ConvTTN3d(in_channels=3,
                               out_channels=64,
                               kernel_size=11,
                               stride=(1, 3, 4),
                               padding=2,
                               project_variable=pv,
                               bias=True,
                               ksize=(0, 0),
                               fc_in=1,
                               hw=(150, 224))
        self.pool1 = MaxPool3d(kernel_size=3, stride=2)

        self.conv2 = ConvTTN3d(in_channels=64,
                               out_channels=192,
                               kernel_size=5,
                               padding=2,
                               project_variable=pv,
                               bias=True,
                               ksize=(0, 0),
                               fc_in=1,
                               hw=(23, 27))
        self.pool2 = MaxPool3d(kernel_size=3, stride=2)

        self.conv3 = ConvTTN3d(in_channels=192,
                               out_channels=384,
                               kernel_size=3,
                               padding=1,
                               project_variable=pv,
                               bias=True,
                               ksize=(0, 0),
                               fc_in=1,
                               hw=(11, 13))
        self.conv4 = ConvTTN3d(in_channels=384,
                               out_channels=256,
                               kernel_size=3,
                               padding=1,
                               project_variable=pv,
                               bias=True,
                               ksize=(0, 0),
                               fc_in=1,
                               hw=(11, 13))
        self.conv5 = ConvTTN3d(in_channels=256,
                               out_channels=256,
                               kernel_size=3,
                               padding=1,
                               project_variable=pv,
                               bias=True,
                               ksize=(0, 0),
                               fc_in=1,
                               hw=(11, 13))
        self.pool3 = MaxPool3d(kernel_size=3, stride=2)

        # self.pool4 = AdaptiveAvgPool3d(output_size=1)
        self.pool4 = AdaptiveAvgPool3d((1, 6, 6))

        self.fc1 = Linear(256 * 1 * 6 * 6, 4096)
        self.fc2 = Linear(4096, 4096)
        self.fc3 = Linear(4096, pv.label_size)
Example #3
0
    def __init__(self, in_channels, norm_layer, up_kwargs):
        super(PyramidPooling, self).__init__()
        self.pool1 = AdaptiveAvgPool3d(1)
        self.pool2 = AdaptiveAvgPool3d(2)
        self.pool3 = AdaptiveAvgPool3d(3)
        self.pool4 = AdaptiveAvgPool3d(6)

        out_channels = int(in_channels/4)
        self.conv1 = Sequential(Conv3d(in_channels, out_channels, 1, bias=False),
                                norm_layer(out_channels),
                                ReLU(True))
        self.conv2 = Sequential(Conv3d(in_channels, out_channels, 1, bias=False),
                                norm_layer(out_channels),
                                ReLU(True))
        self.conv3 = Sequential(Conv3d(in_channels, out_channels, 1, bias=False),
                                norm_layer(out_channels),
                                ReLU(True))
        self.conv4 = Sequential(Conv3d(in_channels, out_channels, 1, bias=False),
                                norm_layer(out_channels),
                                ReLU(True))
        # bilinear upsample options
        self._up_kwargs = up_kwargs
    def __init__(self, pv):
        super(VGG19BN_Explicit_3T , self).__init__()

        self.conv1 = ConvTTN3d(in_channels=3, out_channels=64, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn1 = BatchNorm3d(64)
        self.conv2 = ConvTTN3d(in_channels=64, out_channels=64, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn2 = BatchNorm3d(64)
        self.maxpool1 = MaxPool3d(kernel_size=2, padding=0, stride=2)

        self.conv3 = ConvTTN3d(in_channels=64, out_channels=128, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn3 = BatchNorm3d(128)
        self.conv4 = ConvTTN3d(in_channels=128, out_channels=128, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn4 = BatchNorm3d(128)
        self.maxpool2 = MaxPool3d(kernel_size=2, padding=0, stride=2)

        self.conv5 = ConvTTN3d(in_channels=128, out_channels=256, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn5 = BatchNorm3d(256)
        self.conv6 = ConvTTN3d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn6 = BatchNorm3d(256)
        self.conv7 = ConvTTN3d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn7 = BatchNorm3d(256)
        self.conv8 = ConvTTN3d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn8 = BatchNorm3d(256)
        self.maxpool3 = MaxPool3d(kernel_size=2, padding=0, stride=2)

        self.conv9 = ConvTTN3d(in_channels=256, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn9 = BatchNorm3d(512)
        self.conv10 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn10 = BatchNorm3d(512)
        self.conv11 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn11 = BatchNorm3d(512)
        self.conv12 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn12 = BatchNorm3d(512)
        self.maxpool4 = MaxPool3d(kernel_size=2, padding=0, stride=1)

        self.conv13 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn13 = BatchNorm3d(512)
        self.conv14 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn14 = BatchNorm3d(512)
        self.conv15 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn15 = BatchNorm3d(512)
        self.conv16 = ConvTTN3d(in_channels=512, out_channels=512, kernel_size=3, stride=1, padding=1, project_variable=pv, bias=True)
        self.bn16 = BatchNorm3d(512)
        self.maxpool5 = MaxPool3d(kernel_size=2, padding=0, stride=2)

        self.avgpool = AdaptiveAvgPool3d(output_size=(1, 7, 7))
        self.fc1 = Linear(25088, 4096)
        self.dropout1 = Dropout(p=0.5)
        self.fc2 = Linear(4096, 4096)
        self.dropout2 = Dropout(p=0.5)
        self.fc3 = Linear(4096, 27)
Example #5
0
 def __init__(self, pv):
     super(ResNet18, self).__init__()
     self.conv1_relu = ConvolutionBlock(3, 64, pv)
     self.maxpool = MaxPool3d(kernel_size=3,
                              padding=1,
                              stride=2,
                              dilation=1)
     self.res2a_relu = ResidualBlock(64, 64, pv)
     self.res2b_relu = ResidualBlock(64, 64, pv)
     self.res3a_relu = ResidualBlockB(64, 128, pv)
     self.res3b_relu = ResidualBlock(128, 128, pv)
     self.res4a_relu = ResidualBlockB(128, 256, pv)
     self.res4b_relu = ResidualBlock(256, 256, pv)
     self.res5a_relu = ResidualBlockB(256, 512, pv)
     self.res5b_relu = ResidualBlock(512, 512, pv)
     self.avgpool = AdaptiveAvgPool3d(output_size=1)
     self.fc = torch.nn.Linear(512, 27)
Example #6
0
    def __init__(self, pv):
        super(AlexNetExplicit3T, self).__init__()
        self.conv1 = classic_3TConv(in_channels=3,
                                    out_channels=64,
                                    kernel_size=11,
                                    stride=(1, 3, 4),
                                    padding=2,
                                    project_variable=pv,
                                    bias=True)
        self.pool1 = MaxPool3d(kernel_size=3, stride=2)

        self.conv2 = classic_3TConv(in_channels=64,
                                    out_channels=192,
                                    kernel_size=5,
                                    padding=2,
                                    project_variable=pv,
                                    bias=True)
        self.pool2 = MaxPool3d(kernel_size=3, stride=2)

        self.conv3 = classic_3TConv(in_channels=192,
                                    out_channels=384,
                                    kernel_size=3,
                                    padding=1,
                                    project_variable=pv,
                                    bias=True)
        self.conv4 = classic_3TConv(in_channels=384,
                                    out_channels=256,
                                    kernel_size=3,
                                    padding=1,
                                    project_variable=pv,
                                    bias=True)
        self.conv5 = classic_3TConv(in_channels=256,
                                    out_channels=256,
                                    kernel_size=3,
                                    padding=1,
                                    project_variable=pv,
                                    bias=True)
        self.pool3 = MaxPool3d(kernel_size=3, stride=2)

        # self.pool4 = AdaptiveAvgPool3d(output_size=1)
        self.pool4 = AdaptiveAvgPool3d((1, 6, 6))

        self.fc1 = Linear(256 * 1 * 6 * 6, 4096)
        self.fc2 = Linear(4096, 4096)
        self.fc3 = Linear(4096, pv.label_size)
Example #7
0
    },
    {
        "input_fn":
        lambda: rand(2, 2, 6, 8),
        "module_fn":
        lambda: Sequential(Linear(8, 8), AdaptiveAvgPool2d((3, 4)), Flatten()),
        "loss_function_fn":
        lambda: MSELoss(),
        "target_fn":
        lambda: regression_targets((2, 2 * 3 * 4)),
    },
    {
        "input_fn":
        lambda: rand(2, 2, 9, 5, 4),
        "module_fn":
        lambda: Sequential(Linear(4, 4), AdaptiveAvgPool3d(
            (3, 5, 2)), Flatten()),
        "loss_function_fn":
        lambda: MSELoss(),
        "target_fn":
        lambda: regression_targets((2, 2 * 3 * 5 * 2)),
    },
]
##################################################################
#                      BatchNorm settings                        #
##################################################################
LOCAL_SETTINGS += [
    {
        "input_fn":
        lambda: rand(2, 3, 4),
        "module_fn":
        lambda: initialize_training_false_recursive(
Example #8
0
    def __init__(self, pv):
        super(Googlenet3TConv_explicit, self).__init__()

        self.conv1 = ConvTTN3d(in_channels=3, out_channels=64, kernel_size=7, padding=3, stride=2, project_variable=pv, bias=False)
        self.bn1 = BatchNorm3d(64)
        self.maxpool1 = MaxPool3d(kernel_size=(1, 3, 3), padding=0, stride=(1, 2, 2))
        self.conv2 = Conv3d(in_channels=64, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn2 = BatchNorm3d(64)
        self.conv3 = ConvTTN3d(in_channels=64, out_channels=192, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn3 = BatchNorm3d(192)
        self.maxpool2 = MaxPool3d(kernel_size=(1, 3, 3), padding=0, stride=(1, 2, 2))

        # inception 3a
        self.conv4 = Conv3d(in_channels=192, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn4 = BatchNorm3d(64)
        self.conv5 = Conv3d(in_channels=192, out_channels=96, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn5 = BatchNorm3d(96)
        self.conv6 = ConvTTN3d(in_channels=96, out_channels=128, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn6 = BatchNorm3d(128)
        self.conv7 = Conv3d(in_channels=192, out_channels=16, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn7 = BatchNorm3d(16)
        self.conv8 = ConvTTN3d(in_channels=16, out_channels=32, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn8 = BatchNorm3d(32)
        self.maxpool3 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv9 = Conv3d(in_channels=192, out_channels=32, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn9 = BatchNorm3d(32)

        # inception 3b
        self.conv10 = Conv3d(in_channels=256, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn10 = BatchNorm3d(128)
        self.conv11 = Conv3d(in_channels=256, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn11 = BatchNorm3d(128)
        self.conv12 = ConvTTN3d(in_channels=128, out_channels=192, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn12 = BatchNorm3d(192)
        self.conv13 = Conv3d(in_channels=256, out_channels=32, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn13 = BatchNorm3d(32)
        self.conv14 = ConvTTN3d(in_channels=32, out_channels=96, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn14 = BatchNorm3d(96)
        self.maxpool4 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv15 = Conv3d(in_channels=256, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn15 = BatchNorm3d(64)

        self.maxpool5 = MaxPool3d(kernel_size=3, padding=0, stride=2)

        # inception 4a
        self.conv16 = Conv3d(in_channels=480, out_channels=192, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn16 = BatchNorm3d(192)
        self.conv17 = Conv3d(in_channels=480, out_channels=96, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn17 = BatchNorm3d(96)
        self.conv18 = ConvTTN3d(in_channels=96, out_channels=208, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn18 = BatchNorm3d(208)
        self.conv19 = Conv3d(in_channels=480, out_channels=16, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn19 = BatchNorm3d(16)
        self.conv20 = ConvTTN3d(in_channels=16, out_channels=48, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn20 = BatchNorm3d(48)
        self.maxpool6 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv21 = Conv3d(in_channels=480, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn21 = BatchNorm3d(64)

        # inception 4b
        self.conv22 = Conv3d(in_channels=512, out_channels=160, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn22 = BatchNorm3d(160)
        self.conv23 = Conv3d(in_channels=512, out_channels=112, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn23 = BatchNorm3d(112)
        self.conv24 = ConvTTN3d(in_channels=112, out_channels=224, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn24 = BatchNorm3d(224)
        self.conv25 = Conv3d(in_channels=512, out_channels=24, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn25 = BatchNorm3d(24)
        self.conv26 = ConvTTN3d(in_channels=24, out_channels=64, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn26 = BatchNorm3d(64)
        self.maxpool7 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv27 = Conv3d(in_channels=512, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn27 = BatchNorm3d(64)

        self.avgpool1 = AvgPool3d(kernel_size=5, padding=0, stride=3)
        self.conv28 = Conv3d(in_channels=512, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn28 = BatchNorm3d(128)
        # self.fc1 = Linear(in_features=2304, out_features=1024)
        self.fc1 = Linear(in_features=768, out_features=1024)  # 768
        self.dropout1 = Dropout3d(p=0.7)
        self.fc2 = Linear(in_features=1024, out_features=pv.label_size)

        # inception 4c
        self.conv29 = Conv3d(in_channels=512, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn29 = BatchNorm3d(128)
        self.conv30 = Conv3d(in_channels=512, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn30 = BatchNorm3d(128)
        self.conv31 = ConvTTN3d(in_channels=128, out_channels=256, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn31 = BatchNorm3d(256)
        self.conv32 = Conv3d(in_channels=512, out_channels=24, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn32 = BatchNorm3d(24)
        self.conv33 = ConvTTN3d(in_channels=24, out_channels=64, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn33 = BatchNorm3d(64)
        self.maxpool8 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv34 = Conv3d(in_channels=512, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn34 = BatchNorm3d(64)

        # inception 4d
        self.conv35 = Conv3d(in_channels=512, out_channels=112, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn35 = BatchNorm3d(112)
        self.conv36 = Conv3d(in_channels=512, out_channels=144, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn36 = BatchNorm3d(144)
        self.conv37 = ConvTTN3d(in_channels=144, out_channels=288, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn37 = BatchNorm3d(288)
        self.conv38 = Conv3d(in_channels=512, out_channels=32, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn38 = BatchNorm3d(32)
        self.conv39 = ConvTTN3d(in_channels=32, out_channels=64, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn39 = BatchNorm3d(64)
        self.maxpool9 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv40 = Conv3d(in_channels=512, out_channels=64, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn40 = BatchNorm3d(64)

        # inception 4e
        self.conv41 = Conv3d(in_channels=528, out_channels=256, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn41 = BatchNorm3d(256)
        self.conv42 = Conv3d(in_channels=528, out_channels=160, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn42 = BatchNorm3d(160)
        self.conv43 = ConvTTN3d(in_channels=160, out_channels=320, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn43 = BatchNorm3d(320)
        self.conv44 = Conv3d(in_channels=528, out_channels=32, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn44 = BatchNorm3d(32)
        self.conv45 = ConvTTN3d(in_channels=32, out_channels=128, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn45 = BatchNorm3d(128)
        self.maxpool10 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv46 = Conv3d(in_channels=528, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn46 = BatchNorm3d(128)

        self.avgpool2 = AvgPool3d(kernel_size=5, padding=0, stride=3)
        self.conv47 = Conv3d(in_channels=528, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn47 = BatchNorm3d(128)
        # self.fc3 = Linear(in_features=2304, out_features=1024)
        self.fc3 = Linear(in_features=768, out_features=1024)
        self.dropout2 = Dropout3d(p=0.7)
        self.fc4 = Linear(in_features=1024, out_features=pv.label_size)

        self.maxpool11 = MaxPool3d(kernel_size=3, padding=0, stride=2)

        # inception 5a
        self.conv48 = Conv3d(in_channels=832, out_channels=256, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn48 = BatchNorm3d(256)
        self.conv49 = Conv3d(in_channels=832, out_channels=160, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn49 = BatchNorm3d(160)
        self.conv50 = ConvTTN3d(in_channels=160, out_channels=320, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn50 = BatchNorm3d(320)
        self.conv51 = Conv3d(in_channels=832, out_channels=32, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn51 = BatchNorm3d(32)
        self.conv52 = ConvTTN3d(in_channels=32, out_channels=128, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn52 = BatchNorm3d(128)
        self.maxpool12 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv53 = Conv3d(in_channels=832, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn53 = BatchNorm3d(128)

        # inception 5b
        self.conv54 = Conv3d(in_channels=832, out_channels=384, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn54 = BatchNorm3d(384)
        self.conv55 = Conv3d(in_channels=832, out_channels=192, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn55 = BatchNorm3d(192)
        self.conv56 = ConvTTN3d(in_channels=192, out_channels=384, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn56 = BatchNorm3d(384)
        self.conv57 = Conv3d(in_channels=832, out_channels=48, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn57 = BatchNorm3d(48)
        self.conv58 = ConvTTN3d(in_channels=48, out_channels=128, kernel_size=3, padding=1, stride=1, project_variable=pv, bias=False)
        self.bn58 = BatchNorm3d(128)
        self.maxpool13 = MaxPool3d(kernel_size=3, padding=1, stride=1)
        self.conv59 = Conv3d(in_channels=832, out_channels=128, kernel_size=1, padding=0, stride=1, bias=False)
        self.bn59 = BatchNorm3d(128)

        self.avgpool3 = AdaptiveAvgPool3d(1)
        self.dropout3 = Dropout3d(p=0.4)
        self.fc5 = Linear(in_features=1024, out_features=pv.label_size)
Example #9
0
    def __init__(self):
        super(ResNet18Explicit3DConvReduced, self).__init__()
        # self.conv1_relu = ConvolutionBlock(3, 64, pv)
        self.conv1 = Conv3d(in_channels=3,
                            out_channels=int(64 / 1.718),
                            kernel_size=7,
                            stride=2,
                            padding=3,
                            bias=False)
        self.bn1 = BatchNorm3d(int(64 / 1.718))

        self.maxpool = MaxPool3d(kernel_size=3,
                                 padding=1,
                                 stride=2,
                                 dilation=1)

        # self.res2a_relu = ResidualBlock(int(64/1.718), int(64/1.718), pv)
        self.conv2 = Conv3d(in_channels=int(64 / 1.718),
                            out_channels=int(64 / 1.718),
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn2 = BatchNorm3d(int(64 / 1.718))
        self.conv3 = Conv3d(in_channels=int(64 / 1.718),
                            out_channels=int(64 / 1.718),
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn3 = BatchNorm3d(int(64 / 1.718))

        # self.res2b_relu = ResidualBlock(int(64/1.718), int(64/1.718), pv)
        self.conv4 = Conv3d(in_channels=int(64 / 1.718),
                            out_channels=int(64 / 1.718),
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn4 = BatchNorm3d(int(64 / 1.718))
        self.conv5 = Conv3d(in_channels=int(64 / 1.718),
                            out_channels=int(64 / 1.718),
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn5 = BatchNorm3d(int(64 / 1.718))

        # self.res3a_relu = ResidualBlockB(int(64/1.718), int(128/1.718), pv)
        self.conv6 = Conv3d(in_channels=int(64 / 1.718),
                            out_channels=int(128 / 1.718),
                            kernel_size=1,
                            stride=2,
                            bias=False)
        self.bn6 = BatchNorm3d(int(128 / 1.718))
        self.conv7 = Conv3d(in_channels=int(64 / 1.718),
                            out_channels=int(128 / 1.718),
                            kernel_size=3,
                            stride=2,
                            padding=1,
                            bias=False)
        self.bn7 = BatchNorm3d(int(128 / 1.718))
        self.conv8 = Conv3d(in_channels=int(128 / 1.718),
                            out_channels=int(128 / 1.718),
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn8 = BatchNorm3d(int(128 / 1.718))

        # self.res3b_relu = ResidualBlock(int(128/1.718), int(128/1.718), pv)
        self.conv9 = Conv3d(in_channels=int(128 / 1.718),
                            out_channels=int(128 / 1.718),
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn9 = BatchNorm3d(int(128 / 1.718))
        self.conv10 = Conv3d(in_channels=int(128 / 1.718),
                             out_channels=int(128 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn10 = BatchNorm3d(int(128 / 1.718))

        # self.res4a_relu = ResidualBlockB(int(128/1.718), int(256/1.718), pv)
        self.conv11 = Conv3d(in_channels=int(128 / 1.718),
                             out_channels=int(256 / 1.718),
                             kernel_size=1,
                             stride=2,
                             bias=False)
        self.bn11 = BatchNorm3d(int(256 / 1.718))
        self.conv12 = Conv3d(in_channels=int(128 / 1.718),
                             out_channels=int(256 / 1.718),
                             kernel_size=3,
                             stride=2,
                             padding=1,
                             bias=False)
        self.bn12 = BatchNorm3d(int(256 / 1.718))
        self.conv13 = Conv3d(in_channels=int(256 / 1.718),
                             out_channels=int(256 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn13 = BatchNorm3d(int(256 / 1.718))

        # self.res4b_relu = ResidualBlock(int(256/1.718), int(256/1.718), pv)
        self.conv14 = Conv3d(in_channels=int(256 / 1.718),
                             out_channels=int(256 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn14 = BatchNorm3d(int(256 / 1.718))
        self.conv15 = Conv3d(in_channels=int(256 / 1.718),
                             out_channels=int(256 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn15 = BatchNorm3d(int(256 / 1.718))

        # self.res5a_relu = ResidualBlockB(int(256/1.718), int(512/1.718), pv)
        self.conv16 = Conv3d(in_channels=int(256 / 1.718),
                             out_channels=int(512 / 1.718),
                             kernel_size=1,
                             stride=2,
                             bias=False)
        self.bn16 = BatchNorm3d(int(512 / 1.718))
        self.conv17 = Conv3d(in_channels=int(256 / 1.718),
                             out_channels=int(512 / 1.718),
                             kernel_size=3,
                             stride=2,
                             padding=1,
                             bias=False)
        self.bn17 = BatchNorm3d(int(512 / 1.718))
        self.conv18 = Conv3d(in_channels=int(512 / 1.718),
                             out_channels=int(512 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn18 = BatchNorm3d(int(512 / 1.718))

        # self.res5b_relu = ResidualBlock(int(512/1.718), int(512/1.718), pv)
        self.conv19 = Conv3d(in_channels=int(512 / 1.718),
                             out_channels=int(512 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn19 = BatchNorm3d(int(512 / 1.718))
        self.conv20 = Conv3d(in_channels=int(512 / 1.718),
                             out_channels=int(512 / 1.718),
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn20 = BatchNorm3d(int(512 / 1.718))

        self.avgpool = AdaptiveAvgPool3d(output_size=1)
        self.fc = torch.nn.Linear(int(512 / 1.718), 27)
Example #10
0
    def __init__(self, pv):
        super(ResNet18Explicit3DConv, self).__init__()
        # self.conv1_relu = ConvolutionBlock(3, 64, pv)
        self.conv1 = Conv3d(in_channels=3,
                            out_channels=64,
                            kernel_size=7,
                            stride=2,
                            padding=3,
                            bias=False)
        self.bn1 = BatchNorm3d(64)

        self.maxpool = MaxPool3d(kernel_size=3,
                                 padding=1,
                                 stride=2,
                                 dilation=1)

        # self.res2a_relu = ResidualBlock(64, 64, pv)
        self.conv2 = Conv3d(in_channels=64,
                            out_channels=64,
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn2 = BatchNorm3d(64)
        self.conv3 = Conv3d(in_channels=64,
                            out_channels=64,
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn3 = BatchNorm3d(64)

        # self.res2b_relu = ResidualBlock(64, 64, pv)
        self.conv4 = Conv3d(in_channels=64,
                            out_channels=64,
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn4 = BatchNorm3d(64)
        self.conv5 = Conv3d(in_channels=64,
                            out_channels=64,
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn5 = BatchNorm3d(64)

        # self.res3a_relu = ResidualBlockB(64, 128, pv)
        self.conv6 = Conv3d(in_channels=64,
                            out_channels=128,
                            kernel_size=1,
                            stride=2,
                            bias=False)
        self.bn6 = BatchNorm3d(128)
        self.conv7 = Conv3d(in_channels=64,
                            out_channels=128,
                            kernel_size=3,
                            stride=2,
                            padding=1,
                            bias=False)
        self.bn7 = BatchNorm3d(128)
        self.conv8 = Conv3d(in_channels=128,
                            out_channels=128,
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn8 = BatchNorm3d(128)

        # self.res3b_relu = ResidualBlock(128, 128, pv)
        self.conv9 = Conv3d(in_channels=128,
                            out_channels=128,
                            kernel_size=3,
                            padding=1,
                            bias=False)
        self.bn9 = BatchNorm3d(128)
        self.conv10 = Conv3d(in_channels=128,
                             out_channels=128,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn10 = BatchNorm3d(128)

        # self.res4a_relu = ResidualBlockB(128, 256, pv)
        self.conv11 = Conv3d(in_channels=128,
                             out_channels=256,
                             kernel_size=1,
                             stride=2,
                             bias=False)
        self.bn11 = BatchNorm3d(256)
        self.conv12 = Conv3d(in_channels=128,
                             out_channels=256,
                             kernel_size=3,
                             stride=2,
                             padding=1,
                             bias=False)
        self.bn12 = BatchNorm3d(256)
        self.conv13 = Conv3d(in_channels=256,
                             out_channels=256,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn13 = BatchNorm3d(256)

        # self.res4b_relu = ResidualBlock(256, 256, pv)
        self.conv14 = Conv3d(in_channels=256,
                             out_channels=256,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn14 = BatchNorm3d(256)
        self.conv15 = Conv3d(in_channels=256,
                             out_channels=256,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn15 = BatchNorm3d(256)

        # self.res5a_relu = ResidualBlockB(256, 512, pv)
        self.conv16 = Conv3d(in_channels=256,
                             out_channels=512,
                             kernel_size=1,
                             stride=2,
                             bias=False)
        self.bn16 = BatchNorm3d(512)
        self.conv17 = Conv3d(in_channels=256,
                             out_channels=512,
                             kernel_size=3,
                             stride=2,
                             padding=1,
                             bias=False)
        self.bn17 = BatchNorm3d(512)
        self.conv18 = Conv3d(in_channels=512,
                             out_channels=512,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn18 = BatchNorm3d(512)

        # self.res5b_relu = ResidualBlock(512, 512, pv)
        self.conv19 = Conv3d(in_channels=512,
                             out_channels=512,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn19 = BatchNorm3d(512)
        self.conv20 = Conv3d(in_channels=512,
                             out_channels=512,
                             kernel_size=3,
                             padding=1,
                             bias=False)
        self.bn20 = BatchNorm3d(512)

        self.avgpool = AdaptiveAvgPool3d(output_size=1)
        self.fc = torch.nn.Linear(512, pv.label_size)