pull/136/head
Shawn-Shan 2021-05-03 16:45:10 -05:00
rodzic b9d3ca46da
commit 5d1c2ad2d7
2 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -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!")

Wyświetl plik

@ -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))