Keras 中的绘图模型 [英] Plotting model in Keras

查看:22
本文介绍了Keras 中的绘图模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Keras 中绘制我的模型,如下所示:

I'm trying to plot my model in Keras, like this:

# Plot model graph
tf.keras.utils.plot_model(model, to_file='Model1.png')
from IPython.display import Image
Image(retina=True, filename='Model1.png')

我得到以下结果:我的模型

但是,我在互联网的某个地方看到有人绘制了他的模型,如下所示:我需要的模型

But, I've seen somewhere in the internet, that someone plotted his model, like this: model I need

我怎样才能改变我的代码来绘制这样的图?用我的模型每一层的输入/输出信息?

How can I change my code to plot like that? With the input/output information of each layer of my model?

推荐答案

您可以使用参数show_shapes=True.

来自 tf.keras 文档:

show_shapes:是否显示形状信息.

show_shapes: whether to display shape information.

(仔细看这里:https://www.tensorflow.org/api_docs/python/tf/keras/utils/plot_model)

这篇关于Keras 中的绘图模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆