使用plot_模型绘制的模型不清晰

2024-09-29 21:48:07 发布

您现在位置:Python中文网/ 问答频道 /正文

当使用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)

它看起来如下所示

enter image description here


Tags: 模型import版本basemodelincludetftensorflow
1条回答
网友
1楼 · 发布于 2024-09-29 21:48:07

所以问题是,您试图输出为图像的模型是一个巨大的模型。因此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)

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

enter image description here

相关问题 更多 >

    热门问题