"Pretrain_weights for classifier should be defined as directory path or parameter file or 'IMAGENET' or None, but it is {}, so we force to set it as 'IMAGENET'".
"Path of pretrain_weights('{}') is not exists!".
format(pretrain_weights))
logging.warning(
"Pretrain_weights will be forced to set as 'IMAGENET', if you don't want to use pretrain weights, set pretrain_weights=None."
)
pretrain_weights='IMAGENET'
elifself.model_type=='detector':
ifpretrain_weightsnotin['IMAGENET','COCO']:
logging.warning(
"Pretrain_weights for detector should be defined as directory path or parameter file or 'IMAGENET' or 'COCO' or None, but it is {}, so we force to set it as 'IMAGENET'".
"Path of pretrain_weights('{}') is not exists!".
format(pretrain_weights))
logging.warning(
"Pretrain_weights will be forced to set as 'IMAGENET', if you don't want to use pretrain weights, set pretrain_weights=None."
)
pretrain_weights='IMAGENET'
elifself.model_type=='segmenter':
ifpretrain_weightsnotin[
'IMAGENET','COCO','CITYSCAPES'
]:
logging.warning(
"Pretrain_weights for segmenter should be defined as directory path or parameter file or 'IMAGENET' or 'COCO' or 'CITYSCAPES', but it is {}, so we force to set it as 'IMAGENET'".
"Path of pretrain_weights('{}') is not exists!".
format(pretrain_weights))
logging.warning(
"Pretrain_weights will be forced to set as 'IMAGENET', if you don't want to use pretrain weights, set pretrain_weights=None."
)
pretrain_weights='IMAGENET'
ifhasattr(self,'backbone'):
backbone=self.backbone
...
...
@@ -237,8 +246,8 @@ class BaseAPI:
logging.info(
"Load pretrain weights from {}.".format(pretrain_weights),
"Connecting PaddleHub server to get pretrain weights...")
hub.download(backbone,save_path=new_save_dir)
exceptExceptionase:
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".
format(image_pretrain[backbone]),
exit=False)
ifisinstance(e,hub.ResourceNotFoundError):
raiseException("Resource for backbone {} not found".format(
"Connecting PaddleHub server to get pretrain weights...")
hub.download(backbone,save_path=new_save_dir)
exceptExceptionase:
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".
format(url),
exit=False)
ifisinstance(hub.ResourceNotFoundError):
raiseException("Resource for backbone {} not found".format(