社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  机器学习算法

【深度学习】神经网络可视化工具,超全汇总!

机器学习初学者 • 1 年前 • 290 次点击  
神经网络可视化是指通过图形化的方式展示神经网络的结构、参数、输入、输出、中间结果等信息,可以帮助用户更好地神经网络的内部工作原理和特征提取过程,以优化神经网络模型。扩展阅读:神经网络学习到的是什么?  机器学习可视化技术概览(Python)
本文汇总了全网最为全面的26款神经网络可视化工具,可以帮助大家了解神经网络的结构组成、工作原理和性能表现从而更好地进行模型调整和优化。也可以画出酷炫的模型图方便模型的展示。具体如下:
1. Net2Vis:是一款自动从Keras代码生成卷积神经网络的抽象可视化的工具。
地址:https://github.com/viscom-ulm/Net2Vis
# You can freely modify this file.# However, you need to have a function that is named get_model and returns a Keras Model.import jsonimport sysimport osfrom keras.models import Sequentialfrom keras.layers import Conv2D, Dense, Dropout, Flatten, MaxPooling2D, AveragePooling2D
def get_model(): num_classes = 25 model = Sequential()
model.add(Conv2D(filters=6, kernel_size=(3, 3), activation='relu', padding="same", input_shape=(32,32,1))) model.add(AveragePooling2D())
model.add(Conv2D(filters=16, kernel_size=(3, 3), activation='relu',padding="same")) model.add(AveragePooling2D())
model.add(Flatten())
model.add(Dense(units=120, activation='relu'))
model.add(Dense(units=84, activation='relu'))
model.add(Dense(units=num_classes, activation = 'softmax')) model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
return model

效果如下:
2. Visualkeras:是一个Python包,用于帮助可视化Keras(独立或包含在TensorFlow中)神经网络架构。它允许轻松地进行样式设置以适应大多数需求。目前,它支持分层样式架构生成,非常适合CNN(卷积神经网络),以及图形样式架构。
地址:https://github.com/paulgavrikov/visualkeras
效果如下:
import visualkerasmodel = ...visualkeras.layered_view(model).show() # display using your system viewervisualkeras.layered_view(model, to_file='output.png') # write to diskvisualkeras.layered_view(model, to_file='output.png').show() # write and showvisualkeras.layered_view(model)
3. draw_convnet:是一个用于绘制卷积神经网络结构图的Python脚本。它可以帮助您可视化卷积神经网络的结构,包括卷积层、池化层、全连接层等。该脚本是由GitHub用户gwding开发的,是一个开源项目,可以在GitHub上找到其源代码和使用说明。
地址:https://github.com/gwding/draw_convnet
效果如下:
4. NN-SVG:有FCNN、AlexNet、LeNet三种类型。
地址:http://alexlenail.me/NN-SVG/AlexNet.html
FCNN 类型
AlexNet 类型
LeNet 类型:
5. PlotNeuralNet:用于绘制报告和演示文稿中的神经网络的LaTeX代码。查看示例可以了解它们的制作方式。
地址:https://github.com/HarisIqbal88/PlotNeuralNet
效果如下:
6. TensorBoard:Graphs仪表板是用于检查TensorFlow模型的强大工具。
地址:https://www.tensorflow.org/tensorboard?hl=zh-cn
效果如下:
7. Caffe:可以使用caffe/draw.py来绘制NetParameter protobuffer。
地址:https://github.com/BVLC/caffe
效果如下:
8. Matlab
地址:https://www.mathworks.com/?s_tid=gn_logo
效果如下:

9. Keras.js

地址:https://transcranial.github.io/keras-js/#/

效果如下:
10. keras-sequential-ascii:用于研究序列模型的架构和参数的Keras
地址:https://github.com/stared/keras-sequential-ascii/
VGG 16 的网络结构如下:
11. Netron:可以可视化神经网络、深度学习和机器学习模型。Netron支持ONNX、TensorFlow Lite、Core ML、Keras、Caffe、Darknet、MXNet、PaddlePaddle、ncnn、MNN和TensorFlow.js。还支持实验性的PyTorch、TorchScript、TensorFlow、OpenVINO、RKNN、MediaPipe、ML.NET和scikit-learn。
地址:https://github.com/lutzroeder/Netron
效果如下:
12. DotNet:这是一个简单的Python脚本,用于使用Python和Graphviz生成前馈神经网络的图片。
地址:https://github.com/martisak/dotnets
效果如下:
13.Graphviz:是一个开源的图可视化软件,它可以用抽象的图形和网络图来表示结构化信息。
地址:https://www.graphviz.org/
效果如下:
14. Keras Visualization:keras.utils.vis_utils模块提供了绘制Keras模型(使用graphviz)的实用函数。
地址:https://keras.io/api/utils/model_plotting_utils/
效果如下:
15. Conx:Python第三方库 conx 可以使用 net.picture() 函数来实现具有激活函数网络的可视化,以生成SVG、PNG或PIL。
地址:https://conx.readthedocs.io/en/latest/index.html
效果如下:
16. ENNUI:致力于开发拖拽式神经网络可视化工具。
地址:https://math.mit.edu/ennui/
以下是一个LeNet-like 架构的可视化示例:

17. NNet

教程:https://beckmw.wordpress.com

R工具包示例及效果:
data(infert, package="datasets")plot(neuralnet(case~parity+induced+spontaneous, infert))
18. GraphCore:主要是展示神经网络中操作的可视化结果,但也包括了网络结构的内容,比如每层的网络参数等。
地址:https://www.graphcore.ai/posts/
下面展示了两个网络结构的可视化效果:
AlexNet

ResNet50
19. Neataptic:提供了非常灵活的神经网络可视化形式;神经元和突触可以通过一行代码进行删除。神经网络运行不需要固定的结构。允许通过神经进化(neuro-evolution)的方式为数据集调整网络结构的形状,并通过多线程来实现
地址:https://wagenaartje.github.io/neataptic/
效果如下:
20. TensorSpace:是一个由TensorFlow.js、Three.js和Tween.js构建的神经网络3D可视化框架。它提供Layer API以构建深度学习层、加载预训练模型,并在浏览器中生成3D可视化。通过它的API接口,可以更直观地可视化并理解任何由TensorFlow、Keras、TensorFlow.js等构建的预训练模型。
地址:https://tensorspace.org/index_zh.html
效果如下:

21. Netscope CNN Analyzer:一个基于网络的工具,用于可视化和分析卷积神经网络架构(或者从技术角度讲,任何有向无环图)。目前支持Caffe的prototxt格式。
地址:http://dgschwend.github.io/netscope/quickstart.html
效果如下:
22. Monial:计算图的交互式表示法,左边是输入,右侧就是对应结构的可视化结果。
地址:https://github.com/mlajtos/moniel
效果如下:
23. Texample:可以通过 LaTex 来实现一个神经网络结构的可视化。
地址:https://texample.net/tikz/examples/neural-network/
LaTex 示例及效果图如下:
\documentclass{article}
\usepackage{tikz}\begin{document}\pagestyle{empty}
\def\layersep{2.5cm}
\begin{tikzpicture}[shorten >=1pt,->,draw=black!50, node distance=\layersep] \tikzstyle{every pin edge}=[ \tikzstyle{neuron}=[circle,fill=black!25,minimum size=17pt,inner sep=0pt] \tikzstyle{input neuron}=[neuron, fill=green!50]; \tikzstyle{output neuron}=[neuron, fill=red!50]; \tikzstyle{hidden neuron}=[neuron, fill=blue!50]; \tikzstyle{annot} = [text width=4em, text centered]
% Draw the input layer nodes \foreach \name / \y in {1,...,4} % This is the same as writing \foreach \name / \y in {1/1,2/2,3/3,4/4} \node[input neuron, pin=left:Input \#\y] (I-\name) at (0,-\y) {};
% Draw the hidden layer nodes \foreach \name / \y in {1,...,5} \path[yshift=0.5cm] node[hidden neuron] (H-\name) at (\layersep,-\y cm) {};
% Draw the output layer node \node[output neuron,pin={[pin edge={->}]right:Output}, right of=H-3] (O) {};
% Connect every node in the input layer with every node in the % hidden layer. \foreach \source in {1,...,4} \foreach \dest in {1,...,5} \path (I-\source) edge (H-\dest);
% Connect every node in the hidden layer with the output layer \foreach \source in {1,...,5} \path (H-\source) edge (O);
% Annotate the layers \node[annot,above of=H-1, node distance=1cm] (hl) {Hidden layer}; \node[annot,left of=hl] {Input layer}; \node[annot,right of=hl] {Output layer};\end{tikzpicture}% End of code\end{document}

24. Quiver:Keras 的一款交互式卷积神经网络特征可视化的一个工具。
地址:https://github.com/keplr-io/quiver
效果如下:

25. cnn-explainer:通过加载预训练模型以进行CNN可视化,只需要浏览器就可了解CNN的预测过程!
地址:https://poloclub.github.io/cnn-explainer/
效果如下:

26. ML Visuals :包含神经网络的图形和模板,可以重复使用和自定义用于神经网络结构的展示。
地址:https://github.com/dair-ai/ml-visuals
效果如下:



往期精彩回顾





Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/162210
 
290 次点击