tensorflow2中pydot问题

1. pydot` failed to call GraphViz.

 首先去下载这个 。https://blog.csdn.net/shangxiaqiusuo1/article/details/85283432(下载包这个博客里面有飞机票)

2。参照上面那个博客的顺序去把GraphViz,pydot,pydot-ng下载完。

3.  系统变量的添加,参照这个博客https://blog.csdn.net/hjxinkkl/article/details/89483033中的

  import os

  os.environ["PATH"] += ";D:/Program/Graphviz2.38/bin/

4. 

num_words = 2000
num_tags = 12
num_departments = 4

# 输入
body_input = keras.Input(shape=(None,), name='body')
title_input = keras.Input(shape=(None,), name='title')
tag_input = keras.Input(shape=(num_tags,), name='tag')

# 嵌入层
body_feat = layers.Embedding(num_words, 64)(body_input)
title_feat = layers.Embedding(num_words, 64)(title_input)

# 特征提取层
body_feat = layers.LSTM(32)(body_feat)
title_feat = layers.LSTM(128)(title_feat)
features = layers.concatenate([title_feat,body_feat, tag_input])

# 分类层
priority_pred = layers.Dense(1, activation='sigmoid', name='priority')(features)
department_pred = layers.Dense(num_departments, activation='softmax', name='department')(features)


# 构建模型
model = keras.Model(inputs=[body_input, title_input, tag_input],
outputs=[priority_pred, department_pred])
model.summary()
keras.utils.plot_model(model, 'multi_model.png', show_shapes=True)

最后一个行就可以完成图片的绘制
上一篇:对图像进行SVD和PCA降维,可用于压缩或者图像数据增强(python版)


下一篇:20210502_数据预处理及可视化(第二天)