Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lpips_tf.py for Windows compatibility #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lpips_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def lpips(input0, input1, model='net-lin', net='alex', version=0.1):
default_graph = tf.get_default_graph()
producer_version = default_graph.graph_def_versions.producer

cache_dir = os.path.expanduser('~/.lpips')
cache_dir = os.path.join(os.path.expanduser("~"), '.lpips')
os.makedirs(cache_dir, exist_ok=True)
# files to try. try a specific producer version, but fallback to the version-less version (latest).
pb_fnames = [
Expand All @@ -70,7 +70,7 @@ def lpips(input0, input1, model='net-lin', net='alex', version=0.1):
for pb_fname in pb_fnames:
if not os.path.isfile(os.path.join(cache_dir, pb_fname)):
try:
_download(os.path.join(_URL, pb_fname), cache_dir)
_download(_URL + '/' + pb_fname, cache_dir)
except urllib.error.HTTPError:
pass
if os.path.isfile(os.path.join(cache_dir, pb_fname)):
Expand Down