plot_model 绘制的模型不清楚

Model plotted not clear with plot_model

使用tensorflow版本2.3.0时输出模型不清晰,如何解决?

import tensorflow as tf

base_model = tf.keras.applications.EfficientNetB7(weights='imagenet', include_top=False)  # or weig
tf.keras.utils.plot_model(base_model, to_file="image1.png", dpi=120)

看起来像下面这样

所以问题是,您尝试输出为图像的模型是一个 HUGE 模型。所以 dpi=120 在 PNG 格式中勉强够用。为了获得更清晰的图像,请将其另存为 PDF。然后你可以根据需要轻松转换为图像。

使用如下:

import tensorflow as tf

base_model = tf.keras.applications.EfficientNetB7(weights='imagenet', include_top=False)  # or weig
tf.keras.utils.plot_model(base_model, to_file="image1.pdf", dpi=120)

给我以下信息(当我刚刚在特定块上打印屏幕时):