사전 학습된 시중의 딥러닝 네트워크들에 대해 알아보자
텐서플로우에서 제공하는 이미지 분류 모델 library 모음
https://github.com/tensorflow/models/tree/master/research/slim
GitHub - tensorflow/models: Models and examples built with TensorFlow
Models and examples built with TensorFlow. Contribute to tensorflow/models development by creating an account on GitHub.
github.com
ImageNet Challenge
- Top-1 accuracy : 예측값이 일반적으로 생각하는 정답을 맞춘 정확도
- Top-5 accruacy : 예측한 확률이 높은 순서로 5개 내에서 정답이 있을 경우 맞춘 것으로 간주한 정확도
AlexNet
- MNIST에 CNN과 클래스가 많이 추가된 형태의 네트워크
- 8개의 레이어로 구성. 5개의 컨볼루션 레이어와 3개의 full-connected 레이어로 구성
- 두번째, 네번째, 다섯번째 컨볼루션 레이어들은 전 단계의 같은 채널의 특성맵들과만 연결
- 세번째 컨볼루션 레이어는 전 단계의 두 채널의 특성맵들과 모두 연결
- 활성화 함수 Relu 사용
- drop out 기법 사용
- 몇몇 뉴런의 값을 0으로 바꿔버린다. 따라서 그 뉴런들은 forward pass와 back propagation에 아무런 영향을 미치지 않는다. dropout은 훈련시에 적용되는 것이고, 테스트시에는 모든 뉴런을 사용
- overlapping pooling 사용
- 풀링 커널이 움직이는 보폭인 stride를 커널 사이즈보다 작게 설정해 pooling (pooling kernel 간격이 겹침)
- overlapping 풀링이 top-1, top-5 에러율을 줄이는데 좀 더 효과가 있다
Keras의 VGG 구현
VGG-16 : https://github.com/keras-team/keras-applications/blob/master/keras_applications/vgg16.py
GitHub - keras-team/keras-applications: Reference implementations of popular deep learning models.
Reference implementations of popular deep learning models. - GitHub - keras-team/keras-applications: Reference implementations of popular deep learning models.
github.com
VGG
- AlexNet 같이 이미지넷 챌린지에서 공개된 모델. 2014년 이미지넷 챌린지 준우승
- 간결한 구조로 많은 활용이 이루어짐
- 레이어 갯수에 따라 VGG16 (16층), VGG19 (19층)으로 이루어짐
- 더 작은 커널 크기 사용 (커널의 크기를 3x3으로 설정) - 파라미터 수를 감소시켜 학습시간 단축
- 더 많은 갯수의 커널 사용 (더 많은 레이어를 쌓음) - 이미지의 비선형적 특징을 더 잘 잡아내게 하기 위함
커널 크기가 작으면 갯수가 많아도 커널 크기가 큰 연산보다 학습해야하는 파라미터가 줄어듦
예) 3 x 3 필터가 3개면 총 27개의 가중치를 갖는다. 반면 7 x 7 필터는 49개의 가중치를 갖는다
Vanishing gradient
- 정의
- 시그모이드 활성함수를 사용한 모델이 깊어질수록 모델의 학습을 위한 Gradient가 사라지는 현상이 발생 이렇게 Gradient가 매우 작아져서 레이어를 학습시키기 위해 충분한 값을 표현하지 못할 경우를 vanishing gradient
- 원인
- 레이어가 깊어지면서 Gradient가 매우 커지거나 작아지기 때문. 레이어의 가중치가 반복돼서 곱해지면, 1보다 작을 때에는 0에 너무 가까워져 버리고, 1보다 클 때에는 그 값이 기하급수적으로 커지게 됨.
- 해결방안
- 활성함수 tanh, Relu 등 이용
- 가중치 초기화
Andrew Ng 교수의 Vanishing/Exploding Gradients 설명 영상
ResNet
Skip Connection이라는 구조를 사용해서 Vanishing Gradient 문제를 해결
- skip connection?
- 레이어의 입력을 다른 곳에 이어서 Gradient가 깊은 곳까지 이어지도록 하는 기법
- 아래 그림처럼 레이어와 Skip Connection이 있는 블록을 Residual Block이라 부름
Andrew Ng 교수의 ResNet에 대한 설명
Keras의 ResNet 구현
ResNet-50 : https://github.com/keras-team/keras-applications/blob/master/keras_applications/resnet50.py
GitHub - keras-team/keras-applications: Reference implementations of popular deep learning models.
Reference implementations of popular deep learning models. - GitHub - keras-team/keras-applications: Reference implementations of popular deep learning models.
github.com
'Computer Technology 기록부 > 인공지능 학습 기록부' 카테고리의 다른 글
딥러닝 레이어 이해하기 Embedding Layer, Recurrent layer (0) | 2022.02.09 |
---|---|
딥러닝 레이어 이해하기 linear, Convolution (0) | 2022.02.08 |
CS231n Lecture 06. Training Neural Network (0) | 2022.02.07 |
CS231n Lecture 05. CNN - Convolution Neural Network (0) | 2022.02.06 |
CS231n Lecture 04. Introduction to Neural Networks (0) | 2022.01.28 |
댓글