반응형

 본 게시글은 필자가 강의, 책 등을 통해 개인적으로 학습한 것으로

본문의 모든 정보는 출처를 기반으로 작성되었습니다.

 

Tensorboard는 학습 결과에 대한 시각화를 도와주는 도구이다.

기본적으로는 epoch에 따른 실시간의 accuracy, loss값을 눈으로 확인 할 수 있으며 

서로 다른 model을 동시에 비교하는것도 가능하다.

이 외에도 많은 도구들을 제공하므로 사용법을 알아두자.

 

현재는 google colab을 주로 이용중이므로 colab에서의 사용법만 설명하지만

local server나 jupyter notebook server 등에서 사용하는 것도 Tensorboard설치 과정만 

추가될 뿐 크게 다르지 않을 것이다.

 

from tensorflow.keras.callbacks import ModelCheckpoint
import datetime#, os 

'''
set model
'''

# log저장 장소 지정
log_dir = "logs/my_board/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
# another way : logdir = os.path.join("logs", datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))


# callback 설정 
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)

'''
fit model
needs to include allbacks=[tensorboard_callback]
'''

# tensorboard 로드
%load_ext tensorboard

%tensorboard --logdir logs

callback API : https://keras.io/api/callbacks/

 

Keras documentation: Callbacks API

Callbacks API A callback is an object that can perform actions at various stages of training (e.g. at the start or end of an epoch, before or after a single batch, etc). You can use callbacks to: Write TensorBoard logs after every batch of training to moni

keras.io

반응형

'IT study > 모두를 위한 딥러닝' 카테고리의 다른 글

Weight Initialization  (0) 2020.08.25
ReLU and Sigmoid(tensorboard ex.1)  (0) 2020.08.24
XOR Problem  (0) 2020.08.19
MNIST  (0) 2020.08.18
Regularization for Overfitting problem  (0) 2020.08.13

+ Recent posts