scripts/models.py
def GCN_net(input_img, n_filters, dropout, batchnorm = True):
    '''
    This one is designed for 512x512 input
    '''
    c0 = Conv2D(starting_ch, kernel_size = (7, 7), kernel_initializer = 'he_normal', padding = 'same')(input_img)
    c0 = BatchNormalization()(c0)
    c0 = Activation('relu')(c0)
    # Contracting Path
    c1 = SE_ResNet(c0, n_filters * 1, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    c1 = SE_ResNet0(c1, n_filters * 1, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)  
    p1 = MaxPooling2D((2, 2))(c1)
    p1 = Dropout(dropout)(p1)
    
    c2 = SE_ResNet(p1, n_filters * 2, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    c2 = SE_ResNet0(c2, n_filters * 2, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    p2 = MaxPooling2D((2, 2))(c2)
    p2 = Dropout(dropout)(p2)
    
    c3 = SE_ResNet(p2, n_filters * 4, kernel_size = 3, batchnorm = batchnorm, dil_rate = 2)
    c3 = SE_ResNet0(c3, n_filters * 4, kernel_size = 3, batchnorm = batchnorm, dil_rate = 2)
    p3 = MaxPooling2D((2, 2))(c3)
    p3 = Dropout(dropout)(p3)
    
    c4 = SE_ResNet(p3, n_filters * 8, kernel_size = 3, batchnorm = batchnorm, dil_rate = 4)
    c4 = SE_ResNet0(c4, n_filters * 8, kernel_size = 3, batchnorm = batchnorm, dil_rate = 4)
    p4 = MaxPooling2D((2, 2))(c4)
    p4 = Dropout(dropout)(p4)
    
    c5 = SE_ResNet(p4, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 8)
    c5 = SE_ResNet0(c5, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 8)
    c5 = Dropout(dropout)(c5)
    c5 = SE_ResNet(p4, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    c5 = SE_ResNet0(c5, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    p5 = MaxPooling2D((2, 2))(c5)
    p5 = Dropout(dropout)(p5)
    
    # Expanding Path
    u5 = GCN(p5, output_ch, kernel_size = 15)
    u5 = BR(u5, output_ch)
    c6 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u5)
    c6 = Dropout(dropout)(c6)
    
    u4 = GCN(p4, output_ch, kernel_size = 15)
    u4 = BR(u4, output_ch)
    u4 = add([u4, c6])
    u4 = BR(u4, output_ch)
    c7 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u4)
    
    u3 = GCN(p3, output_ch, kernel_size = 15)
    u3 = BR(u3, output_ch)
    u3 = add([u3, c7])
    u3 = BR(u3, output_ch)
    c8 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u3)
    
    u2 = GCN(p2, output_ch, kernel_size = 15)
    u2 = BR(u2, output_ch)
    u2 = add([u2, c8])
    u2 = BR(u2, output_ch)
    c9 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u2)
    
    c10 = BR(c9, output_ch)
    c11 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(c10)
    c11 = BR(c11, output_ch)
    
    outputs = Conv2D(output_ch, (1, 1))(c11)#, activation='softmax'
    model = Model(inputs=[input_img], outputs=[outputs])
    return model

    This one is designed for 512x512 input
    
This one is designed for 512x512 input
This one is designed for 512x512 input
def GCN_net(input_img, n_filters, dropout, batchnorm = True):
    c0 = Conv2D(starting_ch, kernel_size = (7, 7), kernel_initializer = 'he_normal', padding = 'same')(input_img)
    c0 = BatchNormalization()(c0)
    c0 = Activation('relu')(c0)
    c1 = SE_ResNet(c0, n_filters * 1, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    c1 = SE_ResNet0(c1, n_filters * 1, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)  
    p1 = MaxPooling2D((2, 2))(c1)
    p1 = Dropout(dropout)(p1)
    c2 = SE_ResNet(p1, n_filters * 2, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    c2 = SE_ResNet0(c2, n_filters * 2, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    p2 = MaxPooling2D((2, 2))(c2)
    p2 = Dropout(dropout)(p2)
    c3 = SE_ResNet(p2, n_filters * 4, kernel_size = 3, batchnorm = batchnorm, dil_rate = 2)
    c3 = SE_ResNet0(c3, n_filters * 4, kernel_size = 3, batchnorm = batchnorm, dil_rate = 2)
    p3 = MaxPooling2D((2, 2))(c3)
    p3 = Dropout(dropout)(p3)
    c4 = SE_ResNet(p3, n_filters * 8, kernel_size = 3, batchnorm = batchnorm, dil_rate = 4)
    c4 = SE_ResNet0(c4, n_filters * 8, kernel_size = 3, batchnorm = batchnorm, dil_rate = 4)
    p4 = MaxPooling2D((2, 2))(c4)
    p4 = Dropout(dropout)(p4)
    c5 = SE_ResNet(p4, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 8)
    c5 = SE_ResNet0(c5, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 8)
    c5 = Dropout(dropout)(c5)
    c5 = SE_ResNet(p4, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    c5 = SE_ResNet0(c5, n_filters = n_filters * 16, kernel_size = 3, batchnorm = batchnorm, dil_rate = 1)
    p5 = MaxPooling2D((2, 2))(c5)
    p5 = Dropout(dropout)(p5)
    u5 = GCN(p5, output_ch, kernel_size = 15)
    u5 = BR(u5, output_ch)
    c6 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u5)
    c6 = Dropout(dropout)(c6)
    u4 = GCN(p4, output_ch, kernel_size = 15)
    u4 = BR(u4, output_ch)
    u4 = add([u4, c6])
    u4 = BR(u4, output_ch)
    c7 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u4)
    u3 = GCN(p3, output_ch, kernel_size = 15)
    u3 = BR(u3, output_ch)
    u3 = add([u3, c7])
    u3 = BR(u3, output_ch)
    c8 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u3)
    u2 = GCN(p2, output_ch, kernel_size = 15)
    u2 = BR(u2, output_ch)
    u2 = add([u2, c8])
    u2 = BR(u2, output_ch)
    c9 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(u2)
    c10 = BR(c9, output_ch)
    c11 = Conv2DTranspose(output_ch, (3, 3), strides = (2, 2), padding = 'same')(c10)
    c11 = BR(c11, output_ch)
    outputs = Conv2D(output_ch, (1, 1))(c11)
    model = Model(inputs=[input_img], outputs=[outputs])
    return model
def GCN_net ( input_img , n_filters , dropout , batchnorm = True ) : c0 = Conv2D ( starting_ch , kernel_size = ( 7 , 7 ) , kernel_initializer = 'he_normal' , padding = 'same' ) ( input_img ) c0 = BatchNormalization ( ) ( c0 ) c0 = Activation ( 'relu' ) ( c0 ) c1 = SE_ResNet ( c0 , n_filters * 1 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 1 ) c1 = SE_ResNet0 ( c1 , n_filters * 1 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 1 ) p1 = MaxPooling2D ( ( 2 , 2 ) ) ( c1 ) p1 = Dropout ( dropout ) ( p1 ) c2 = SE_ResNet ( p1 , n_filters * 2 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 1 ) c2 = SE_ResNet0 ( c2 , n_filters * 2 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 1 ) p2 = MaxPooling2D ( ( 2 , 2 ) ) ( c2 ) p2 = Dropout ( dropout ) ( p2 ) c3 = SE_ResNet ( p2 , n_filters * 4 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 2 ) c3 = SE_ResNet0 ( c3 , n_filters * 4 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 2 ) p3 = MaxPooling2D ( ( 2 , 2 ) ) ( c3 ) p3 = Dropout ( dropout ) ( p3 ) c4 = SE_ResNet ( p3 , n_filters * 8 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 4 ) c4 = SE_ResNet0 ( c4 , n_filters * 8 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 4 ) p4 = MaxPooling2D ( ( 2 , 2 ) ) ( c4 ) p4 = Dropout ( dropout ) ( p4 ) c5 = SE_ResNet ( p4 , n_filters = n_filters * 16 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 8 ) c5 = SE_ResNet0 ( c5 , n_filters = n_filters * 16 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 8 ) c5 = Dropout ( dropout ) ( c5 ) c5 = SE_ResNet ( p4 , n_filters = n_filters * 16 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 1 ) c5 = SE_ResNet0 ( c5 , n_filters = n_filters * 16 , kernel_size = 3 , batchnorm = batchnorm , dil_rate = 1 ) p5 = MaxPooling2D ( ( 2 , 2 ) ) ( c5 ) p5 = Dropout ( dropout ) ( p5 ) u5 = GCN ( p5 , output_ch , kernel_size = 15 ) u5 = BR ( u5 , output_ch ) c6 = Conv2DTranspose ( output_ch , ( 3 , 3 ) , strides = ( 2 , 2 ) , padding = 'same' ) ( u5 ) c6 = Dropout ( dropout ) ( c6 ) u4 = GCN ( p4 , output_ch , kernel_size = 15 ) u4 = BR ( u4 , output_ch ) u4 = add ( [ u4 , c6 ] ) u4 = BR ( u4 , output_ch ) c7 = Conv2DTranspose ( output_ch , ( 3 , 3 ) , strides = ( 2 , 2 ) , padding = 'same' ) ( u4 ) u3 = GCN ( p3 , output_ch , kernel_size = 15 ) u3 = BR ( u3 , output_ch ) u3 = add ( [ u3 , c7 ] ) u3 = BR ( u3 , output_ch ) c8 = Conv2DTranspose ( output_ch , ( 3 , 3 ) , strides = ( 2 , 2 ) , padding = 'same' ) ( u3 ) u2 = GCN ( p2 , output_ch , kernel_size = 15 ) u2 = BR ( u2 , output_ch ) u2 = add ( [ u2 , c8 ] ) u2 = BR ( u2 , output_ch ) c9 = Conv2DTranspose ( output_ch , ( 3 , 3 ) , strides = ( 2 , 2 ) , padding = 'same' ) ( u2 ) c10 = BR ( c9 , output_ch ) c11 = Conv2DTranspose ( output_ch , ( 3 , 3 ) , strides = ( 2 , 2 ) , padding = 'same' ) ( c10 ) c11 = BR ( c11 , output_ch ) outputs = Conv2D ( output_ch , ( 1 , 1 ) ) ( c11 ) model = Model ( inputs = [ input_img ] , outputs = [ outputs ] ) return model
This one is designed for 512x512 input
This one is designed for 512x512 input
'''
    This one is designed for 512x512 input
    ''' # Contracting Path
 # Expanding Path
 #, activation='softmax'

input_img
n_filters
dropout
batchnorm