在 Keras 中绘制模型

标签 plot keras model

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

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

我得到以下结果:my model

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

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

最佳答案

您可以使用参数 show_shapes=True

来自 tf.keras 文档:

show_shapes: whether to display shape information.

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

关于在 Keras 中绘制模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59930136/

相关文章:

r - 结合 fiddle 图和箱线图

python - 非矩形域上的 3D 图

python - 将 Tensorflow Keras 模型移植到 Tensorflow 版本 1.14.0 时出错

laravel - 如何在 Eloquent 模型(Laravel)中的自定义属性中使用关系?

r - R图中的不均匀轴

matlab - 如何在 MATLAB 中使用 ezplot?

python-3.x - Flask/Keras webservice ModuleNotFoundError : No module named 'tensorflow_core.keras'

tensorflow - 多类 sparse_categorical_crossentropy TruePositives metric 不兼容的形状 : [2, 128] vs. [2,64]

database - 使用 OctoberCMS Builder 插件将数据从单个表单插入到 2 个不同的表中

model-view-controller - MVC 中的模型到底是什么