From fa239fa85c9839ade9f2aca8d872363abc31b19b Mon Sep 17 00:00:00 2001 From: Shawn-Shan Date: Wed, 29 Jul 2020 16:42:16 -0500 Subject: [PATCH] 0.3 software release --- fawkes/__init__.py | 2 +- fawkes/protection.py | 2 +- fawkes/utils.py | 10 +++++++--- fawkes/master.py => master.py | 0 setup.py | 2 -- 5 files changed, 9 insertions(+), 7 deletions(-) rename fawkes/master.py => master.py (100%) diff --git a/fawkes/__init__.py b/fawkes/__init__.py index b983fb9..7fac53b 100644 --- a/fawkes/__init__.py +++ b/fawkes/__init__.py @@ -4,7 +4,7 @@ # @Link : https://www.shawnshan.com/ -__version__ = '0.1.0' +__version__ = '0.3.1' from .detect_faces import create_mtcnn, run_detect_face from .differentiator import FawkesMaskGeneration diff --git a/fawkes/protection.py b/fawkes/protection.py index 87a2c26..458e621 100644 --- a/fawkes/protection.py +++ b/fawkes/protection.py @@ -42,7 +42,7 @@ class Fawkes(object): model_dir = os.path.join(os.path.expanduser('~'), '.fawkes') if not os.path.exists(os.path.join(model_dir, "mtcnn.p.gz")): os.makedirs(model_dir, exist_ok=True) - get_file("mtcnn.p.gz", "http://sandlab.cs.uchicago.edu/fawkes/files/mtcnn.p.gz", cache_dir=model_dir, + get_file("mtcnn.p.gz", "http://mirror.cs.uchicago.edu/fawkes/files/mtcnn.p.gz", cache_dir=model_dir, cache_subdir='') self.fs_names = [feature_extractor] diff --git a/fawkes/utils.py b/fawkes/utils.py index 7a76914..0627bc2 100644 --- a/fawkes/utils.py +++ b/fawkes/utils.py @@ -394,12 +394,12 @@ def load_extractor(name): model = keras.models.load_model(model_file) else: print("Download models...") - get_file("{}.h5".format(name), "http://sandlab.cs.uchicago.edu/fawkes/files/{}.h5".format(name), + get_file("{}.h5".format(name), "http://mirror.cs.uchicago.edu/fawkes/files/{}.h5".format(name), cache_dir=model_dir, cache_subdir='') model = keras.models.load_model(model_file) if not os.path.exists(emb_file): - get_file("{}_emb.p.gz".format(name), "http://sandlab.cs.uchicago.edu/fawkes/files/{}_emb.p.gz".format(name), + get_file("{}_emb.p.gz".format(name), "http://mirror.cs.uchicago.edu/fawkes/files/{}_emb.p.gz".format(name), cache_dir=model_dir, cache_subdir='') if hasattr(model.layers[-1], "activation") and model.layers[-1].activation == "softmax": @@ -495,7 +495,7 @@ def select_target_label(imgs, feature_extractors_ls, feature_extractors_names, m continue try: get_file("{}.jpg".format(i), - "http://sandlab.cs.uchicago.edu/fawkes/files/target_data/{}/{}.jpg".format(target_data_id, i), + "http://mirror.cs.uchicago.edu/fawkes/files/target_data/{}/{}.jpg".format(target_data_id, i), cache_dir=model_dir, cache_subdir='target_data/{}/'.format(target_data_id)) except Exception: pass @@ -516,6 +516,10 @@ def select_target_label(imgs, feature_extractors_ls, feature_extractors_names, m return np.array(target_images) +""" TensorFlow implementation get_file +https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/python/keras/utils/data_utils.py#L168-L297 +""" + def get_file(fname, origin, untar=False, diff --git a/fawkes/master.py b/master.py similarity index 100% rename from fawkes/master.py rename to master.py diff --git a/setup.py b/setup.py index 84d5a94..9c8bf08 100644 --- a/setup.py +++ b/setup.py @@ -78,9 +78,7 @@ install_requires = [ 'numpy==1.16.4', # 'tensorflow-gpu>=1.13.1, <=1.14.0', 'tensorflow>=1.12.0, <=1.15.0', # change this is tensorflow-gpu if using GPU machine. - 'argparse', 'keras>=2.2.5, <=2.3.1', - 'scikit-image', 'pillow>=7.0.0', 'bleach>=2.1.0' ]