ImageNet LSVRC-2010 context(이미지를 1000개의 class로 분류하는 대회)에서 우승한 모델로 딥러닝 CNN을 사용하여 image-classification 하는 연구 발전에 큰 영향을 주었다.
- top1-error rate: 37.5%
- top5-error rate: 17.0%
5개의 Convolutional layers와 따라서 연결되는 Max-pooling layers, 3개의 fully-connected layers, 마지막 layer은 1000개의 softmax함수로 이미지를 분류하는 모델로 되어있다.
Overfitting 문제를 해결하기 위해 dropout이라는 정규화 방법을 발전시켰다.
The Dataset
Dataset은 ILSVRC-2010(label이 모두 주어진 유일한 데이터)을 이용하여 훈련시켰다.(supervised-learning)
The Architecture
모형에서는 크게 3가지만 생각하면 된다.
- ReLU Nonlinearity
- Convolutional neural network
- Local Response Normalization
ReLU Nonlinearity
Convolutional neural network(Overlapping Pooling)
Overlapping pooling은 Non overlapping pooling보다 top-1, top-5 error rate에서 0.4% 그리고 0.3% error rate가 줄어든 모습을 보여준다.
Local Response Normalization
https://pytorch.org/docs/stable/generated/torch.nn.LocalResponseNorm.html
LocalResponseNorm — PyTorch 2.0 documentation
Shortcuts
pytorch.org
Reducing Overfitting
- Data Augmentation
- Drops out
모델 코드
아래 유튜브를 참고하였다.
https://www.youtube.com/watch?v=3uNu5x2wZ5s
import torch
import torch.nn as nn
class AlexNet(nn.Module):
def __init__(self,in_channels=3, classes=1000):
super().__init__()
self.c1 = nn.Conv2d(in_channels=in_channels, out_channels = 96, kernel_size=11, stride=4, padding=0)
self.c2 = nn.Conv2d(in_channels=96, out_channels = 256, kernel_size=5, stride=1, padding=2)
self.c3 = nn.Conv2d(in_channels=256, out_channels = 384, kernel_size=3, stride=1, padding=1)
self.c4 = nn.Conv2d(in_channels=384, out_channels = 384, kernel_size=3, stride=1, padding=1)
self.c5 = nn.Conv2d(in_channels=384, out_channels = 256, kernel_size=3, stride=1, padding=1)
self.fc1 = nn.Linear(6*6*256,4096)
self.fc2 = nn.Linear(4096,4096)
self.fc3 = nn.Linear(4096,classes)
self.norm = nn.LocalResponseNorm(size=5)
self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2)
self.relu = nn.ReLU()
self.weight_init()
def forward(self, x):
x = self.maxpool(self.norm(self.relu(self.c1(x))))
x = self.maxpool(self.norm(self.relu(self.c2(x))))
x = self.relu(self.c3(x))
x = self.relu(self.c4(x))
print(x.shape)
x = self.maxpool(self.relu(self.c5(x)))
print(x.shape)
x = torch.flatten(x,1)
print(x.shape)
x = self.relu(self.fc1(x))
x = self.relu(self.fc2(x))
x = self.fc3(x)
return x
def weight_init(self):
bias = [1,3,4,5,6,7]
for i, layer in enumerate(self.modules()):
if layer is nn.Conv2d or layer is nn.Linear:
nn.init.normal_(mean=0, std=0.01)
if i in bias:
nn.init.constant_(layer, 1)
else:
nn.init.constant_(layer, 0)
'논문 정리' 카테고리의 다른 글
[R-CNN] Rich feature hierarchies for accurate object detection and semantic segmentation Tech report(v5) (0) | 2023.11.10 |
---|---|
[서지관리도구] EndNote 20 (0) | 2023.10.10 |
댓글