scripts/models.py
def PSP_net(input_img, n_filters, dropout, batchnorm = True):
    '''
    For this model output is 1/8 of the input size
    '''
    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)
    #c4 = MaxPooling2D((2, 2))(c4)
    p4 = Dropout(dropout)(c4)
    
    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)
    
    #Transition
    ctr = PSP_module(c5, n_filters*16)
    
    outputs = Conv2D(output_ch, (1, 1))(ctr)#, activation='softmax'
    model = Model(inputs=[input_img], outputs=[outputs])
    return model

    For this model output is 1/8 of the input size
    
For this model output is 1/8 of the input size
For this model output is 1 / 8 of the input size
def PSP_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 = Dropout(dropout)(c4)
    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)
    ctr = PSP_module(c5, n_filters*16)
    outputs = Conv2D(output_ch, (1, 1))(ctr)
    model = Model(inputs=[input_img], outputs=[outputs])
    return model
def PSP_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 = Dropout ( dropout ) ( c4 ) 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 ) ctr = PSP_module ( c5 , n_filters * 16 ) outputs = Conv2D ( output_ch , ( 1 , 1 ) ) ( ctr ) model = Model ( inputs = [ input_img ] , outputs = [ outputs ] ) return model
For this model output is 1/8 of the input size
For this model output is 1 / 8 of the input size
'''
    For this model output is 1/8 of the input size
    ''' # Contracting Path
 #c4 = MaxPooling2D((2, 2))(c4)
 #Transition
 #, activation='softmax'

input_img
n_filters
dropout
batchnorm