模型结构输出 tf2.x

模型结构输出 tf2.x,第1张

模型结构输出 tf2.x

1、首先需要安装graph

1. (使用pip install)安装pydot和graphviz两个函数库

2. 安装graphviz软件:

Download | Graphviz

3. 将路径加入系统变量,从我的电脑-属性-高级系统设置-环境变量 进入(win10配置完后需要重启生效)

4、生成对应的模型结构:

import configparser

import tensorflow as tf
from utils.path_utils import get_full_path

config = configparser.ConfigParser()
config.read(get_full_path('conf/config.txt'), encoding="utf-8")
algorithm_version = config.get('version', 'version')
my_model = tf.keras.models.load_model(get_full_path(config.get('lstm_model', 'model_path')))
tf.keras.utils.plot_model(my_model, to_file=get_full_path('data/train_data/model_structure.png'), show_shapes=False,
                          show_layer_names=True, rankdir="LR", expand_nested=True)

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/5680221.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存