diff --git a/fawkes/protection.py b/fawkes/protection.py index a0be165..f3853f9 100644 --- a/fawkes/protection.py +++ b/fawkes/protection.py @@ -57,8 +57,8 @@ class Fawkes(object): def mode2param(self, mode): if mode == 'low': - th = 0.005 - max_step = 30 + th = 0.004 + max_step = 40 lr = 25 extractors = ["extractor_2"] @@ -133,7 +133,7 @@ class Fawkes(object): continue p_img = final_images[i] path = image_paths[i] - file_name = "{}_{}_cloaked.{}".format(".".join(path.split(".")[:-1]), self.mode, format) + file_name = "{}_cloaked.{}".format(".".join(path.split(".")[:-1]), format) dump_image(p_img, file_name, format=format) print("Done!") diff --git a/fawkes/utils.py b/fawkes/utils.py index 8609739..07ccf36 100644 --- a/fawkes/utils.py +++ b/fawkes/utils.py @@ -133,6 +133,7 @@ class Faces(object): self.verbose = verbose self.no_align = no_align self.aligner = aligner + self.margin = 30 self.org_faces = [] self.cropped_faces = [] self.cropped_faces_shape = [] @@ -169,7 +170,8 @@ class Faces(object): if eval_local: base = resize(img, (IMG_SIZE, IMG_SIZE)) else: - long_size = max([img.shape[1], img.shape[0]]) + long_size = max([img.shape[1], img.shape[0]]) + self.margin + base = np.ones((long_size, long_size, 3)) * np.mean(img, axis=(0, 1)) start1, end1 = get_ends(long_size, img.shape[0]) @@ -215,7 +217,7 @@ class Faces(object): org_shape = self.cropped_faces_shape[i] - old_square_shape = max([org_shape[0], org_shape[1]]) + old_square_shape = max([org_shape[0], org_shape[1]]) + self.margin cur_protected = resize(cur_protected, (old_square_shape, old_square_shape)) cur_original = resize(cur_original, (old_square_shape, old_square_shape))