가장 쉬운 딥러닝 모델 그림 그리기 [Visualization of deep learning neural network model in keras ] by 바죠

가장 쉬운 딥러닝 모델 그림 그리기 [Visualization of deep learning neural network model in keras]

https://machinelearningmastery.com/visualize-deep-learning-neural-network-model-keras/


---------------------------------------------------------------------------------------------------------------------

from keras.models import Sequential
from keras.layers import Dense
from keras.utils.vis_utils import plot_model

model = Sequential()
model.add(Dense(2, input_dim=1, activation='relu'))
model.add(Dense(1, activation='sigmoid'))

plot_model(model, to_file='model_plot.png', show_shapes=True, show_layer_names=True)

---------------------------------------------------------------------------------------------------------------------

from keras.utils import plot_model
plot_model(model, to_file='model.png')

---------------------------------------------------------------------------------------------------------------------

from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(2, input_dim=1, activation='relu'))
model.add(Dense(1, activation='sigmoid'))

print(model.summary())

---------------------------------------------------------------------------------------------------------------------
인공신경망에서 훈련되어 질 수 있는 파라메터 갯수를 직접 알아내는 방법:

from keras import backend as K
trainable_count = int( np.sum([K.count_params(p) for p in set(model.trainable_weights)]))
non_trainable_count = int( np.sum([K.count_params(p) for p in set(model.non_trainable_weights)]))
print('Total params: {:,}'.format(trainable_count + non_trainable_count))
print('Trainable params: {:,}'.format(trainable_count))
print('Non-trainable params: {:,}'.format(non_trainable_count))

---------------------------------------------------------------------------------------------------------------------






덧글

댓글 입력 영역

최근 포토로그



MathJax