mirror of
https://github.com/Shawn-Shan/fawkes.git
synced 2024-12-22 07:09:33 +05:30
0.3 software release
This commit is contained in:
parent
1a810c8fb7
commit
fa239fa85c
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user