How to use the defcon._layers.convReLU_3D function in defcon

To help you get started, we’ve selected a few defcon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
conv_stride_1 = TimeDistributed(convReLU(16, kernel=(3,3), strides=(2,2), name='conv_stride_1'))(conv_seg_1)
    conv_seg_2 = TimeDistributed(convReLU(32, name='conv_seg_2'))(conv_stride_1)
    conv_stride_2 = TimeDistributed(convReLU(32, kernel=(3,3), strides=(2,2), name='conv_stride_2'))(conv_seg_2)
    conv_seg_3 = TimeDistributed(convReLU(64, kernel=(3,3), name='conv_seg_3'))(conv_stride_2)
    dropout_seg = TimeDistributed(Dropout(0.5, name='dropout_seg'))(conv_seg_3)
    deconv_seg_1 = TimeDistributed(deconvReLU(8, name='deconv_seg_1'))(dropout_seg)
    deconv_seg_2 = TimeDistributed(deconvReLU(8, name='decon_seg_2'))(deconv_seg_1)
    seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
        model = Model(inputs=input_, outputs=density3D)
        for layer in model.layers[2:10]:
github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
input_ = Input(shape=input_size, name='input')
    conv_seg_1 = TimeDistributed(convReLU(16, name='conv_seg_1'))(input_)
    conv_stride_1 = TimeDistributed(convReLU(16, kernel=(3,3), strides=(2,2), name='conv_stride_1'))(conv_seg_1)
    conv_seg_2 = TimeDistributed(convReLU(32, name='conv_seg_2'))(conv_stride_1)
    conv_stride_2 = TimeDistributed(convReLU(32, kernel=(3,3), strides=(2,2), name='conv_stride_2'))(conv_seg_2)
    conv_seg_3 = TimeDistributed(convReLU(64, kernel=(3,3), name='conv_seg_3'))(conv_stride_2)
    dropout_seg = TimeDistributed(Dropout(0.5, name='dropout_seg'))(conv_seg_3)
    deconv_seg_1 = TimeDistributed(deconvReLU(8, name='deconv_seg_1'))(dropout_seg)
    deconv_seg_2 = TimeDistributed(deconvReLU(8, name='decon_seg_2'))(deconv_seg_1)
    seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
conv_seg_2 = TimeDistributed(convReLU(32, name='conv_seg_2'))(conv_stride_1)
    conv_stride_2 = TimeDistributed(convReLU(32, kernel=(3,3), strides=(2,2), name='conv_stride_2'))(conv_seg_2)
    conv_seg_3 = TimeDistributed(convReLU(64, kernel=(3,3), name='conv_seg_3'))(conv_stride_2)
    dropout_seg = TimeDistributed(Dropout(0.5, name='dropout_seg'))(conv_seg_3)
    deconv_seg_1 = TimeDistributed(deconvReLU(8, name='deconv_seg_1'))(dropout_seg)
    deconv_seg_2 = TimeDistributed(deconvReLU(8, name='decon_seg_2'))(deconv_seg_1)
    seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
        model = Model(inputs=input_, outputs=density3D)
        for layer in model.layers[2:10]:
            layer.trainable = False
github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
deconv_seg_1 = TimeDistributed(deconvReLU(8, name='deconv_seg_1'))(dropout_seg)
    deconv_seg_2 = TimeDistributed(deconvReLU(8, name='decon_seg_2'))(deconv_seg_1)
    seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
        model = Model(inputs=input_, outputs=density3D)
        for layer in model.layers[2:10]:
            layer.trainable = False
    elif output == 'seg':
        model = Model(inputs=input_, outputs=seg)
    elif output == 'both':
        model = Model(inputs=input_, outputs=[density3D, seg])
github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
        model = Model(inputs=input_, outputs=density3D)
        for layer in model.layers[2:10]:
            layer.trainable = False
    elif output == 'seg':
        model = Model(inputs=input_, outputs=seg)
    elif output == 'both':
        model = Model(inputs=input_, outputs=[density3D, seg])
    else:
        raise Exception('output must be "density", "seg" or "both".')
github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
conv_stride_2 = TimeDistributed(convReLU(32, kernel=(3,3), strides=(2,2), name='conv_stride_2'))(conv_seg_2)
    conv_seg_3 = TimeDistributed(convReLU(64, kernel=(3,3), name='conv_seg_3'))(conv_stride_2)
    dropout_seg = TimeDistributed(Dropout(0.5, name='dropout_seg'))(conv_seg_3)
    deconv_seg_1 = TimeDistributed(deconvReLU(8, name='deconv_seg_1'))(dropout_seg)
    deconv_seg_2 = TimeDistributed(deconvReLU(8, name='decon_seg_2'))(deconv_seg_1)
    seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
        model = Model(inputs=input_, outputs=density3D)
        for layer in model.layers[2:10]:
            layer.trainable = False
    elif output == 'seg':
github LEB-EPFL / DEFCoN / defcon / models.py View on Github external
conv_seg_1 = TimeDistributed(convReLU(16, name='conv_seg_1'))(input_)
    conv_stride_1 = TimeDistributed(convReLU(16, kernel=(3,3), strides=(2,2), name='conv_stride_1'))(conv_seg_1)
    conv_seg_2 = TimeDistributed(convReLU(32, name='conv_seg_2'))(conv_stride_1)
    conv_stride_2 = TimeDistributed(convReLU(32, kernel=(3,3), strides=(2,2), name='conv_stride_2'))(conv_seg_2)
    conv_seg_3 = TimeDistributed(convReLU(64, kernel=(3,3), name='conv_seg_3'))(conv_stride_2)
    dropout_seg = TimeDistributed(Dropout(0.5, name='dropout_seg'))(conv_seg_3)
    deconv_seg_1 = TimeDistributed(deconvReLU(8, name='deconv_seg_1'))(dropout_seg)
    deconv_seg_2 = TimeDistributed(deconvReLU(8, name='decon_seg_2'))(deconv_seg_1)
    seg = TimeDistributed(Conv2D(2, kernel_size=(1,1),
                 use_bias= False,
                 padding='same',
                 activation='softmax',
                 name='seg'))(deconv_seg_2)

    conv3D_1 = convReLU_3D(16, name='conv3D_1')(seg)
    conv3D_2 = convReLU_3D(16, strides=(1,2,2), name='conv3D_2')(conv3D_1)
    conv3D_3 = convReLU_3D(32, name='conv3D_3')(conv3D_2)
    conv3D_4 = convReLU_3D(32, strides=(1,2,2), name='conv3D_4')(conv3D_3)
    conv3D_5 = convReLU_3D(64, name='conv3D_5')(conv3D_4)
    dropout = Dropout(0.5, name='dropout')(conv3D_5)
    up3D_1 = UpSampling3D(name='up3D_1')(dropout)
    deconv3D_1 = convReLU_3D(8, name='deconv3D_1')(up3D_1)
    up3D_2 = UpSampling3D(name='up3D_2')(deconv3D_1)
    deconv3D_2 = convReLU_3D(8, name='deconv3D_2')(up3D_2)
    density3D = Conv3D(1, kernel_size=(1,1,1),
                     use_bias= False,
                     padding='same',
                     activation='linear',
                     name='density3D')(deconv3D_2)

    if output == 'density':
        model = Model(inputs=input_, outputs=density3D)