一、软件介绍
文末提供程序和源码下载
用于神经网络验证的 Matlab 工具箱,该工具箱实现了可访问性方法,用于分析自主信息物理系统 (CPS) 领域中带有神经网络控制器的神经网络和控制系统。
二、相关工具和软件
该工具箱利用神经网络模型转换工具 (nnmt) 和闭环系统分析、混合系统模型转换和转换工具 (HyST) 以及 CONTINUOUS Reachability Analyzer (CORA)
三、无需安装即可执行
NNV 可以通过以下 CodeOcean 胶囊通过 CodeOcean 在线执行,而无需安装 Matlab 或其他依赖项:
四、Installation: 安装:
文末下载
注意:要正确作,nnv 依赖于其他工具(CORA、NNMT、HyST、onnx2nnv),这些工具作为 git 子模块包含在内。因此,您必须递归克隆,例如,使用以下方法:
<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>git clone --recursive https://github.com/verivital/nnv.git </code></span></span></span>
If running in Ubuntu, install MATLAB and proceed to run the provided installation script (then, skip to step 6).
如果在 Ubuntu 中运行,请安装 MATLAB 并继续运行提供的安装脚本(然后,跳至第 6 步)。<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>chmod +x install_ubuntu.sh ./install_ubuntu.sh </code></span></span></span>
For MacOS and Windows, please install MATLAB (2023a or newer) with at least the following toolboxes:
对于 MacOS 和 Windows,请至少使用以下工具箱安装 MATLAB(2023a 或更高版本):- Computer Vision 计算机视觉
- Control Systems 控制系统
- Deep Learning 深度学习
- Image Processing 图像处理
- Optimization 优化
- Parallel Computing 并行计算
- Statistics and Machine Learning
统计和机器学习 - Symbolic Math 符号数学
- System Identification 系统标识
Install the following support package Deep Learning Toolbox Converter for ONNX Model Format
安装以下支持包:Deep Learning Toolbox Converter for ONNX Model Format<span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>Note: Support packages can be installed in MATLAB's HOME tab > Add-Ons > Get Add-ons, search for the support package using the Add-on Explorer and click on the Install button. </code></span></span></span>
Open MATLAB, then go to the directory where NNV exists on your machine, then run the
install.m
script located at /nnv/
打开 MATLAB,然后转到 NNV 在计算机上所在的目录,然后运行位于 /nnv/ 的install.m
脚本Note: if you restart Matlab, rerun either install.m or startup_nnv.m, which will add the necessary dependencies to the path; you alternatively can run
savepath
after installation to avoid this step after restarting Matlab, but this may require administrative privileges
注意:如果重启 Matlab,请重新运行 install.m 或 startup_nnv.m,这会将必要的依赖项添加到路径中;您也可以在安装后运行savepath
以避免在重新启动 Matlab 后执行此步骤,但这可能需要管理权限Optional installation packages
可选安装包a. To run verification for convolutional neural networks (CNNs) on VGG16/VGG19, additional support packages must be installed:
一个。要在 VGG16/VGG19 上运行卷积神经网络 (CNN) 验证,必须安装其他支持包:b) To run MATLAB's neural network verification comparison, an additional support package is needed (used in CAV'2023 submission):
b) 要运行 MATLAB 的神经网络验证比较,需要一个额外的支持包(用于 CAV'2023 提交):c) To load models from other deep learning frameworks, please install the additional support packages:
c) 要从其他深度学习框架加载模型,请安装其他支持包:- TensorFlow and Keras: Deep Learning Toolbox Converter for TensorFlow Models
TensorFlow 和 Keras:适用于 TensorFlow 模型的 Deep Learning Toolbox 转换器 - PyTorch: Deep Learning Toolbox Converter for PyTorch Models
PyTorch:适用于 PyTorch 模型的 Deep Learning Toolbox 转换器
- TensorFlow and Keras: Deep Learning Toolbox Converter for TensorFlow Models
Uninstallation: 卸载:
Open MATLAB, then go to the /code/nnv/
folder and execute the uninstall.m
script.
打开 MATLAB,然后转到该 /code/nnv/
文件夹并执行 uninstall.m
脚本。
Getting started with NNV NNV 入门
To get started with NNV, let's take a look at a tutorial containing examples demonstrating:
要开始使用 NNV,让我们看一个包含示例的教程:
NN
- Robustness verification on the MNIST dataset.
MNIST 数据集上的稳健性验证。- Includes model training and several verification examples.
包括模型训练和多个验证示例。
- Includes model training and several verification examples.
- Robustness verification on the GTSRB dataset.
GTSRB 数据集的稳健性验证。- Includes model training and robustness verification.
包括模型训练和稳健性验证。
- Includes model training and robustness verification.
- Comparisons of exact (sound and complete) and approximate (sound and incomplete) methods using Star sets
使用 Star sets 的精确 (合理和完整) 和近似 (合理和不完整) 方法的比较- Visualize the size difference on the output sets and the computation times for each method.
可视化输出集上的大小差异以及每种方法的计算时间。
- Visualize the size difference on the output sets and the computation times for each method.
- Robustness analysis of a malware classifier (BODMAS Dataset).
恶意软件分类器的稳健性分析(BODMAS 数据集)。
NNCS NNCS 公司
- Reachability analysis of an inverted pendulum.
倒摆的可达性分析。 - Safety verification example of an Adaptive Cruise Control (ACC) system.
自适应巡航控制 (ACC) 系统的安全验证示例。 - Safety verification of an Automated Emergency Braking System
自动紧急制动系统的安全验证
And more! Please go to the tutorial description for more details!
还有更多!更多细节请前往教程描述!
Examples 例子
In addition to the examples from the tutorial, there are more examples in the 'code/nnv/examples/' folder, including:
除了教程中的示例外,'code/nnv/examples/' 文件夹中还有更多示例,包括:
Semantic Segmentation 语义分割
Recurrent Neural Networks
递归神经网络
Neural Ordinary Differential Equations
神经常微分方程
And more other NN and NNCS examples.
以及更多其他 NN 和 NNCS 示例。
Tests 测试
To run all the tests, one can run the following command from 'code/nnv/tests/' folder:
要运行所有测试,可以从 'code/nnv/tests/' 文件夹运行以下命令:
runtests(pwd, 'IncludeSubfolders', true);
五、软件下载
本文信息来源于GitHub作者地址:https://github.com/verivital/nnv