mirror of
https://github.com/Shawn-Shan/fawkes.git
synced 2026-06-12 21:50:46 +05:30
0.0.1
This commit is contained in:
@@ -46,6 +46,13 @@ To evaluate the cloak, run `python3 fawkes/eval_cloak.py --gpu 0 --cloak_data PA
|
||||
The code will print out the tracker model accuracy on uncloaked/original test images of the protected user, which should be close to 0.
|
||||
|
||||
|
||||
#### Exisiting Feature extractors
|
||||
|
||||
We shared three different feature extractors under feature_extractors/
|
||||
1. low_extract.h5: trained on WebFace dataset with DenseNet architecture.
|
||||
2. mid_extract.h5: VGGFace2 dataset with DenseNet architecture. Trained with PGD adversarial training for 5 epochs.
|
||||
3. high_extract.h5: WebFace dataset with DenseNet architecture. Trained with PGD adversarial training for 20 epochs.
|
||||
|
||||
### Citation
|
||||
```
|
||||
@inproceedings{shan2020fawkes,
|
||||
|
||||
@@ -3,8 +3,8 @@ import json
|
||||
import os
|
||||
|
||||
DATASETS = {
|
||||
"pubfig": "../data/pubfig",
|
||||
"scrub": "/home/shansixioing/cloak/fawkes/data/scrub/",
|
||||
# "vggface1": "/mnt/data/sixiongshan/data/vggface/",
|
||||
"vggface2": "/mnt/data/sixiongshan/data/vggface2/",
|
||||
"webface": "/mnt/data/sixiongshan/data/webface/",
|
||||
"youtubeface": "/mnt/data/sixiongshan/data/youtubeface/keras_flow_data/",
|
||||
|
||||
@@ -207,8 +207,7 @@ class FawkesMaskGeneration:
|
||||
# we're creating
|
||||
start_vars = set(x.name for x in tf.global_variables())
|
||||
self.learning_rate_holder = tf.placeholder(tf.float32, shape=[])
|
||||
# optimizer = tf.train.AdadeltaOptimizer(self.learning_rate_holder)
|
||||
optimizer = tf.train.AdamOptimizer(self.learning_rate_holder)
|
||||
optimizer = tf.train.AdadeltaOptimizer(self.learning_rate_holder)
|
||||
|
||||
self.train = optimizer.minimize(self.loss_sum,
|
||||
var_list=[self.modifier])
|
||||
|
||||
@@ -44,7 +44,7 @@ def main():
|
||||
for k, v in path2emb.items():
|
||||
path2emb[k] = normalize(v)
|
||||
|
||||
pickle.dump(path2emb, open("../feature_extractors/embeddings/{}_emb_norm.p".format(args.feature_extractor), "wb"))
|
||||
pickle.dump(path2emb, open("../feature_extractors/embeddings/{}_emb.p".format(args.feature_extractor), "wb"))
|
||||
|
||||
|
||||
def parse_arguments(argv):
|
||||
|
||||
@@ -83,9 +83,9 @@ def parse_arguments(argv):
|
||||
help="name of the feature extractor used for optimization",
|
||||
default="webface_dense_robust_extract")
|
||||
parser.add_argument('--th', type=float, default=0.007)
|
||||
parser.add_argument('--sd', type=int, default=1e5)
|
||||
parser.add_argument('--sd', type=int, default=1e9)
|
||||
parser.add_argument('--protect_class', type=str, default=None)
|
||||
parser.add_argument('--lr', type=float, default=0.1)
|
||||
parser.add_argument('--lr', type=float, default=1)
|
||||
|
||||
return parser.parse_args(argv)
|
||||
|
||||
|
||||
+2
-1
@@ -13,7 +13,7 @@ from keras.models import Model
|
||||
from keras.preprocessing import image
|
||||
from keras.utils import to_categorical
|
||||
from sklearn.metrics import pairwise_distances
|
||||
|
||||
# from keras.utils import get_file
|
||||
|
||||
def clip_img(X, preprocessing='raw'):
|
||||
X = reverse_preprocess(X, preprocessing)
|
||||
@@ -172,6 +172,7 @@ def imagenet_reverse_preprocessing(x, data_format=None):
|
||||
return x
|
||||
|
||||
|
||||
|
||||
def build_bottleneck_model(model, cut_off):
|
||||
bottleneck_model = Model(model.input, model.get_layer(cut_off).output)
|
||||
bottleneck_model.compile(loss='categorical_crossentropy',
|
||||
|
||||
Reference in New Issue
Block a user