IBM / CNN-Cert

Codes for reproducing the experimental results in "CNN-Cert: An Efficient Framework for Certifying Robustness of Convolutional Neural Networks", published at AAAI 2019
Apache License 2.0
27 stars 16 forks source link

Keras ZeroPad2D layer #3

Open lhfowl opened 5 years ago

lhfowl commented 5 years ago

Hello,

I'm trying to certify a model I have trained in pytorch, and then converted to keras. I am using run_cnn in pymain.py, but I'm getting the error:

"ValueError: Invalid Layer Type"

because of the layer:

"tensorflow.python.keras.layers.convolutional.ZeroPadding2D"

Is this layer not currently supported in your code? Do you have any suggestions on how to modify the code to get past this?

AkhilanB commented 5 years ago

Yes, the code does not currently support ZeroPadding2D layers. I suggest modifying either the 'Model' or 'CNNModel' classes in cnn_bounds_full.py or cnn_bounds_fullcore.py respectively. One way to to this might be to modify the '__init_\' function so that when a padding layer is encountered, it modifies 'self.pads' for the next layer. This way, I think the rest of the code can be used as is.