Closed leadharbor closed 5 years ago
I'm not sure from your question whether you are using the model in the code from CleverHans or the new model from https://github.com/davidsandberg/facenet/wiki/Validate-on-LFW.
Could you clarify?
I was using the model from the Validate-on-LFW tutorial which recommended downloading the model from https://drive.google.com/open?id=1EXPBSXwTaqrSC0OhUdXNmKSh9qJUQ55-.
I didn't realize that there was a model in CleaverHans.
Thanks for responding to this on a Saturday.
You are AWESOME!!!
Regards, Abe
Ok, went through the files in cleverhans but could not find the *.pb models files for Facenet.
When I first checked, he only place I could find the original model files referenced in facenet_fgsm.py was online at https://github.com/iwantooxxoox/real-time-face-recognition/tree/master/pre-trained/20170512-110547
Now I found (I swear this wasn't there when I tried searching originally): https://drive.google.com/file/d/0B5MzpY9kBtDVZ2RpVDYwWmxoSUk/edit
So I am trying everything with the new model. I hope this works. Will keep you updated.
Please enjoy your weekend and thanks for responding so quickly.
Looks like the latest model I tried has problems as well.
I get the following trying to run
python src/validate_on_lfw.py \ ~/datasets/lfw/lfw_mtcnnpy_160 \ ~/models/facenet/20180402-114759 \ --distance_metric 1 \ --use_flipped_images \ --subtract_mean \ --use_fixed_image_standardization
In the referenced Validate-on-LFW tutorial:
Model directory: /content/models/facenet/20170512-110547 Metagraph file: model-20170512-110547.meta Checkpoint file: model-20170512-110547.ckpt-250000 2019-06-09 14:53:24.091085: W tensorflow/core/graph/graph_constructor.cc:1272] Importing a graph with a lower producer version 21 into an existing graph with producer version 27. Shape inference will have run different parts of the graph with different producer versions. Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/importer.py", line 426, in import_graph_def graph._c_graph, serialized, options) # pylint: disable=protected-access tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node Reshape was passed int32 from batch_join:1 incompatible with expected int64.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/content/facenet/src/validate_on_lfw.py", line 164, in
I decided to just run cleverhans with the model only. Then got:
Use tf.gfile.GFile. Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1659, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 128 and 512 for 'sub' (op: 'Sub') with input shapes: [?,128], [?,512].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "facenet_fgsm.py", line 64, in
So I changed facenet_fgsm.py to 128
class InceptionResnetV1Model(Model):
model_path = "models/facenet/20170512-110547/20170512-110547.pb"
def init(self): super(InceptionResnetV1Model, self).init(scope='model')
# Load Facenet CNN
facenet.load_model(self.model_path)
# Save input and output tensors references
graph = tf.get_default_graph()
self.face_input = graph.get_tensor_by_name("input:0")
self.embedding_output = graph.get_tensor_by_name("embeddings:0")
def convert_to_classifier(self):
self.victim_embedding_input = tf.placeholder(
tf.float32,
#CHANGED HERE
shape=(None, 128))
Then I got:
Model filename: models/facenet/20170512-110547/20170512-110547.pb
WARNING:tensorflow:From /content/facenet/src/facenet.py:370: FastGFile.init (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.gfile.GFile.
Traceback (most recent call last):
File "facenet_fgsm.py", line 67, in
So I changed set_loader.py:
def load_testset(size):
pairs = lfw.read_pairs(pairs_path)
paths, labels = lfw.get_paths(testset_path, pairs)
Then I got:
Model filename: models/facenet/20170512-110547/20170512-110547.pb
WARNING:tensorflow:From /content/facenet/src/facenet.py:370: FastGFile.init (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.gfile.GFile.
Traceback (most recent call last):
File "facenet_fgsm.py", line 67, in
So I changed facenet/src/facenet.py
import imageio ... def load_data(image_paths, do_random_crop, do_random_flip, image_size, do_prewhiten=True): nrof_samples = len(image_paths) images = np.zeros((nrof_samples, image_size, image_size, 3)) for i in range(nrof_samples):
#img = misc.imread(image_paths[i])
img = imageio.imread(image_paths[i])
Which finally led to:
Colocations handled automatically by placer.
/content/cleverhans/cleverhans/compat.py:22: UserWarning: <function reduce_max_v1 at 0x7fd77fb3b510> is deprecated. Switch to calling the equivalent function in tensorflow. This function was originally needed as a compatibility layer for old versions of tensorflow, but support for those versions has now been dropped.
warnings.warn(str(f) + " is deprecated. Switch to calling the equivalent function in tensorflow. "
WARNING:tensorflow:From /content/cleverhans/cleverhans/attacks/attack.py:280: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Traceback (most recent call last):
File "facenet_fgsm.py", line 85, in fprop
")
NotImplementedError: <class 'main.InceptionResnetV1Model'>must implement get_logits
or must define a logits output in fprop
I think the example is still broken. : (
It looks like you are missing the fprop
method that needs to be implemented to complete the CleverHans model object (from cleverhans.model.Model
). You can find an example of such a class here: https://github.com/tensorflow/cleverhans/blob/master/examples/facenet_adversarial_faces/facenet_fgsm.py#L11
I am a bit confused. I am running the example you referenced above (facenet_fgsm.py) and it has an implemented fprop method.
Do I need to change the fprop method? It is currently:
def fprop(self, x, set_ref=False): return dict(zip(self.layer_names, self.layers))
I thought you were running python src/validate_on_lfw.py
. Did you make sure that the model is still an instance of cleverhans.model.Model
and has an fprop
right before you run the line that crashes?
The error that I was talking about related to a missing fprop method happens when I run facenet_fgsm.py
When I run validate_on_lfw.py I don't get errors with the newer model (20180402-114759) however I still get the missing fprop method when running facenet_fgsm.py with the newer model.
You are correct. With the older model (20170512-110547) I get the following error when running validate_on_lfw.py:
Instructions for updating:
tf.py_func is deprecated in TF V2. Instead, use
tf.py_function, which takes a python function which manipulates tf eager
tensors instead of numpy arrays. It's easy to convert a tf eager tensor to
an ndarray (just call tensor.numpy()) but having access to eager tensors
means tf.py_function
s can use accelerators such as GPUs as well as
being differentiable using a gradient tape.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/image_ops_impl.py:1241: div (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Deprecated in favor of operator or tf.math.divide.
WARNING:tensorflow:From /content/facenet/src/facenet.py:135: batch_join (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data
. Use tf.data.Dataset.interleave(...).batch(batch_size)
(or padded_batch(...)
if dynamic_pad=True
).
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:736: QueueRunner.init (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data
module.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:736: add_queue_runner (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data
module.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:823: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Model directory: /content/models/facenet/20170512-110547
Metagraph file: model-20170512-110547.meta
Checkpoint file: model-20170512-110547.ckpt-250000
2019-06-09 14:53:24.091085: W tensorflow/core/graph/graph_constructor.cc:1272] Importing a graph with a lower producer version 21 into an existing graph with producer version 27. Shape inference will have run different parts of the graph with different producer versions.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/importer.py", line 426, in import_graph_def
graph._c_graph, serialized, options) # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node Reshape was passed int32 from batch_join:1 incompatible with expected int64.
When I run the newer model (20180402-114759) src/validate_on_lfw.py works correctly and I get the correct accuracy output.
However, with the newer model I still get the missing fprop method.
So I think I know where the problem is.
I did not generate the model (.pb) files. They were downloaded from the link above. The Validate on LFW tutorial does not generate (serialize) the model .pb files. The newer model files work with Validate on LFW because David Sandberg did not need to add the fprop method to his output serialized facenet models that I downloaded.
The fprop method is a new method that needs to be added to facenet model (*.pb) objects so they can work in Cleverhans.
I looked in facenet/src/models/inception_resnet_v1.py of David Sandberger's facenet implementation but there is no definition of a class for me to add the fprop method to.
The line that crashes starts from facenet_fgsm.py.
This doesn't make any sense. I am running facenet_fgsm.py which instantiates the correct model type
from cleverhans.model import Model ... class InceptionResnetV1Model(Model):
model = InceptionResnetV1Model()
Ok, looking at the stack again: File "facenet_fgsm.py", line 85, in adv_x = fgsm.generate(model.face_input, fgsm_params) File "/content/cleverhans/cleverhans/attacks/fast_gradient_method.py", line 54, in generate self.model.get_logits(x),** File "/content/cleverhans/cleverhans/model.py", line 70, in get_logits " output in fprop") NotImplementedError: <class 'main.InceptionResnetV1Model'>must implement get_logits or must define a logits output in fprop
The problem is not the missing fprop but the missing
get_logits()
method definition of InceptionResnetV1Model in facenet_fgsm.py
Am I supposed to implement that, and how should I do this if I wasn't the one who created the model (because I downloaded it).
Thank you again for your patience in all this. I think we are almost there.
Clever
I think you are correct, I haven't worked on this particular example (it was added by @BrunoLopezGarcia) but it looks like it was written before we made sure that the FGSM was called on logits: see https://github.com/tensorflow/cleverhans/blob/13c84b4411083c4840d3c62329f3cca106b4f499/cleverhans/attacks/fast_gradient_method.py#L54
Unfortunately, I don't know much about FaceNet but yes you would have to find a way to create a method get_logits that take an input tensor and returns a tensor containing the corresponding logits. I looked a bit at the code in the example, and it sounds like it is just computing a distance between embeddings and processing the distance to compute a score that is used in place of a classification score. Given that there are no real logits or probs (if my understanding is correct), I think it's ok to just change the following line https://github.com/tensorflow/cleverhans/blob/13c84b4411083c4840d3c62329f3cca106b4f499/examples/facenet_adversarial_faces/facenet_fgsm.py#L49 to say instead
self.layer_names.append('logits')
Ok, will try after I finish my workout.
Thanks, Abe
On Mon, Jun 10, 2019, 3:37 PM Nicolas Papernot notifications@github.com wrote:
I think you are correct, I haven't worked on this particular example (it was added by @BrunoLopezGarcia https://github.com/BrunoLopezGarcia) but it looks like it was written before we made sure that the FGSM was called on logits: see https://github.com/tensorflow/cleverhans/blob/13c84b4411083c4840d3c62329f3cca106b4f499/cleverhans/attacks/fast_gradient_method.py#L54
Unfortunately, I don't know much about FaceNet but yes you would have to find a way to create a method get_logits that take an input tensor and returns a tensor containing the corresponding logits. I looked a bit at the code in the example, and it sounds like it is just computing a distance between embeddings and processing the distance to compute a score that is used in place of a classification score. Given that there are no real logits or probs (if my understanding is correct), I think it's ok to just change the following line
self.layer_names.append('logits')
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/cleverhans/issues/1067?email_source=notifications&email_token=AF5TCUG7IB6CJTI3PLQ5HWDPZ3JRRA5CNFSM4HWILZLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXLNTQI#issuecomment-500619713, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5TCUHYIR2F6SCMLLWQOD3PZ3JRRANCNFSM4HWILZLA .
I think you are correct. There shouldn't be a logits layer because Facenet is using image embeddings and triplet loss.
Well, I got farther but now I am running out of memory on Colab. Something seems a bit weird.
I successfully got through the Validate on LFW tutorial.
After getting these working on Colab I am going to share out the notebooks.
Also would like to update the docs.
Have shared the notebooks with you if you want to take a look at what I have done.
Not sure how to proceed forward from here.
Thanks for the help, Abe
* Begin log output ***
2019-06-11 16:22:35.454889: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz
2019-06-11 16:22:35.455200: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x1ca91e0 executing computations on platform Host. Devices:
2019-06-11 16:22:35.455257: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0):
2019-06-11 16:23:09.217312: W tensorflow/core/common_runtime/bfcallocator.cc:271] ***__*____****__******** 2019-06-11 16:23:09.217373: W tensorflow/core/framework/op_kernel.cc:1401] OP_REQUIRES failed at fused_batch_norm_op.cc:285 : Resource exhausted: OOM when allocating tensor with shape[1000,64,77,77] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1334, in _do_call return fn(args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[1000,64,77,77] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc [[{{node InceptionResnetV1/Conv2d_2b_3x3/BatchNorm/cond/FusedBatchNorm_1}}]] Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
[[{{node Identity}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "facenet_fgsm.py", line 95, in
[[node Identity (defined at /content/cleverhans/cleverhans/attacks/fast_gradient_method.py:208) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
Caused by op 'InceptionResnetV1/Conv2d_2b_3x3/BatchNorm/cond/FusedBatchNorm_1', defined at:
File "facenet_fgsm.py", line 63, in
ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1000,64,77,77] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc [[node InceptionResnetV1/Conv2d_2b_3x3/BatchNorm/cond/FusedBatchNorm_1 (defined at /content/facenet/src/facenet.py:379) ]] Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
[[node Identity (defined at /content/cleverhans/cleverhans/attacks/fast_gradient_method.py:208) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info. End Log Output
I have
Ok, got farther.
Realized that I was getting out of memory errors because the input dimensions from the model had increased from 128 to 512 so I reduced the testset size.
self.victim_embedding_input = tf.placeholder(
tf.float32,
#CHANGED HERE some models have 512 others have 128
shape=(None, 512))
... with tf.Graph().as_default(): with tf.Session() as sess:
model = InceptionResnetV1Model()
# Convert to classifier
model.convert_to_classifier()
# Load pairs of faces and their labels in one-hot encoding
#CHANGED HERE reduced size of testset because of OOM errors 1000 to 333
faces1, faces2, labels = set_loader.load_testset(333)
I tried changing batch_size and --emb_dim but those did not work.
I have been looking at torch.cuda.empty_cache() and its equivalents but I don't know where to add it.
Finally, what I was hoping to get was the perturbed images from the lfw dataset. I am assuming that the facenet_fgsm.py generated these files but I don't see them on the file system.
Also the outputs from running different times with different settings don't seem to make sense:
Testset size: 250. Batch size 64 FGSM step 1 Accuracy: 97.2% Accuracy against adversarial examples for same person faces (dodging): 8.547008547008547% Accuracy against adversarial examples for different people faces (impersonation): 48.1203007518797%
Batch size 32 first run FGSM step 1 Accuracy: 96.8% Accuracy against adversarial examples for same person faces (dodging): 8.633093525179856% Accuracy against adversarial examples for different people faces (impersonation): 42.34234234234234%
Batch size 32 second run FGSM step 1 Accuracy: 96.8% Accuracy against adversarial examples for same person faces (dodging): 7.5% Accuracy against adversarial examples for different people faces (impersonation): 46.92307692307692%
Testset size: 333 batch size 64 Use tf.cast instead. FGSM step 1 Accuracy: 95.4954954954955% Accuracy against adversarial examples for same person faces (dodging): 13.953488372093023% Accuracy against adversarial examples for different people faces (impersonation): 59.62732919254658%
Testset size: 333 batch size 64 second run FGSM step 1 Accuracy: 96.69669669669669% Accuracy against adversarial examples for same person faces (dodging): 12.162162162162163% Accuracy against adversarial examples for different people faces (impersonation): 56.21621621621622% Got warning no error
Batch size 32 first run FGSM step 1 Accuracy: 96.996996996997% Accuracy against adversarial examples for same person faces (dodging): 9.036144578313253% Accuracy against adversarial examples for different people faces (impersonation): 46.10778443113773%
Batch size 32 second run FGSM step 1 Accuracy: 97.2972972972973% Accuracy against adversarial examples for same person faces (dodging): 9.815950920245399% Accuracy against adversarial examples for different people faces (impersonation): 49.411764705882355% Got memory limit warning
340 FGSM step 1 Accuracy: 96.17647058823529% Accuracy against adversarial examples for same person faces (dodging): 11.65644171779141% Accuracy against adversarial examples for different people faces (impersonation): 53.672316384180796%
350 Out of memory errors but got result? Accuracy: 95.71428571428572% Accuracy against adversarial examples for same person faces (dodging): 12.804878048780488% Accuracy against adversarial examples for different people faces (impersonation): 55.91397849462365%
I am totally off here?
Thanks, Abe
Could you state what your problem is now?
Hi Nicolas,
Thanks for checking in on this.
Got things working. Not all the pictures were aligned but I don't know if that is expected.
Here is the location of the two notebooks.
https://github.com/leadharbor/MLSec
One is associated with setting up and running FaceNet and the other for setting up and running the CleverHans FGSM on FaceNet example.
There were files in both Cleverhans and Facenet that needed to change to get the demos working. I included them in the notebooks as well and how to change them.
Look for "CHANGE HERE".
Finally, I was wondering what is the best way to update the Cleverhans documentation to account for the changes.
Regards, Abe
On Mon, Jun 17, 2019 at 10:11 PM Nicolas Papernot notifications@github.com wrote:
Could you state what your problem is now?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/cleverhans/issues/1067?email_source=notifications&email_token=AF5TCUAO4XYKP4TT4ZCSQDLP3BU65A5CNFSM4HWILZLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX5GNGA#issuecomment-502949528, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5TCUHFY2J3RK5GULC22O3P3BU65ANCNFSM4HWILZLA .
Great to hear that things are now working. If you find that the attacks are not evading the model as often as you would expect, you might want to switch to an iterative attack (e.g., PGD).
Unfortunately I won't have time to look at your notebooks but you can definitely open PRs to make changes to CleverHans documentation and code.
Thanks!
Will do.
Thanks Again Nicholas.
Glad you are one of the outstanding people working on Cleverhans.
Regards, Abe
On Tue, Jun 18, 2019 at 8:12 AM Nicolas Papernot notifications@github.com wrote:
Great to hear that things are now working. If you find that the attacks are not evading the model as often as you would expect, you might want to switch to an iterative attack (e.g., PGD).
Unfortunately I won't have time to look at your notebooks but you can definitely open PRs to make changes to CleverHans documentation and code.
Thanks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tensorflow/cleverhans/issues/1067?email_source=notifications&email_token=AF5TCUBFZUL7CUU56LCLZHDP3D3OHA5CNFSM4HWILZLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX662LA#issuecomment-503180588, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5TCUAGSV2KKEFLTWBHC6DP3D3OHANCNFSM4HWILZLA .
The issue tracker should only be used to report bugs or feature requests. If you are looking for support from other library users, please ask a question on StackOverflow.
Describe the bug After running through all the steps as outlined in the readme for "FGSM against FaceNet" I am still getting an error when running facenet_fgsm.py:
I tried both models: model_path = "models/facenet/20180402-114759/20180402-114759.pb"
model_path = "models/facenet/20170512-110547/20170512-110547.pb"
The newer model (2018) from https://github.com/davidsandberg/facenet/wiki/Validate-on-LFW tutorial gives the following error:
.../content/cleverhans/cleverhans/attacks_tf.py:27: UserWarning: attacks_tf is deprecated and will be removed on 2019-07-18 or after. Code should import functions from their new locations directly. warnings.warn("attacks_tf is deprecated and will be removed on 2019-07-18" WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/control_flow_ops.py:3632: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. /content/cleverhans/cleverhans/compat.py:22: UserWarning: <function reduce_max_v1 at 0x7f16d353f510> is deprecated. Switch to calling the equivalent function in tensorflow. This function was originally needed as a compatibility layer for old versions of tensorflow, but support for those versions has now been dropped. warnings.warn(str(f) + " is deprecated. Switch to calling the equivalent function in tensorflow. " WARNING:tensorflow:From /content/cleverhans/cleverhans/attacks/attack.py:280: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. Traceback (most recent call last): File "facenet_fgsm.py", line 85, in
adv_x = fgsm.generate(model.face_input, **fgsm_params)
File "/content/cleverhans/cleverhans/attacks/fast_gradient_method.py", line 54, in generate
self.model.get_logits(x),
File "/content/cleverhans/cleverhans/model.py", line 70, in get_logits
" output in
fprop
") NotImplementedError: <class 'main.InceptionResnetV1Model'>must implementget_logits
or must define a logits output infprop
The older model path 2017 gives the following error in facenet_fgsm.py
Model filename: models/facenet/20170512-110547/20170512-110547.pb WARNING:tensorflow:From /content/facenet/src/facenet.py:376: FastGFile.init (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version. Instructions for updating: Use tf.gfile.GFile. Traceback (most recent call last): File "facenet_fgsm.py", line 62, in
model = InceptionResnetV1Model()
File "facenet_fgsm.py", line 20, in init
facenet.load_model(self.model_path)
File "/content/facenet/src/facenet.py", line 378, in load_model
graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect it to work as I am following the examples as stated
System configuration