コード例 #1
0
def linknet_inception_lite(input_shape):
    inception_base = InceptionV3Same(input_shape=input_shape)
    conv1 = inception_base.get_layer("activation_3").output
    conv2 = inception_base.get_layer("activation_5").output
    conv3 = inception_base.get_layer("mixed2").output
    conv4 = inception_base.get_layer("mixed7").output
    conv5 = inception_base.get_layer("mixed10").output
    filters = [192, 288, 768, 2048]
    feature_scale = 6
    decoder5 = decoder(conv5,
                       filters[3],
                       filters[2],
                       name='decoder5',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder5 = add([decoder5, conv4])
    decoder4 = decoder(decoder5,
                       filters[2],
                       filters[1],
                       name='decoder4',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder4 = add([decoder4, conv3])
    decoder3 = decoder(decoder4,
                       filters[1],
                       filters[0],
                       name='decoder3',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder3 = add([decoder3, conv2])
    decoder2 = decoder(decoder3,
                       filters[0],
                       filters[0],
                       name='decoder2',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder1 = concatenate([conv1, decoder2], axis=-1)
    x = deconv_bn_relu(decoder1,
                       num_channels=32,
                       kernel_size=3,
                       name="decoder1",
                       transposed_conv=True)
    x = linknet.conv_bn_relu(x, 32, 3, stride=1, padding='same', name='fc_1')
    x = linknet.conv_bn_relu(x, 32, 3, stride=1, padding='same', name='fc_2')
    x = SpatialDropout2D(0.5)(x)
    x = Conv2D(1, (1, 1), activation="sigmoid")(x)
    model = Model(inception_base.input, x)
    return model
コード例 #2
0
def linknet_resnet_50(input_shape):
    resnet_base = resnet_50(input_shape=input_shape)

    conv1 = resnet_base.get_layer("activation_1").output
    conv2 = resnet_base.get_layer("activation_10").output
    conv3 = resnet_base.get_layer("activation_22").output
    conv4 = resnet_base.get_layer("activation_40").output
    conv5 = resnet_base.get_layer("activation_49").output
    filters = [256, 512, 1024, 2048]
    feature_scale = 6
    decoder5 = decoder(conv5,
                       filters[3],
                       filters[2],
                       name='decoder5',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder5 = add([decoder5, conv4])
    decoder4 = decoder(decoder5,
                       filters[2],
                       filters[1],
                       name='decoder4',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder4 = add([decoder4, conv3])
    decoder3 = decoder(decoder4,
                       filters[1],
                       filters[0],
                       name='decoder3',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder3 = add([decoder3, conv2])
    decoder2 = decoder(decoder3,
                       filters[0],
                       filters[0],
                       name='decoder2',
                       feature_scale=feature_scale,
                       transposed_conv=True)
    decoder1 = concatenate([conv1, decoder2], axis=-1)
    x = deconv_bn_relu(decoder1,
                       num_channels=32,
                       kernel_size=3,
                       name="decoder1",
                       transposed_conv=True)
    x = linknet.conv_bn_relu(x, 32, 3, stride=1, padding='same', name='fc_1')
    x = SpatialDropout2D(0.5)(x)
    x = Conv2D(1, (1, 1), activation="sigmoid")(x)
    model = Model(resnet_base.input, x)
    return model
コード例 #3
0
ファイル: models.py プロジェクト: wangdingkang/RoadDetector
def linknet_inception_lite(input_shape):
    inception_base = InceptionV3Same(input_shape=input_shape)
    conv1 = inception_base.get_layer("activation_3").output
    conv2 = inception_base.get_layer("activation_5").output
    conv3 = inception_base.get_layer("mixed2").output
    conv4 = inception_base.get_layer("mixed7").output
    conv5 = inception_base.get_layer("mixed10").output
    filters = [192, 288, 768, 2048]
    feature_scale = 6
    decoder5 = decoder(conv5, filters[3], filters[2], name='decoder5', feature_scale=feature_scale, transposed_conv=True)
    decoder5 = add([decoder5, conv4])
    decoder4 = decoder(decoder5, filters[2], filters[1], name='decoder4', feature_scale=feature_scale, transposed_conv=True)
    decoder4 = add([decoder4, conv3])
    decoder3 = decoder(decoder4, filters[1], filters[0], name='decoder3', feature_scale=feature_scale, transposed_conv=True)
    decoder3 = add([decoder3, conv2])
    decoder2 = decoder(decoder3, filters[0], filters[0], name='decoder2', feature_scale=feature_scale, transposed_conv=True)
    decoder1 = concatenate([conv1, decoder2], axis=-1)
    x = deconv_bn_relu(decoder1, num_channels=32, kernel_size=3, name="decoder1", transposed_conv=True)
    x = linknet.conv_bn_relu(x, 32, 3, stride=1, padding='same', name='fc_1')
    x = linknet.conv_bn_relu(x, 32, 3, stride=1, padding='same', name='fc_2')
    x = SpatialDropout2D(0.5)(x)
    x = Conv2D(1, (1, 1), activation="sigmoid")(x)
    model = Model(inception_base.input, x)
    return model
コード例 #4
0
ファイル: models.py プロジェクト: wangdingkang/RoadDetector
def linknet_resnet_50(input_shape):
    resnet_base = resnet_50(input_shape=input_shape)

    conv1 = resnet_base.get_layer("activation_1").output
    conv2 = resnet_base.get_layer("activation_10").output
    conv3 = resnet_base.get_layer("activation_22").output
    conv4 = resnet_base.get_layer("activation_40").output
    conv5 = resnet_base.get_layer("activation_49").output
    filters = [256, 512, 1024, 2048]
    feature_scale = 6
    decoder5 = decoder(conv5, filters[3], filters[2], name='decoder5', feature_scale=feature_scale, transposed_conv=True)
    decoder5 = add([decoder5, conv4])
    decoder4 = decoder(decoder5, filters[2], filters[1], name='decoder4', feature_scale=feature_scale, transposed_conv=True)
    decoder4 = add([decoder4, conv3])
    decoder3 = decoder(decoder4, filters[1], filters[0], name='decoder3', feature_scale=feature_scale, transposed_conv=True)
    decoder3 = add([decoder3, conv2])
    decoder2 = decoder(decoder3, filters[0], filters[0], name='decoder2', feature_scale=feature_scale, transposed_conv=True)
    decoder1 = concatenate([conv1, decoder2], axis=-1)
    x = deconv_bn_relu(decoder1, num_channels=32, kernel_size=3, name="decoder1", transposed_conv=True)
    x = linknet.conv_bn_relu(x, 32, 3, stride=1, padding='same', name='fc_1')
    x = SpatialDropout2D(0.5)(x)
    x = Conv2D(1, (1, 1), activation="sigmoid")(x)
    model = Model(resnet_base.input, x)
    return model