From e5c84957a898bcc0c2a65f989ccb1f18c3c94f6e Mon Sep 17 00:00:00 2001 From: SunGaofeng Date: Wed, 25 Sep 2019 07:55:40 -0500 Subject: [PATCH] fix pretrain params download in windows (#3410) fix path of dir of files in windows --- PaddleCV/PaddleVideo/models/model.py | 2 +- PaddleCV/PaddleVideo/models/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PaddleCV/PaddleVideo/models/model.py b/PaddleCV/PaddleVideo/models/model.py index ddce3968..fd04dfde 100644 --- a/PaddleCV/PaddleVideo/models/model.py +++ b/PaddleCV/PaddleVideo/models/model.py @@ -23,7 +23,7 @@ except: import paddle.fluid as fluid from .utils import download, AttrDict -WEIGHT_DIR = os.path.expanduser("~/.paddle/weights") +WEIGHT_DIR = os.path.join(os.path.expanduser('~'), '.paddle', 'weights') logger = logging.getLogger(__name__) diff --git a/PaddleCV/PaddleVideo/models/utils.py b/PaddleCV/PaddleVideo/models/utils.py index b02abfdf..3eead927 100644 --- a/PaddleCV/PaddleVideo/models/utils.py +++ b/PaddleCV/PaddleVideo/models/utils.py @@ -21,13 +21,13 @@ __all__ = ['decompress', 'download', 'AttrDict'] def decompress(path): t = tarfile.open(path) - t.extractall(path='/'.join(path.split('/')[:-1])) + t.extractall(path=os.path.split(path)[0]) t.close() os.remove(path) def download(url, path): - weight_dir = '/'.join(path.split('/')[:-1]) + weight_dir = os.path.split(path)[0] if not os.path.exists(weight_dir): os.makedirs(weight_dir) -- GitLab