基于Vgg-Unet模型自动驾驶场景检测

这篇具有很好参考价值的文章主要介绍了基于Vgg-Unet模型自动驾驶场景检测。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1.VGG

VGG全称是Visual Geometry Group属于牛津大学科学工程系,其发布了一些列以VGG开头的卷积网络模型,可以应用在人脸识别、图像分类等方面,VGG的输入被设置为大小为224x244的RGB图像。为训练集图像上的所有图像计算平均RGB值,然后将该图像作为输入输入到VGG卷积网络。使用3x3或1x1滤波器,并且卷积步骤是固定的。有3个VGG全连接层,根据卷积层+全连接层的总数,可以从VGG11到VGG19变化。最小VGG11具有8个卷积层和3个完全连接层。最大VGG19具有16个卷积层+3个完全连接的层。此外,VGG网络后面没有每个卷积层后面的池化层,也没有分布在不同卷积层下的总共5个池化层。
结构图如下:
基于Vgg-Unet模型自动驾驶场景检测,自动驾驶,深度学习,人工智能
架构图
基于Vgg-Unet模型自动驾驶场景检测,自动驾驶,深度学习,人工智能

2.Unet模型:

Unet是一个优秀的语义分割模型,其主要执行过程与其它语义分割模型类似。与CNN不同的之处在于CNN是图像级的分类,而unet是像素级的分类,其输出的是每个像素点的类别
基于Vgg-Unet模型自动驾驶场景检测,自动驾驶,深度学习,人工智能

主要代码如下:文章来源地址https://www.toymoban.com/news/detail-694843.html

def get_vgg_encoder(input_height=224,  input_width=224, channels=3):

    if channel == 'channels_first':
        img_input = Input(shape=(channels, input_height, input_width))
    elif channel == 'channels_last':
        img_input = Input(shape=(input_height, input_width, channels))

    x = Conv2D(64, (3, 3), activation='relu', padding='same',
               name='block1_conv1', data_format=channel)(img_input)
    x = Conv2D(64, (3, 3), activation='relu', padding='same',
               name='block1_conv2', data_format=channel)(x)
    x = MaxPooling2D((2, 2), strides=(2, 2), name='block1_pool',
                     data_format=channel)(x)
    f1 = x
    # Block 2
    x = Conv2D(128, (3, 3), activation='relu', padding='same',
               name='block2_conv1', data_format=channel)(x)
    x = Conv2D(128, (3, 3), activation='relu', padding='same',
               name='block2_conv2', data_format=channel)(x)
    x = MaxPooling2D((2, 2), strides=(2, 2), name='block2_pool',
                     data_format=channel)(x)
    f2 = x

    # Block 3
    x = Conv2D(256, (3, 3), activation='relu', padding='same',
               name='block3_conv1', data_format=channel)(x)
    x = Conv2D(256, (3, 3), activation='relu', padding='same',
               name='block3_conv2', data_format=channel)(x)
    x = Conv2D(256, (3, 3), activation='relu', padding='same',
               name='block3_conv3', data_format=channel)(x)
    x = MaxPooling2D((2, 2), strides=(2, 2), name='block3_pool',
                     data_format=channel)(x)
    f3 = x

    # Block 4
    x = Conv2D(512, (3, 3), activation='relu', padding='same',
               name='block4_conv1', data_format=channel)(x)
    x = Conv2D(512, (3, 3), activation='relu', padding='same',
               name='block4_conv2', data_format=channel)(x)
    x = Conv2D(512, (3, 3), activation='relu', padding='same',
               name='block4_conv3', data_format=channel)(x)
    x = MaxPooling2D((2, 2), strides=(2, 2), name='block4_pool',
                     data_format=channel)(x)
    f4 = x

    # Block 5
    x = Conv2D(512, (3, 3), activation='relu', padding='same',
               name='block5_conv1', data_format=channel)(x)
    x = Conv2D(512, (3, 3), activation='relu', padding='same',
               name='block5_conv2', data_format=channel)(x)
    x = Conv2D(512, (3, 3), activation='relu', padding='same',
               name='block5_conv3', data_format=channel)(x)
    x = MaxPooling2D((2, 2), strides=(2, 2), name='block5_pool',
                     data_format=channel)(x)
    f5 = x

    return img_input, [f1, f2, f3, f4, f5]

def _unet(classes, encoder, l1_skip_conn=True, input_height=416,
          input_width=608, channels=3):

    img_input, levels = encoder(
        input_height=input_height, input_width=input_width, channels=channels)
    [f1, f2, f3, f4, f5] = levels

    o = f4

    o = (ZeroPadding2D((1, 1), data_format=channel))(o)
    o = (Conv2D(512, (3, 3), padding='valid' , activation='relu' , data_format=channel))(o)
    o = (BatchNormalization())(o)

    o = (UpSampling2D((2, 2), data_format=channel))(o)
    o = (concatenate([o, f3], axis=-1))
    o = (ZeroPadding2D((1, 1), data_format=channel))(o)
    o = (Conv2D(256, (3, 3), padding='valid', activation='relu' , data_format=channel))(o)
    o = (BatchNormalization())(o)

    o = (UpSampling2D((2, 2), data_format=channel))(o)
    o = (concatenate([o, f2], axis=-1))
    o = (ZeroPadding2D((1, 1), data_format=channel))(o)
    o = (Conv2D(128, (3, 3), padding='valid' , activation='relu' , data_format=channel))(o)
    o = (BatchNormalization())(o)

    o = (UpSampling2D((2, 2), data_format=channel))(o)

    if l1_skip_conn:
        o = (concatenate([o, f1], axis=-1))

    o = (ZeroPadding2D((1, 1), data_format=channel))(o)
    o = (Conv2D(64, (3, 3), padding='valid', activation='relu', data_format=channel, name="seg_feats"))(o)
    o = (BatchNormalization())(o)

    o = Conv2D(classes, (3, 3), padding='same',
               data_format=channel)(o)

    model = get_segmentation_model(img_input, o)

    return model

到了这里,关于基于Vgg-Unet模型自动驾驶场景检测的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包