https://www.kaggle.com/thedownhill/art-images-drawings-painting-sculpture-engraving


이미지 데이터 :  https://www.kaggle.com/thedownhill/art-images-drawings-painting-sculpture-engraving

이미지 데이터를 가지고 Drawing/Painting/Sculptures/Engravings/Iconography 구별하기


첫번째. 필요한 모듈 가져오기



두번째, 파라미터 설정


셋번째, 폴더에 잇는 이미지 파일 torch화 하기





















# 이미지크기를 (120,120)으로 바꾸고 이미지값을 Normalize를 시키고 trainDataset으로 바꾼다









C:\anaconda\envs\py36\lib\site-packages\torchvision\transforms\transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
  "please use transforms.Resize instead.")

7671

# 데이터 셋을 데이터 로더 형태로 변환해서 batch_size 만큰 데이터를 읽어들인다


<torch.utils.data.dataloader.DataLoader object at 0x000001B1FE41E9E8>

넷번째, 모델 생성


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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54





layer1.0.weight
layer1.0.bias
layer1.1.weight
layer1.1.bias
layer1.2.weight
layer1.2.bias
layer1.2.running_mean
layer1.2.running_var
layer1.2.num_batches_tracked
layer2.0.weight
layer2.0.bias
layer2.1.weight
layer2.1.bias
layer2.2.weight
layer2.2.bias
layer2.2.running_mean
layer2.2.running_var
layer2.2.num_batches_tracked
layer3.0.weight
layer3.0.bias
layer3.1.weight
layer3.1.bias
layer3.2.weight
layer3.2.bias
layer3.2.running_mean
layer3.2.running_var
layer3.2.num_batches_tracked
layer4.0.weight
layer4.0.bias
layer4.1.weight
layer4.1.bias
layer4.2.weight
layer4.2.bias
layer4.3.weight
layer4.3.bias
layer4.3.running_mean
layer4.3.running_var
layer4.3.num_batches_tracked
fc.0.weight
fc.0.bias
fc.2.weight
fc.2.bias
fc.4.weight
fc.4.bias
fc.6.weight
fc.6.bias

# 손실함수 optimizer 생성


다섯번째, 학습하기


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

0 Accursy : 46.74748992919922
1 Accursy : 67.48794555664062
2 Accursy : 75.1531753540039
3 Accursy : 79.03793334960938
4 Accursy : 81.81462860107422
5 Accursy : 83.47021484375
6 Accursy : 83.90040588378906
7 Accursy : 85.73849487304688
8 Accursy : 86.53369903564453
9 Accursy : 87.34193420410156
10 Accursy : 88.82804870605469
11 Accursy : 88.68465423583984
12 Accursy : 90.4706039428711
C:\anaconda\envs\py36\lib\site-packages\torch\serialization.py:250: UserWarning: Couldn't retrieve source code for container of type NNNNN1. It won't be checked for correctness upon loading.
  "type " + obj.__name__ + ". It won't be checked "

13 Accursy : 91.81332397460938 14 Accursy : 92.20440673828125 15 Accursy : 93.87303161621094 16 Accursy : 94.02946472167969 17 Accursy : 95.09842681884766 18 Accursy : 94.98109436035156 19 Accursy : 97.19723510742188 20 Accursy : 98.52691650390625 21 Accursy : 99.13961791992188 22 Accursy : 99.66105651855469 23 Accursy : 99.83053588867188 24 Accursy : 99.93482208251953 25 Accursy : 99.92178344726562 26 Accursy : 99.9869613647461 27 Accursy : 100.0 28 Accursy : 100.0

여섯번째, test 데이터 평가하기







850



<torch.utils.data.dataloader.DataLoader object at 0x000001B1FE41E9E8>


#이미지 데이터가 torch화 하면서 채널이 3이 아닌 애들이 발생하면 그 데이터를 제거 해줘야되기때문에 어느 데이터가 잘못되엇는지 확인하는 과정

2
3
4
5

# 평가하기


2
3
4
5
6
7
8
9
10
11
12

Accursy : 62.0







+ Recent posts