0.3 software release

pull/50/head
Shawn-Shan 2020-07-29 16:42:16 -05:00
rodzic 1a810c8fb7
commit fa239fa85c
5 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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'
]