惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
B
Blog
The Register - Security
The Register - Security
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
F
Full Disclosure
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
美团技术团队
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
D
DataBreaches.Net
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
The Cloudflare Blog
博客园 - 【当耐特】
U
Unit 42
月光博客
月光博客
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
博客园 - 聂微东
I
InfoQ
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
Cyberwarzone
Cyberwarzone
V
V2EX
S
Securelist
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Security @ Cisco Blogs
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tor Project blog

博客园 - 黄彬子

【转】Go语言:编译后文件体积过大解决方案 【转】使用 UPX 压缩可执行文件 Go语言获取路径的文件名、后缀 go - 如何将gin模式设置为release模式? 【Golang学习】SVG图片的生成 【Golang标准库】flag 【Golang踩过的坑】exported function Script should have comment or be unexported wget配置文件的使用:代理设置与不检查证书 Rust Crates 源使用帮助 2020大风口!什么是图神经网络?有什么用?终于有人讲明白了 2020必火的图神经网络(GNN)是什么?有什么用? 【每天学习一点点】Tensorflow 版本与CUDA版本 【每天学习一点点】keras cifar10.load_data()自己下载数据 【每天学习一点点】Tensorflow2.X 运行问题:Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED 【每天学习一点点】mxnet 版本运行失败问题 【每天学习一点点】Tensorflow GPU与CPU版本 【每天学习一点点】不再显示I信息(Tensorflow GPU) 【每天学习一点点】numpy中的reshape中参数为-1 Putty与Xming组合应用
【每天学习一点点】使用plot_model绘制网络模式失败
黄彬子 · 2020-08-13 · via 博客园 - 黄彬子

使用plot_model绘制网络模式失败。

import tensorflow as tf
fashion_mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    # tf.keras.layers.Dense(128, activation='relu'),
    # tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(10, activation='softmax')
])

loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)

model.compile(optimizer='adam',
              loss=loss_fn,
              metrics=['accuracy'])

model.fit(x_train, 
            y_train,
            epochs=1,
            batch_size=600,
            verbose=1)
model.evaluate(x_test, y_test, verbose=2)
model.summary()

tf.keras.utils.plot_model(model, "my_first_model.png")

 出错提示如下:

'Failed to import pydot. You must install pydot'
ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.

 解决:

1. https://graphviz.gitlab.io/  ,下载windows版本的安装包。安装。

2. 读代码,C:\Users\lj.huang\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\keras\utils\vis_utils.py

try:
  # pydot-ng is a fork of pydot that is better maintained.
  import pydot_ng as pydot

3. 从上以来看,pydot-ng是最好的。

pip install pydot-ng

4.再试,可以了。