Manduss life

[Deep Learning] ResNet / DenseNet 본문

전산/Deep Learning

[Deep Learning] ResNet / DenseNet

만두쓰 2023. 2. 21. 21:03

ResNet

  • Batch Normalization 사용한 layer수를 152개로 대폭 상승시킨 네트워크.
    • 이전에도 BN이 사용되었으나, 깊은 모델이 얕은 모델보다 성능이 더 안좋았다고 함. (underfitting 문제가 있었다고 함)
  • Shortcut connection (한국어로, '지름길'이란 뜻.)
    • Vanishing gradient 문제를 해결하기 위함.
    • 한 블럭의 결과값에 input 값을 더하는 구조이다.
      기존의 input x 에 대한 결과값이 H(x)라면, shortcut의 결과값은 H(x) = F(x) + x 이다. 
    • 위 수식을 풀면, F(x) = H(x) - x이다. H(x)는 현재의 결과값이고, x는 이전 블럭의 결과값이니, 잔차(Residual)로 학습이 이루어졌다는 뜻이다.
    • 논문에서 수식은 다음과 같이 표현돼있다. 

  • Bottleneck
    • training 시간을 줄이기 위해 3x3 convolution layer의 input과 output의 dimension를 줄이는 구조.
    • 기존의 Residual block은 convolution layer가 2개였다면, Bottleneck은 3개의 convoluation layer(1x1, 3x3, 1x1)로 구성됨.
    • 첫번째 1x1은 dimension를 줄여 3x3의 input를 가볍게하고, 마지막 1x1로 다시 dimension을 원상복구한다. 

ResNet의 Basic block 코드 : https://github.com/Hyunmin-H/DeepLearningStudy/blob/main/CNN%20architecture/ResNet.ipynb

 

GitHub - Hyunmin-H/DeepLearningStudy

Contribute to Hyunmin-H/DeepLearningStudy development by creating an account on GitHub.

github.com

 

DenseNet

  • ResNet과 다르게 모든 블록이 서로 연결돼있다. (ResNet은 한 블록씩 띄어서 연결이 되어있다.)
  • 스킵 연결이 아닌 이전 layer의 출력이 현재 layer의 출력과 결합된다. 
  • ResNet 보다 parameter 수가 적음
  • Transition block 사용 
    • 출력의 크기가 크게 증가하는 것을 방지하기 위함이다.
    • 1x1 convolution, Pooling layer

5개의 Dense block
Dense block 사이 layer가 Transition block(conv, pooling)
CNN/ResNet/DenseNet 비교 / 출처 : chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://pdfs.semanticscholar.org/c3d9/26a85d85a83126f405ad40ff453611148c15.pdf

 

Comments