Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add script to run canonical benchmarks #431

Merged
merged 4 commits into from
Jan 27, 2022

Conversation

wu-haoze
Copy link
Collaborator

@wu-haoze wu-haoze commented Feb 15, 2021

Add a python script to run canonical benchmarks.
It's intended to behave the same as the Marabou executable, but in addition supports

  1. passing the networks in onnx or pb format.
  2. targeted attack for cifar10 and mnist benchmarks by specifying epsilon, the target label, and the index of the test sample in the test set.

e.g.,

  1. ./maraboupy/runMarabou.py resources/nnet/acasxu/ACASXU_experimental_v2a_2_9.nnet resources/properties/acas_property_2.txt --snc --verbosity=0

  2. ./maraboupy/runMarabou.py resources/nnet/mnist/mnist10x10.nnet --index 2 --target-label 8 --epsilon 0.005 --dataset=mnist

@guykatzz
Copy link
Collaborator

guykatzz commented Feb 27, 2021

Looks like this PR subsumes your other PR #436
(I think that one didn't have the timeout parameter)

@@ -317,6 +341,7 @@ InputQuery loadQuery(std::string filename){
// Describes which classes and functions are exposed to API
PYBIND11_MODULE(MarabouCore, m) {
m.doc() = "Maraboupy bindings to the C++ Marabou via pybind11";
m.def("loadProperty", &loadProperty, "Create input query from property file");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really creating an IPQ, right? Just adding the property on top of an existing IPQ?

print("The network must be in .pb, .nnet, or .onnx format!")
return None, None

if args.prop != None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double space after if

encode_cifar10_linf(network, args.index, args.epsilon, args.target_label)
return network.getMarabouQuery(), network
else:
print("No property encoded! The dataset must be taxi or mnist or cifar10.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt understand the comment. Can you have both a dataset and a property? I guess not

@wu-haoze wu-haoze merged commit c179c5d into NeuralNetworkVerification:master Jan 27, 2022
@wu-haoze wu-haoze deleted the run-script branch January 27, 2022 06:23
omriisack pushed a commit to omriisack/Marabou that referenced this pull request Feb 6, 2022
* add new file

* clean up run file

* move to resource

* minor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants