前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >深度学习: LeNet 网络

深度学习: LeNet 网络

作者头像
JNingWei
发布2018-09-27 15:52:58
6330
发布2018-09-27 15:52:58
举报
文章被收录于专栏:JNing的专栏

Introduce

1998年的 LeNet-5 标志着 CNN的真正面世

该网络在字符识别上取得了高于99%的准确率,因此主要被用于字符识别的卷积神经网络。

但是这个模型在后来的一段时间并未能火起来,主要原因是费机器(当时尚未有GPU),而且在非OCR的任务上,其他的算法(如SVM)也能达到类似的效果甚至超过。

Structure

LeNet=(conv+maxpooling)×2+fc×2+GaussianLeNet=(conv+maxpooling)×2+fc×2+Gaussian

LeNet = (conv+maxpooling)×2 + fc×2 + Gaussian

这里写图片描述
这里写图片描述

其中,每一个“矩形”代表一张特征图,最后是两层全连接层。

Code

标准代码引自 BVLC/caffe/examples/mnist/lenet.prototxt

代码语言:javascript
复制
name: "LeNet"

# ========== 输入 ==========
layer {
  name: "data"
  type: "Input"
  top: "data"
  input_param { shape: { dim: 64 dim: 1 dim: 28 dim: 28 } }
}

# ========== 第一层 ==========
layer {    # 卷积
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 20
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {    # max池化
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}

# ========== 第二层 ==========
layer {    # 卷积
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 50
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {    # max池化
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}

# ========== 第三层 ==========
layer {    # 全连接
  name: "ip1"
  type: "InnerProduct"
  bottom: "pool2"
  top: "ip1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {    # relu激活函数
  name: "relu1"
  type: "ReLU"
  bottom: "ip1"
  top: "ip1"
}

# ========== 第四层 ==========
layer {    # 全连接
  name: "ip2"
  type: "InnerProduct"
  bottom: "ip1"
  top: "ip2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 10
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {    # Softmax
  name: "prob"
  type: "Softmax"
  bottom: "ip2"
  top: "prob"
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017年12月21日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Introduce
  • Structure
  • Code
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档