|
@@ -243,7 +243,7 @@ class BaseClassifier(BaseModel):
|
|
|
"If don't want to use pretrain weights, "
|
|
"If don't want to use pretrain weights, "
|
|
|
"set pretrain_weights to be None.")
|
|
"set pretrain_weights to be None.")
|
|
|
pretrain_weights = 'IMAGENET'
|
|
pretrain_weights = 'IMAGENET'
|
|
|
- elif osp.exists(pretrain_weights):
|
|
|
|
|
|
|
+ elif pretrain_weights is not None and osp.exists(pretrain_weights):
|
|
|
if osp.splitext(pretrain_weights)[-1] != '.pdparams':
|
|
if osp.splitext(pretrain_weights)[-1] != '.pdparams':
|
|
|
logging.error(
|
|
logging.error(
|
|
|
"Invalid pretrain weights. Please specify a '.pdparams' file.",
|
|
"Invalid pretrain weights. Please specify a '.pdparams' file.",
|
|
@@ -538,10 +538,13 @@ class AlexNet(BaseClassifier):
|
|
|
image_shape = [None, 3] + image_shape
|
|
image_shape = [None, 3] + image_shape
|
|
|
else:
|
|
else:
|
|
|
image_shape = [None, 3, 224, 224]
|
|
image_shape = [None, 3, 224, 224]
|
|
|
- logging.info('When exporting inference model for {},'.format(
|
|
|
|
|
- self.__class__.__name__
|
|
|
|
|
- ) + ' if fixed_input_shape is not set, it will be forcibly set to [None, 3, 224, 224]'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ logging.warning(
|
|
|
|
|
+ '[Important!!!] When exporting inference model for {},'.format(
|
|
|
|
|
+ self.__class__.__name__) +
|
|
|
|
|
+ ' if fixed_input_shape is not set, it will be forcibly set to [None, 3, 224, 224]'
|
|
|
|
|
+ +
|
|
|
|
|
+ 'Please check image shape after transforms is [3, 224, 224], if not, fixed_input_shape '
|
|
|
|
|
+ + 'should be specified manually.')
|
|
|
self._fix_transforms_shape(image_shape[-2:])
|
|
self._fix_transforms_shape(image_shape[-2:])
|
|
|
|
|
|
|
|
input_spec = [
|
|
input_spec = [
|
|
@@ -743,10 +746,13 @@ class ShuffleNetV2(BaseClassifier):
|
|
|
image_shape = [None, 3] + image_shape
|
|
image_shape = [None, 3] + image_shape
|
|
|
else:
|
|
else:
|
|
|
image_shape = [None, 3, 224, 224]
|
|
image_shape = [None, 3, 224, 224]
|
|
|
- logging.info('When exporting inference model for {},'.format(
|
|
|
|
|
- self.__class__.__name__
|
|
|
|
|
- ) + ' if fixed_input_shape is not set, it will be forcibly set to [None, 3, 224, 224]'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ logging.warning(
|
|
|
|
|
+ '[Important!!!] When exporting inference model for {},'.format(
|
|
|
|
|
+ self.__class__.__name__) +
|
|
|
|
|
+ ' if fixed_input_shape is not set, it will be forcibly set to [None, 3, 224, 224]'
|
|
|
|
|
+ +
|
|
|
|
|
+ 'Please check image shape after transforms is [3, 224, 224], if not, fixed_input_shape '
|
|
|
|
|
+ + 'should be specified manually.')
|
|
|
self._fix_transforms_shape(image_shape[-2:])
|
|
self._fix_transforms_shape(image_shape[-2:])
|
|
|
input_spec = [
|
|
input_spec = [
|
|
|
InputSpec(
|
|
InputSpec(
|
|
@@ -766,10 +772,13 @@ class ShuffleNetV2_swish(BaseClassifier):
|
|
|
image_shape = [None, 3] + image_shape
|
|
image_shape = [None, 3] + image_shape
|
|
|
else:
|
|
else:
|
|
|
image_shape = [None, 3, 224, 224]
|
|
image_shape = [None, 3, 224, 224]
|
|
|
- logging.info('When exporting inference model for {},'.format(
|
|
|
|
|
- self.__class__.__name__
|
|
|
|
|
- ) + ' if fixed_input_shape is not set, it will be forcibly set to [None, 3, 224, 224]'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ logging.warning(
|
|
|
|
|
+ '[Important!!!] When exporting inference model for {},'.format(
|
|
|
|
|
+ self.__class__.__name__) +
|
|
|
|
|
+ ' if fixed_input_shape is not set, it will be forcibly set to [None, 3, 224, 224]'
|
|
|
|
|
+ +
|
|
|
|
|
+ 'Please check image shape after transforms is [3, 224, 224], if not, fixed_input_shape '
|
|
|
|
|
+ + 'should be specified manually.')
|
|
|
self._fix_transforms_shape(image_shape[-2:])
|
|
self._fix_transforms_shape(image_shape[-2:])
|
|
|
input_spec = [
|
|
input_spec = [
|
|
|
InputSpec(
|
|
InputSpec(
|