반응형
model_name = 'some_model'
#폴더 생성
try:
if not os.path.exists(os.path.join('data','checkpoints',model_name)):
os.makedirs(os.path.join('data','checkpoints',model_name))
if not os.path.exists(os.path.join('data','tensorboard',model_name)):
os.makedirs(os.path.join('data','tensorboard',model_name))
if not os.path.exists(os.path.join('data','logs',model_name)):
os.makedirs(os.path.join('data','logs',model_name))
except OSError:
print('Error: create dir')
# 체크포인터
checkpointer = ModelCheckpoint(
filepath=os.path.join('data', 'checkpoints',model_name, 'inception.{epoch:03d}-{val_loss:.2f}.hdf5'),
verbose=1,
save_best_only=True)
#얼리스토퍼
early_stopper = EarlyStopping(patience=1000)
#텐서보드
tensorboard = TensorBoard(log_dir=os.path.join('data', 'tensorboard',model_name))
#리듀스 러닝레이트
re_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.9, patience=20, verbose=1)
반응형
'인공지능' 카테고리의 다른 글
[인공지능 서비스의 모든 것] 1. 인공지능이란? (0) | 2022.04.23 |
---|---|
(Tensorflow) valueerror:unknown layer : functional (0) | 2022.04.14 |
Pytorch CNN-LSTM 모델 설계 (0) | 2021.03.17 |
pytorch class weight 주는법 (0) | 2021.03.16 |
pytorch model summary (0) | 2021.03.16 |