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

Onnx maraboupy parser #213

Merged
merged 4 commits into from
Feb 12, 2020
Merged

Conversation

kjulian3
Copy link
Collaborator

This pull request introduces an ONNX parser for Marabou. The format is very similar to parsing tensorflow models, though a few things are different. ONNX does not have functions for easily computing the output shape of intermediate layers, so the shapes of layers in the graph must be inferred from input shapes, constant shapes, and operations.

I tested the parser on ONNX models converted from tensorflow as well as the ACAS Xu prototype networks in ONNX format found in the VNNLIB repository. A new python script in examples shows how to load and solve queries for ONNX format networks that have been added to examples/networks.

I also fixed a minor bug in Marabou.read_tf to change inputName to inputNames to reflect the multi-input changes made in MarabouNetworkTF.

@kjulian3 kjulian3 requested a review from clazarus January 20, 2020 21:31
Copy link
Collaborator

@clazarus clazarus left a comment

Choose a reason for hiding this comment

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

LGTM. The equation functions are fairly complex but ran the example and everything looks ok!

@kjulian3
Copy link
Collaborator Author

Thanks Chris! There's lots of valid ways to define on ONNX network, so I tried to make the equation functions robust, although that makes things more complicated. I think in the future there needs to be some sort of testing framework for the input parsers to make sure we're robust to many network types, and to make sure that a bug fix to accommodate new networks does not break functionality for other networks. But hopefully this is a good starting point for the ONNX parser.

@guykatzz
Copy link
Collaborator

guykatzz commented Feb 8, 2020

Hi Kyle,
Sorry for the delay in reviewing. The code looks good to me!

@ahmed-irfan ahmed-irfan merged commit 1c1c664 into NeuralNetworkVerification:master Feb 12, 2020
AleksandarZeljic pushed a commit to AleksandarZeljic/Marabou that referenced this pull request Oct 9, 2020
* Adding ONNX parser for Marabou

* Convolutional equations and examples

* Add support for Reshape and Cast with new example

* Add onnx version of example network
matanost pushed a commit that referenced this pull request Nov 2, 2021
* Adding ONNX parser for Marabou

* Convolutional equations and examples

* Add support for Reshape and Cast with new example

* Add onnx version of example network
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.

4 participants