Example #1
0
def build_model():
    l_in = nn.layers.InputLayer((None, n_candidates_per_patient, 1,) + p_transform['patch_size'])
    l_in_rshp = nn.layers.ReshapeLayer(l_in, (-1, 1,) + p_transform['patch_size'])
    l_target = nn.layers.InputLayer((batch_size,))

    penultimate_layer = load_pretrained_model(l_in_rshp)

    l = drop(penultimate_layer, name='drop_final')

    l = dense(l, 128, name='dense_final')

    l = nn.layers.DenseLayer(l, num_units=1, W=nn.init.Orthogonal(),
                             nonlinearity=None, name='dense_p_benign')

    l = nn.layers.ReshapeLayer(l, (-1, n_candidates_per_patient, 1), name='reshape2patients')

    l_out = nn_lung.AggAllBenignExp(l, name='aggregate_all_nodules_benign')

    return namedtuple('Model', ['l_in', 'l_out', 'l_target'])(l_in, l_out, l_target)
def build_model():
    l_in = nn.layers.InputLayer((
        None,
        n_candidates_per_patient,
        1,
    ) + p_transform['patch_size'])
    l_in_rshp = nn.layers.ReshapeLayer(l_in, (
        -1,
        1,
    ) + p_transform['patch_size'])
    l_target = nn.layers.InputLayer((batch_size, ))

    l = dnn.Conv3DDNNLayer(l_in_rshp,
                           filter_size=3,
                           num_filters=64,
                           pad='valid',
                           W=nn.init.Orthogonal(),
                           nonlinearity=nn.nonlinearities.very_leaky_rectify)

    l = inrn_v2_red(l)
    l = inrn_v2(l)

    l = inrn_v2_red(l)
    l = inrn_v2(l)

    l = inrn_v2_red(l)
    l = inrn_v2(l)
    l = inrn_v2_red(l)

    l = nn.layers.GlobalPoolLayer(l)

    l = nn.layers.DenseLayer(l,
                             num_units=1,
                             W=nn.init.Orthogonal(),
                             nonlinearity=None)

    l = nn.layers.ReshapeLayer(l, (-1, n_candidates_per_patient, 1))

    l_out = nn_lung.AggAllBenignExp(l)

    return namedtuple('Model', ['l_in', 'l_out', 'l_target'])(l_in, l_out,
                                                              l_target)
Example #3
0
def build_model():
    l_in = nn.layers.InputLayer((
        None,
        n_candidates_per_patient,
        1,
    ) + p_transform['patch_size'])
    l_in_un = nn_lung.Unbroadcast(l_in)
    l_in_rshp = nn.layers.ReshapeLayer(l_in_un, (
        -1,
        1,
    ) + p_transform['patch_size'])
    l_target = nn.layers.InputLayer((batch_size, ))

    l = conv3(l_in_rshp, num_filters=128)
    l = conv3(l, num_filters=128)

    l = max_pool(l)

    l = conv3(l, num_filters=128)
    l = conv3(l, num_filters=128)

    l = max_pool(l)

    l = conv3(l, num_filters=256)
    l = conv3(l, num_filters=256)
    l = conv3(l, num_filters=256)

    l = dense_prelu_layer(l, num_units=512)
    l = dense_prelu_layer(l, num_units=512)
    l = nn.layers.DenseLayer(l,
                             num_units=1,
                             W=nn.init.Orthogonal(),
                             nonlinearity=None)

    l = nn.layers.ReshapeLayer(l, (-1, n_candidates_per_patient, 1))

    l_out = nn_lung.AggAllBenignExp(l)

    return namedtuple('Model', ['l_in', 'l_out', 'l_target'])(l_in, l_out,
                                                              l_target)