提交 404d3965 编写于 作者: F FlyingQianMM

delete paddlehub for download pretrain_weights

上级 5d76f932
...@@ -203,30 +203,30 @@ def get_pretrain_weights(flag, class_name, backbone, save_dir): ...@@ -203,30 +203,30 @@ def get_pretrain_weights(flag, class_name, backbone, save_dir):
backbone) backbone)
# if backbone == 'AlexNet': # if backbone == 'AlexNet':
# url = image_pretrain[backbone] url = image_pretrain[backbone]
# fname = osp.split(url)[-1].split('.')[0] fname = osp.split(url)[-1].split('.')[0]
# paddlex.utils.download_and_decompress(url, path=new_save_dir) paddlex.utils.download_and_decompress(url, path=new_save_dir)
# return osp.join(new_save_dir, fname) return osp.join(new_save_dir, fname)
try: #try:
logging.info( # logging.info(
"Connecting PaddleHub server to get pretrain weights...") # "Connecting PaddleHub server to get pretrain weights...")
hub.download(backbone, save_path=new_save_dir) # hub.download(backbone, save_path=new_save_dir)
except Exception as e: #except Exception as e:
logging.error( # logging.error(
"Couldn't download pretrain weight, you can download it manualy from {} (decompress the file if it is a compressed file), and set pretrain weights by your self". # "Couldn't download pretrain weight, you can download it manualy from {} (decompress the file if it is a compressed file), and set pretrain weights by your self".
format(image_pretrain[backbone]), # format(image_pretrain[backbone]),
exit=False) # exit=False)
if isinstance(e, hub.ResourceNotFoundError): # if isinstance(e, hub.ResourceNotFoundError):
raise Exception("Resource for backbone {} not found".format( # raise Exception("Resource for backbone {} not found".format(
backbone)) # backbone))
elif isinstance(e, hub.ServerConnectionError): # elif isinstance(e, hub.ServerConnectionError):
raise Exception( # raise Exception(
"Cannot get reource for backbone {}, please check your internet connection" # "Cannot get reource for backbone {}, please check your internet connection"
.format(backbone)) # .format(backbone))
else: # else:
raise Exception( # raise Exception(
"Unexpected error, please make sure paddlehub >= 1.6.2") # "Unexpected error, please make sure paddlehub >= 1.6.2")
return osp.join(new_save_dir, backbone) #return osp.join(new_save_dir, backbone)
elif flag in ['COCO', 'CITYSCAPES']: elif flag in ['COCO', 'CITYSCAPES']:
new_save_dir = save_dir new_save_dir = save_dir
if hasattr(paddlex, 'pretrain_dir'): if hasattr(paddlex, 'pretrain_dir'):
...@@ -241,28 +241,28 @@ def get_pretrain_weights(flag, class_name, backbone, save_dir): ...@@ -241,28 +241,28 @@ def get_pretrain_weights(flag, class_name, backbone, save_dir):
elif flag == 'CITYSCAPES': elif flag == 'CITYSCAPES':
url = cityscapes_pretrain[backbone] url = cityscapes_pretrain[backbone]
fname = osp.split(url)[-1].split('.')[0] fname = osp.split(url)[-1].split('.')[0]
# paddlex.utils.download_and_decompress(url, path=new_save_dir) paddlex.utils.download_and_decompress(url, path=new_save_dir)
# return osp.join(new_save_dir, fname) return osp.join(new_save_dir, fname)
try: #try:
logging.info( # logging.info(
"Connecting PaddleHub server to get pretrain weights...") # "Connecting PaddleHub server to get pretrain weights...")
hub.download(backbone, save_path=new_save_dir) # hub.download(backbone, save_path=new_save_dir)
except Exception as e: #except Exception as e:
logging.error( # logging.error(
"Couldn't download pretrain weight, you can download it manualy from {} (decompress the file if it is a compressed file), and set pretrain weights by your self". # "Couldn't download pretrain weight, you can download it manualy from {} (decompress the file if it is a compressed file), and set pretrain weights by your self".
format(url), # format(url),
exit=False) # exit=False)
if isinstance(hub.ResourceNotFoundError): # if isinstance(hub.ResourceNotFoundError):
raise Exception("Resource for backbone {} not found".format( # raise Exception("Resource for backbone {} not found".format(
backbone)) # backbone))
elif isinstance(hub.ServerConnectionError): # elif isinstance(hub.ServerConnectionError):
raise Exception( # raise Exception(
"Cannot get reource for backbone {}, please check your internet connection" # "Cannot get reource for backbone {}, please check your internet connection"
.format(backbone)) # .format(backbone))
else: # else:
raise Exception( # raise Exception(
"Unexpected error, please make sure paddlehub >= 1.6.2") # "Unexpected error, please make sure paddlehub >= 1.6.2")
return osp.join(new_save_dir, backbone) #return osp.join(new_save_dir, backbone)
else: else:
logging.error("Path of retrain weights '{}' is not exists!".format( logging.error("Path of retrain weights '{}' is not exists!".format(
flag)) flag))
...@@ -30,7 +30,7 @@ setuptools.setup( ...@@ -30,7 +30,7 @@ setuptools.setup(
setup_requires=['cython', 'numpy'], setup_requires=['cython', 'numpy'],
install_requires=[ install_requires=[
"pycocotools;platform_system!='Windows'", 'pyyaml', 'colorama', 'tqdm', "pycocotools;platform_system!='Windows'", 'pyyaml', 'colorama', 'tqdm',
'paddleslim==1.1.1', 'visualdl>=2.0.0', 'paddlehub>=1.8.2', 'paddleslim==1.0.1', 'visualdl>=2.0.0', 'paddlehub>=1.8.2',
'shapely>=1.7.0', "opencv-python" 'shapely>=1.7.0', "opencv-python"
], ],
classifiers=[ classifiers=[
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册