【问题标题】:Model plotted not clear with plot_model使用 plot_model 绘制的模型不清楚
【发布时间】:2020-10-13 02:43:21
【问题描述】:
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)
如下所示
【问题讨论】:
标签:
python
python-3.x
tensorflow
tensorflow2.0
【解决方案1】:
所以问题是,您尝试输出为图像的模型是 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)
给我以下内容(当我刚刚在特定块上打印屏幕时):