![](/img/trans.png)
[英]How to create a model with multiple shared layers in Keras Functional API?
[英]How to use Tensorboard to create histogram of acitvations with Keras functional API
我使用 Keras 函数式 API 创建以下网络:
input = Input(shape=input_shape)
x = Conv2D(filters=32, kernel_size=(3, 3), activation='relu')(input)
tf.summary.histogram(name="conv1", data=x)
x = Conv2D(filters=64, kernel_size=(3, 3), activation='relu')(x)
tf.summary.histogram(name="conv2", data=x)
x = MaxPool2D(pool_size=(2, 2))(x)
x = Flatten()(x)
x = Dense(units=128, activation='relu')(x)
tf.summary.histogram(name="dense1", data=x)
x = Dense(units=num_classes, activation='softmax')(x)
tf.summary.histogram(name="demse1", data=x)
model = Model(inputs=inp, outputs=x)
我使用tf.summary.histogram
来提取有关不同层激活的信息。 但是,层的激活直方图不会出现在 Tensorboard 中。
我做错了什么?
您可以使用张量板回调来获取直方图。
tensorboard_callback = tf.keras.callbacks.TensorBoard(
log_dir='logs', histogram_freq=1, profile_batch = 0
)
model.fit(x,y, epochs = 5, callbacks = tensorboard_callback)
有关完整的文档,请参见此处
Tensorboard 直方图 -
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.