Skip to content

Commit 5ca3f99

Browse files
committed
create dir after model downloaded
1 parent 7afb4c4 commit 5ca3f99

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

python-package/insightface/utils/storage.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,19 @@ def download(sub_dir, name, force=False, root='~/.insightface'):
1111
dir_path = os.path.join(_root, sub_dir, name)
1212
if osp.exists(dir_path) and not force:
1313
return dir_path
14-
if not os.path.exists(dir_path):
15-
os.makedirs(dir_path)
1614
print('download_path:', dir_path)
1715
zip_file_path = os.path.join(_root, sub_dir, name + '.zip')
1816
model_url = "%s/%s/%s.zip"%(BASE_REPO_URL, sub_dir, name)
1917
download_file(model_url,
2018
path=zip_file_path,
2119
overwrite=True)
20+
if not os.path.exists(dir_path):
21+
os.makedirs(dir_path)
2222
with zipfile.ZipFile(zip_file_path) as zf:
2323
zf.extractall(dir_path)
2424
os.remove(zip_file_path)
2525
return dir_path
2626

2727
def ensure_available(sub_dir, name, root='~/.insightface'):
28-
_root = os.path.expanduser(root)
29-
dir_path = os.path.join(_root, sub_dir, name)
30-
if osp.exists(dir_path):
31-
return dir_path
3228
return download(sub_dir, name, force=False, root=root)
3329

0 commit comments

Comments
 (0)