Beispiel #1
0
 def extract_data(self):
     """Extracts data from qucsdata file into results"""
     self.results = extract.load_data(self.out).__dict__
Beispiel #2
0
    plt.title('Original')
    img = img.reshape(28, 28)
    plt.imshow(img, cmap='gray')
    plt.axis('off')

    plt.subplot(1, 2, 2)
    plt.title('Adversarial')
    adv = adv.reshape(28, 28)
    plt.imshow(adv, cmap='gray')
    plt.axis('off')
    plt.show()


if __name__ == "__main__":
    # Loading Model
    backend.set_learning_phase(False)
    keras_model = load_model('model.h5')

    # Loading MNIST Dataset
    (x_train, y_train), (x_test, y_test) = load_data()
    x_train = x_train.reshape(60000, 28, 28, 1)
    x_test = x_test.reshape(10000, 28, 28, 1)
    x_train = x_train.astype('float32')
    x_test = x_test.astype('float32')
    x_train /= 255
    x_test /= 255

    #the 10 images to attack
    images = x_test[:10]
    labels = y_test[:10]
Beispiel #3
0
 def extract_data(self):
     """Extracts data from qucsdata file into results"""
     self.results = extract.load_data(self.out).__dict__