Skip to main content

dnnv - deep neural network verification

Project description

Deep Neural Network Verification

A framework for verification and analysis of deep neural networks.

Getting Started

For more detailed instructions, see our documentation.

Installation

Clone this repository:

$ git clone https://github.com/dlshriver/DNNV.git

Create a python virtual environment for this project:

$ ./manage.sh init

To activate the virtual environment and set environment variables correctly for tools installed using the provided manage.sh script, run:

$ . .env.d/openenv.sh

Install any of the supported verifiers (Reluplex, planet, MIPVerify.jl, Neurify, ERAN, PLNN, marabou, nnenum, verinet):

$ ./manage.sh install reluplex planet mipverify neurify eran plnn marabou nnenum verinet

Make sure that the project environment is activated when installing verifiers with the manage.sh script. Otherwise some tools may not install correctly.

Additionally, several verifiers make use of the Gurobi solver. This should be installed automatically, but requires a license to be manually activated and available on the host machine. Academic licenses can be obtained for free from the Gurobi website.

April 26, 2021: The Marabou installation script may fail if boost is not installed. We use the original Marabou installation scripts which attempt to download boost if it cannot be found, but we have noticed at this time that this download can fail. To avoid this, try installing boost with sudo apt install libboost1.71-all-dev before installing marabou using ./manage.sh.

Finally, planet has several additional requirements that currently must be installed separately before installation with ./manage.sh: libglpk-dev, qt5-qmake, valgrind, libltdl-dev, protobuf-compiler.

Docker Installation

DNNV can also be built using the provided Docker build scripts. The provided build file will install DNNV with all of the verifiers that do not require Gurobi. To build and run the docker image, run:

$ docker build . -t dlshriver/dnnv
$ docker run --rm -it dlshriver/dnnv
(.venv) dnnv@hostname:~$ python -m dnnv -h

Full Installation Script

DNNV, with all supported verifiers can be installed using a provided installation script. We have tested this script on a fresh Ubuntu 20.04 system. WARNING: This will install system packages. We recommend this only be run in a VM.

$ wget https://raw.githubusercontent.com/dlshriver/DNNV/CAV2021/scripts/install_artifact.sh
$ chmod u+x install_artifact.sh
$ ./install_artifact.sh

Usage

Properties are specified in our property DSL, extended from Python. A property specification can import python modules, and define variables. The only required component is the property expression, which must appear at the end of the file. An example of a local robustness property is shown below.

from dnnv.properties import *

N = Network("N")
x = Image("path/to/image")
epsilon = Parameter("epsilon", float, default=1.0)

Forall(
    x_,
    Implies(
        ((x - epsilon) < x_ < (x + epsilon)),
        argmax(N(x_)) == argmax(N(x))),
    ),
)

To check whether property holds for some network using the ERAN verifier, run:

$ python -m dnnv property.prop --network N network.onnx --eran

Additionally, if the property defines parameters, using the Parameter keyword, they can be specified on the command line using the option --prop.PARAMETER_NAME, where PARAMETER_NAME is the name of the parameter. For the property defined above, a value for epsilon can be provided with a command line option as follows:

$ python -m dnnv property.prop --network N network.onnx --eran --prop.epsilon=2.0

Examples

A set of example networks and properties that can be run with DNNV are available here.

We also provide the ACAS Xu benchmark in DNNP and ONNX format, along with a run script to run DNNV on all of the problems in the benchmark.

Acknowledgements

This material is based in part upon work supported by the National Science Foundation under grant number 1900676 and 2019239.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dnnv-0.4.8.tar.gz (10.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dnnv-0.4.8-py3-none-any.whl (101.1 kB view details)

Uploaded Python 3

File details

Details for the file dnnv-0.4.8.tar.gz.

File metadata

  • Download URL: dnnv-0.4.8.tar.gz
  • Upload date:
  • Size: 10.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for dnnv-0.4.8.tar.gz
Algorithm Hash digest
SHA256 5bcabbdf8b20727f1cc06d39931517786accc1d01dea7f7799f55759e16d7a25
MD5 6d190163216f41c4d5ca07768dda74bb
BLAKE2b-256 2250f9edf377f3d91a2432eaab5c642474eb7a7cbeeab407e12202837f08977a

See more details on using hashes here.

File details

Details for the file dnnv-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: dnnv-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 101.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for dnnv-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 567e1719adeff129e5b35cf8b3eb1169f4df9b389875d443320083d23f81fa0f
MD5 6c509ecefdf24a15bc90b967134289cc
BLAKE2b-256 e5683dfc51d3e3d6e0e03e4dd2e0f192d6fa7c78d0548e574f026a3e9b524b5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page