NeVerTools / pyNeVer

A Python library for learning and verification of neural networks and other machine learning models
Other
9 stars 3 forks source link

pyNeVer

PyPI - Version PyPI - Python Version


Neural networks Verifier (NeVer 2) is a tool for the design, training and verification of neural networks. It supports sequential fully connected and convolutional neural networks with ReLU and Sigmoid activation functions. pyNeVer is the corresponding python package providing all the main capabilities of NeVer 2 and can be easily installed using pip.

Installation and setup

pyNeVer depends on several packages, which are all available via pip and should be installed automatically. The packages required for the correct execution are the following:

To install pyNeVer, just run the command:

pip install pynever

To run some examples, further packages may be required. If an example requires a specific package, it will be detailed in the example directory.

Supported inputs

At present the pyNeVer package supports only the abstraction and verification of fully connected and convolutional neural networks with ReLU and Sigmoid activation functions. The training and conversion supports also batch normalization layers. A network with batchnorm layers following fully connected layers can be converted to a "pure" fully connected neural networks using the capabilities provided in the utilities.py module.
The conversion package provides the capabilities for the conversion of PyTorch and ONNX networks: therefore this kind of networks can be loaded using the respective frameworks and then converted to the internal representation used by pyNeVer.
The properties for the verification and abstraction of the networks must be defined either in python code following the specification which can be found in the documentation, or via an SMT-LIB file compliant to the VNN-LIB standard.

Examples

NB: All the scripts should be executed INSIDE the related directory!

All the examples described below are guaranteed to work until Release v0.1.1a4. After this release, changes in the interface structure may add inconsistencies between test scripts and API, so the old examples will be removed and new examples will be created in future releases.

Contributors

The main contributors of pyNeVer are Dario Guidotti and Stefano Demarchi, under the supervision of Professors Armando Tacchella and Luca Pulina.
A significant contribution for the participation in VNN-COMP 2024 was the help of Elena Botoeva.

Other contributors:

Publications

If you use NeVer2 or pyNeVer in your work, please kindly cite our papers. Here you can find the list of BibTeX entries.

@article{demarchi2024never2,
  title={NeVer2: Learning and Verification of Neural Networks},
  author={Demarchi, Stefano and Guidotti, Dario and Pulina, Luca and Tacchella, Armando},
  journal={Soft Computing},
  year={2024}
}

@inproceedings{demarchi2022formal,
  title={Formal Verification Of Neural Networks: A Case Study About Adaptive Cruise Control.},
  author={Demarchi, Stefano and Guidotti, Dario and Pitto, Andrea and Tacchella, Armando},
  booktitle={ECMS},
  pages={310--316},
  year={2022}
}

@inproceedings{guidotti2021pynever,
  title={pynever: A framework for learning and verification of neural networks},
  author={Guidotti, Dario and Pulina, Luca and Tacchella, Armando},
  booktitle={Automated Technology for Verification and Analysis: 19th International Symposium, ATVA 2021, Gold Coast, QLD, Australia, October 18--22, 2021, Proceedings 19},
  pages={357--363},
  year={2021},
  organization={Springer}
}