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/
|
# @Link : https://www.shawnshan.com/
|
||||||
|
|
||||||
|
|
||||||
__version__ = '0.1.0'
|
__version__ = '0.3.1'
|
||||||
|
|
||||||
from .detect_faces import create_mtcnn, run_detect_face
|
from .detect_faces import create_mtcnn, run_detect_face
|
||||||
from .differentiator import FawkesMaskGeneration
|
from .differentiator import FawkesMaskGeneration
|
||||||
|
@ -42,7 +42,7 @@ class Fawkes(object):
|
|||||||
model_dir = os.path.join(os.path.expanduser('~'), '.fawkes')
|
model_dir = os.path.join(os.path.expanduser('~'), '.fawkes')
|
||||||
if not os.path.exists(os.path.join(model_dir, "mtcnn.p.gz")):
|
if not os.path.exists(os.path.join(model_dir, "mtcnn.p.gz")):
|
||||||
os.makedirs(model_dir, exist_ok=True)
|
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='')
|
cache_subdir='')
|
||||||
|
|
||||||
self.fs_names = [feature_extractor]
|
self.fs_names = [feature_extractor]
|
||||||
|
@ -394,12 +394,12 @@ def load_extractor(name):
|
|||||||
model = keras.models.load_model(model_file)
|
model = keras.models.load_model(model_file)
|
||||||
else:
|
else:
|
||||||
print("Download models...")
|
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='')
|
cache_dir=model_dir, cache_subdir='')
|
||||||
model = keras.models.load_model(model_file)
|
model = keras.models.load_model(model_file)
|
||||||
|
|
||||||
if not os.path.exists(emb_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='')
|
cache_dir=model_dir, cache_subdir='')
|
||||||
|
|
||||||
if hasattr(model.layers[-1], "activation") and model.layers[-1].activation == "softmax":
|
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
|
continue
|
||||||
try:
|
try:
|
||||||
get_file("{}.jpg".format(i),
|
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))
|
cache_dir=model_dir, cache_subdir='target_data/{}/'.format(target_data_id))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@ -516,6 +516,10 @@ def select_target_label(imgs, feature_extractors_ls, feature_extractors_names, m
|
|||||||
return np.array(target_images)
|
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,
|
def get_file(fname,
|
||||||
origin,
|
origin,
|
||||||
untar=False,
|
untar=False,
|
||||||
|
2
setup.py
2
setup.py
@ -78,9 +78,7 @@ install_requires = [
|
|||||||
'numpy==1.16.4',
|
'numpy==1.16.4',
|
||||||
# 'tensorflow-gpu>=1.13.1, <=1.14.0',
|
# 'tensorflow-gpu>=1.13.1, <=1.14.0',
|
||||||
'tensorflow>=1.12.0, <=1.15.0', # change this is tensorflow-gpu if using GPU machine.
|
'tensorflow>=1.12.0, <=1.15.0', # change this is tensorflow-gpu if using GPU machine.
|
||||||
'argparse',
|
|
||||||
'keras>=2.2.5, <=2.3.1',
|
'keras>=2.2.5, <=2.3.1',
|
||||||
'scikit-image',
|
|
||||||
'pillow>=7.0.0',
|
'pillow>=7.0.0',
|
||||||
'bleach>=2.1.0'
|
'bleach>=2.1.0'
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user