diff --git a/ppdet/utils/download.py b/ppdet/utils/download.py index d5f8cc14639508728e9b5212a5696360cf981951..f561e3edda0f78cda00c4c059910885c772150e3 100644 --- a/ppdet/utils/download.py +++ b/ppdet/utils/download.py @@ -154,7 +154,7 @@ def create_voc_list(data_dir, devkit_subdir='VOCdevkit'): def map_path(url, root_dir): # parse path after download to decompress under root_dir - fname = url.split('/')[-1] + fname = osp.split(url)[-1] zip_formats = ['.zip', '.tar', '.gz'] fpath = fname for zip_format in zip_formats: @@ -186,7 +186,7 @@ def get_path(url, root_dir, md5sum=None, check_exist=True): } for k, v in decompress_name_map.items(): if fullpath.find(k) >= 0: - fullpath = '/'.join(fullpath.split('/')[:-1] + [v]) + fullpath = osp.join(osp.split(fullpath)[0], v) exist_flag = False if osp.exists(fullpath) and check_exist: @@ -247,7 +247,7 @@ def _download(url, path, md5sum=None): if not osp.exists(path): os.makedirs(path) - fname = url.split('/')[-1] + fname = osp.split(url)[-1] fullname = osp.join(path, fname) retry_cnt = 0 @@ -314,7 +314,7 @@ def _decompress(fname): # decompress to fpath_tmp directory firstly, if decompress # successed, move decompress files to fpath and delete # fpath_tmp and remove download compress file. - fpath = '/'.join(fname.split('/')[:-1]) + fpath = osp.split(fname)[0] fpath_tmp = osp.join(fpath, 'tmp') if osp.isdir(fpath_tmp): shutil.rmtree(fpath_tmp)