반응형
Depth-wise Separable convolution - PyTorch Code
- Idea in Xception
: 기존의 Convolution 에서 Cross-chnnel Correlation을 분리하기 위해 제안
- Depth-wise conv 를 한 후, Point-wise conv를 하는 것을 말한다
- Spatial feature과 Channel-wise feature를 모두 고려하면서 네트워크를 경량화 한다
- Convolution 연산과 거의 유사하지만, 파라미터 수와 연산량은 훨씬 적다
import torch.nn as nn
class ConvBNReLU(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
super(ConvBNReLU, self).__init__()
self.op = nn.Sequential(
nn.Conv2d(C_in, C_in, kernel_size=kernel_size, stride=stride, padding=padding, groups=C_in, bias=False),
nn.Conv2d(C_in, C_out , kernel_size=1, padding=0, bias=False),
nn.BatchNorm2d(C_out, affine=affine),
nn.ReLU(inplace=False)
)
def forward(self, x):
return self.op(x)
2021.08.12 - [AI/ML & DL] - [ CNN ] 6. Dilated convolution - PyTorch Code
[ 참고자료 ]
https://www.slideshare.net/ssuser6135a1/ss-106656779
https://wingnim.tistory.com/104
https://eehoeskrap.tistory.com/431
반응형
'Artificial Intelligence > Neural Networks' 카테고리의 다른 글
[ CNN ] 가중치 초기화 (Weight Initialization) - PyTorch Code (0) | 2021.08.13 |
---|---|
[ CNN ] 6. Dilated convolution - PyTorch Code (0) | 2021.08.12 |
[ CNN ] 4. Depth-wise convolution - PyTorch Code (0) | 2021.08.12 |
[ CNN ] 3. Point-wise convolution - PyTorch Code (0) | 2021.08.12 |
[ CNN ] 2. Grouped convolution - PyTorch Code (0) | 2021.08.11 |