Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 프로그래머스파이썬
- deep learning
- Pruning Tutorial
- 커피후기
- Paper list
- ECCV
- 프로그래머스
- 프로그래머스게임맵최단거리
- 프로그래머스타겟넘버정답
- Faster R-CNN
- 코딩테스트연습
- One stage detector
- 프로그래머스너비우선탐색
- Two stage Detector
- 코딩테스트네트워크
- ssd
- SSD 리뷰
- pytorch
- 프로그래머스네트워크
- Single Shot MultiBox Detector
- 코딩테스트2단계
- Code Study
- Object Detection
- 프로그래머스타겟넘버파이썬
- 타겟넘버bfs
- 최솟값 만들기
- 다음큰숫자
- 프로그래머스타겟넘버
- 프로그래머스bfs
- Pytorch pruning
Archives
- Today
- Total
soyeonland
3D Convolution 본문
a=torch.Tensor
([[[[[1, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]],
[[[1, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]],
[[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]]]])
print(a.size())
c=nn.Conv3d(3,1,kernel_size=3,stride=1,padding=0,bias=False)
#print(c.kernel_size)
print('parameter:',list(c.parameters())[0].size())
print('parameter:',list(c.parameters()))
print('output:',c(a).size())
print(c(a))
torch.Size([1, 3, 3, 3, 3])
parameter: torch.Size([1, 3, 3, 3, 3])
parameter: [Parameter containing:
tensor([[[[[ 0.0963, -0.0892, -0.0216],
[-0.0956, -0.0681, -0.0771],
[-0.0806, 0.0087, -0.1094]],
[[ 0.1024, 0.0459, -0.0247],
[ 0.0777, -0.0914, 0.0320],
[ 0.0076, -0.1092, -0.1107]],
[[-0.0586, -0.1091, 0.0917],
[ 0.0980, 0.0100, 0.0645],
[-0.1089, 0.0556, -0.0833]]],
[[[-0.0283, 0.0584, -0.0582],
[-0.0206, -0.0328, 0.0369],
[ 0.0903, 0.1025, 0.0495]],
[[-0.1022, 0.0692, -0.0019],
[ 0.0744, -0.0196, -0.0499],
[ 0.0618, -0.0375, -0.0653]],
[[ 0.0642, 0.0721, 0.0559],
[ 0.0326, -0.0983, 0.0013],
[ 0.0132, -0.0825, 0.0183]]],
[[[-0.0428, -0.0781, -0.1067],
[ 0.0123, -0.0801, 0.1090],
[-0.0895, 0.0606, -0.0247]],
[[-0.0524, -0.0748, 0.0461],
[-0.1102, -0.0550, -0.0648],
[ 0.0374, -0.1109, 0.0591]],
[[ 0.0328, -0.0591, 0.0898],
[-0.0086, -0.1068, 0.0611],
[ 0.0645, -0.0241, -0.0358]]]]], requires_grad=True)]
output: torch.Size([1, 1, 1, 1, 1])
tensor([[[[[0.0680]]]]], grad_fn=<ThnnConv3DBackward>)
0.0963-0.0283=0.0680
a=torch.Tensor(
[[[[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[1, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]],
[[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]],
[[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]]]])
print(a.size())
#print(a)
c=nn.Conv3d(3,1,kernel_size=3,stride=1,padding=0,bias=False)
#print(c.kernel_size)
print('parameter:',list(c.parameters())[0].size())
print('parameter:',list(c.parameters()))
print('output:',c(a).size())
print(c(a))
torch.Size([1, 3, 4, 4, 3])
parameter: torch.Size([1, 3, 3, 3, 3])
parameter: [Parameter containing:
tensor([[[[[-0.0322, -0.0171, 0.0772],
[ 0.0457, -0.0895, 0.0420],
[-0.0041, -0.0943, 0.0544]],
[[-0.0073, -0.0972, 0.0987],
[ 0.0156, 0.0337, 0.0930],
[ 0.0870, -0.0117, 0.0135]],
[[ 0.0989, 0.0122, 0.0637],
[-0.0081, -0.0978, -0.0976],
[-0.0183, -0.0734, 0.0018]]],
[[[ 0.1081, 0.0143, 0.0393],
[ 0.1051, -0.1046, 0.0843],
[ 0.0247, 0.0990, -0.0842]],
[[-0.0996, 0.0797, -0.0786],
[ 0.0521, 0.0205, -0.0817],
[ 0.0725, 0.0032, -0.0549]],
[[-0.0191, 0.0530, 0.0610],
[ 0.0903, 0.0611, 0.1045],
[ 0.0710, 0.1000, -0.1012]]],
[[[ 0.0978, 0.0958, 0.0387],
[-0.0788, 0.0464, -0.0106],
[-0.0678, -0.0065, 0.0845]],
[[-0.0376, -0.0325, -0.0785],
[ 0.1079, 0.0447, 0.0608],
[ 0.0972, -0.0460, 0.0304]],
[[-0.0019, 0.0226, -0.1037],
[ 0.0025, 0.0582, 0.0162],
[-0.1090, -0.0908, -0.0908]]]]], requires_grad=True)]
output: torch.Size([1, 1, 2, 2, 1])
tensor([[[[[0.0000],
[0.0000]],
[[0.0989],
[0.0000]]]]], grad_fn=<ThnnConv3DBackward>)
1.depth도 height/weight 계산하는 것 처럼 계산
2.depth는 맞춰주지 않음 4 였을때 첫번째 filter 재사용 (Conv3D 의 정의:Conv를 3D 방향으로 한다.)
'Study > Code Review' 카테고리의 다른 글
Github 모음(weight freeze) (0) | 2020.08.30 |
---|---|
Github 모음(weight copy , pruning) (0) | 2020.08.16 |
Learning both weights and connections for Efficient Neural Networks-(2) (0) | 2020.03.22 |
Learning both weights and connections for Efficient Neural Networks-(1) (0) | 2020.03.22 |
Pruning Tutorial (0) | 2020.03.22 |