바뀜

둘러보기로 가기 검색하러 가기
1,423 바이트 추가됨 ,  2021년 12월 2일 (목) 13:07
85번째 줄: 85번째 줄:     
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
=== input ===
 +
데이터별로 input의 형태가 달라진다.
 +
{| class="wikitable"
 +
!의도
 +
!설명
 +
!방법
 +
|-
 +
|이미지
 +
|가로세로 200인 이미지는 다음과 같이 변형해 사용된다.
 +
(samples, height, width, channels) 혹은 (samples, channels, height, width)로 입력한다.
 +
|images.reshape((이미지갯수, 200 * 200))
 +
images.astype('float32')/255  # 값을 0~1 사이로 정규화 한다. float32와 64의 차이는 무엇일까?
 +
|-
 +
|동영상
 +
|이미지에 frame을 추가한다.
 +
(samples, frame, height, width, channels) 형태.
 +
|
 +
|-
 +
|시계열
 +
|(samples, timesteps, features) 형태로 입력한다.
 +
|
 +
|-
 +
|텍스트
 +
|2만개의 단어를 가진 사전으로 만든 데이터셋으로 분석할 때, 500개 문서의 데이터셋은..
 +
(500, 20000) 형태이다.
 +
|
 +
|}
 +
 +
=== 레이블 변형 ===
 +
{| class="wikitable"
 +
!의도
 +
!설명
 +
!방법
 +
|-
 +
|범주형 인코딩
 +
|레이블을 범주형으로 인코딩한다.
 +
|<syntaxhighlight lang="python">
 +
from keras.utils import to_categorical
 +
 +
lable = to_categorical(lable)
 +
</syntaxhighlight>
 +
|}
    
= 모델 교육 =
 
= 모델 교육 =
 +
 +
== 컴파일 ==
 +
모델을 어떻게 교육할 것인가에 대한 설정.<syntaxhighlight lang="python">
 +
model.compile(optimizer= 'rmsprop',                # 어떻게 교육할 것인가.
 +
                loss= 'categorical_crossentropy',  # 손실함수.
 +
                metrics= ['accuracy'])              # 모니터링 지표.
 +
</syntaxhighlight>
 +
 +
== 교육 ==
 
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
 
model.fit(x, y,
 
model.fit(x, y,

둘러보기 메뉴