[멋사][AI] 딥러닝 모델 - LeNet

티나(Tina)·2022년 12월 8일

멋사AI

목록 보기
39/41

LeNet (1988)

참고
LeNet-5 논문 리뷰, 구현(tensorflow)
딥러닝 텐서플로 교과서: 6.1.1 LeNet-5
[CNN 알고리즘들] LeNet-5의 구조
LeNet - Wikipedia

LeNetCNN을 처음으로 개발한 얀 르쿤(Yann Lecun) 연구팀이 1998년에 개발한 CNN 알고리즘의 이름이다. 1988년부터 연구되어 왔으며 최종 버전은 LeNet-5 이다.
LeNet은 초기 합성곱신경망의 대표주자로서
Convolutional Layer, Pooling Layer, Full Connection Layer
합성곱신경망의 기본 단위를 보유하고 있어 향후 합성곱신경망의 발전을 위한 기반을 마련 했다.

위키피디아 LeNet

LeNet-5

💡 LeNet-5 구성

  • 3개의 컨볼루션 레이어(C1, C3, C5)
  • 2개의 서브샘플링 레이어(S2, S4) - 풀링층
  • 1층의 full-connected 레이어(F6)
    • C1부터 F6까지 활성화 함수로 tanh를 사용

💡 LeNet-5 구조

  • Layer C1은 5x5size와 strides=1인 6개의 kernel로 이루어진 합성곱 층이다.
    • 28×28 크기의 feature map 6 개 생성
  • Layer S2는 sum-sampling 층으로 2x2 size와 strides=2인 6개의 kernel로 이루어진 층이다.
    • feature map 크기를 14×14로 줄인다.
  • Layer C3는 5x5 size와 strides=1인 16개의 kernel로 이루어진 합성곱 층이다.
    • 10×10 크기의 feature map 16개를 생성한다.
  • Layer S4는 S2와 같은 기능을 하는 sub-sampling 층이다.
    • feature map 크기를 5×5로 줄인다.
  • Layer C5는 5x5 size와 strides=1인 120개의 kernel로 이루어진 합성곱 층이다.
    • 1×1 크기의 특성 맵 120개를 생성
  • Layer F6는 tanh 함수를 활성화 함수로 사용하는 fully-connected layer 이다.
  • 출력층은 Euclidean Radial Basis Function(RBF)을 활성화 함수로 사용한다.
  • loss function은 MSE를 사용한다.

MNIST 데이터로 LeNet-5실습해보기

딥러닝 텐서플로 교과서 - 더북(TheBook)

model = tf.keras.models.Sequential([
        tf.keras.layers.Conv2D(6,5,strides=1,activation='relu',input_shape=(28,28,1),padding='same'),
        tf.keras.layers.AvgPool2D(2,strides=2),
        tf.keras.layers.Conv2D(16,5,strides=1,activation='relu'),
        tf.keras.layers.AvgPool2D(2,strides=2),
        tf.keras.layers.Conv2D(120,5,strides=1,activation='relu'),
        tf.keras.layers.Flatten(),
        tf.keras.layers.Dense(84,activation='tanh'),
        tf.keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.summary()

얀르쿤 연구팀의 논문 자료

Gradient-based learning applied to document recognition

MNIST Demos on Yann LeCun's website

profile
열심히 사는 중

0개의 댓글