栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

模型结构输出 tf2.x

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

模型结构输出 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)

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/675015.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号