Post

[Deep Learning] 딥러닝 모델 학습 과정 시각화

keras를 활용한 딥러닝 모델 학습 과정 시각화.

✅ 딥러닝 모델 학습 과정 시각화

  • keras에서는 model.fit()을 객체로 받아서 학습 과정을 저장할 수 있다.
  • 이 객체에서 학습과정을 확인할 수 있는데, 많이 사용하는 Accuracyloss를 시각화 해보자.

✅ 코드 예시

✔ Accuracy Graph

1
2
3
4
5
6
7
8
9
10
11
12
history = model.fit(~~~~)

if not isinstance(history, dict):
    history = history.history

plt.plot(history['accuracy'])
plt.plot(history['val_accuracy'])
plt.title('Accuracy : Training vs Validation')
plt.ylabel('Accuracy')
plt.xlabel('Epoch')
plt.legend(['Training', 'Validation'], loc=0)
plt.show()

acc_graph

✔ Loss Graph

1
2
3
4
5
6
7
8
9
10
if not isinstance(history, dict):
    history = history.history

plt.plot(history['loss'])
plt.plot(history['val_loss'])
plt.title('Loss : Training vs Validation')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['Training', 'Validation'], loc=0)
plt.show()

loss_graph

This post is licensed under CC BY 4.0 by the author.

[Deep Learning] 딥러닝 모델 구조 시각화

[Deep Learning] ImageDataGenerator 사용법