Browse Source

fix doc error

tags/v1.6.0
shu-kun-zhang 3 years ago
parent
commit
72bb39348f
2 changed files with 26 additions and 19 deletions
  1. +25
    -18
      examples/README.md
  2. +1
    -1
      mindarmour/fuzz_testing/model_coverage_metrics.py

+ 25
- 18
examples/README.md View File

@@ -1,38 +1,45 @@
# Examples # Examples

## Introduction ## Introduction

This package includes application demos for all developed tools of MindArmour. Through these demos, you will soon This package includes application demos for all developed tools of MindArmour. Through these demos, you will soon
master those tools of MindArmour. Let's Start! master those tools of MindArmour. Let's Start!


## Preparation ## Preparation

Most of those demos are implemented based on LeNet5 and MNIST dataset. As a preparation, we should download MNIST and Most of those demos are implemented based on LeNet5 and MNIST dataset. As a preparation, we should download MNIST and
train a LeNet5 model first. train a LeNet5 model first.

### 1. download dataset ### 1. download dataset

The MNIST database of handwritten digits has a training set of 60,000 examples, and a test set of 10,000 examples The MNIST database of handwritten digits has a training set of 60,000 examples, and a test set of 10,000 examples
. It is a subset of a larger set available from MNIST. The digits have been size-normalized and centered in a fixed-size image. . It is a subset of a larger set available from MNIST. The digits have been size-normalized and centered in a fixed-size image.


```sh ```sh
$ cd examples/common/dataset
$ mkdir MNIST
$ cd MNIST
$ mkdir train
$ mkdir test
$ cd train
$ wget "http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz"
$ wget "http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz"
$ gzip train-images-idx3-ubyte.gz -d
$ gzip train-labels-idx1-ubyte.gz -d
$ cd ../test
$ wget "http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz"
$ wget "http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz"
$ gzip t10k-images-idx3-ubyte.gz -d
$ gzip t10k-images-idx3-ubyte.gz -d
cd examples/common/dataset
mkdir MNIST
cd MNIST
mkdir train
mkdir test
cd train
wget "http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz"
wget "http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz"
gzip train-images-idx3-ubyte.gz -d
gzip train-labels-idx1-ubyte.gz -d
cd ../test
wget "http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz"
wget "http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz"
gzip t10k-images-idx3-ubyte.gz -d
gzip t10k-labels-idx1-ubyte.gz -d
``` ```


### 2. trian LeNet5 model ### 2. trian LeNet5 model

After training the network, you will obtain a group of ckpt files. Those ckpt files save the trained model parameters After training the network, you will obtain a group of ckpt files. Those ckpt files save the trained model parameters
of LeNet5, which can be used in 'examples/ai_fuzzer' and 'examples/model_security'. of LeNet5, which can be used in 'examples/ai_fuzzer' and 'examples/model_security'.

```sh ```sh
$ cd examples/common/networks/lenet5
$ python mnist_train.py
cd examples/common/networks/lenet5
python mnist_train.py


```
```

+ 1
- 1
mindarmour/fuzz_testing/model_coverage_metrics.py View File

@@ -294,7 +294,7 @@ class SuperNeuronActivateCoverage(CoverageMetrics):
class NeuronBoundsCoverage(SuperNeuronActivateCoverage): class NeuronBoundsCoverage(SuperNeuronActivateCoverage):
""" """
Get the metric of 'neuron boundary coverage' :math:`NBC = (|UpperCornerNeuron| + |LowerCornerNeuron|)/(2*|N|)`, Get the metric of 'neuron boundary coverage' :math:`NBC = (|UpperCornerNeuron| + |LowerCornerNeuron|)/(2*|N|)`,
where :math`|N|` is the number of neurons, NBC refers to the proportion of neurons whose neurons output value in
where :math:`|N|` is the number of neurons, NBC refers to the proportion of neurons whose neurons output value in
the test dataset exceeds the upper and lower bounds of the corresponding neurons output value in the training the test dataset exceeds the upper and lower bounds of the corresponding neurons output value in the training
dataset. dataset.




Loading…
Cancel
Save