提交 5af83f43 编写于 作者: L lyuwenyu

add ResNet18 pretrained

上级 3d9525b4
dependencies = ['paddle', 'numpy'] dependencies = ['paddle', 'numpy']
import paddle
from ppcls.modeling.architectures.resnet import ResNet18 as _ResNet18 from ppcls.modeling.architectures.resnet import ResNet18 as _ResNet18
from ppcls.modeling.architectures.resnet import ResNet34 as _ResNet34 from ppcls.modeling.architectures.resnet import ResNet34 as _ResNet34
from ppcls.modeling.architectures.resnet import ResNet50 as _ResNet50 from ppcls.modeling.architectures.resnet import ResNet50 as _ResNet50
_checkpoints = {
'ResNet18': 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet18_pretrained.pdparams'
}
def ResNet18(**kwargs): def ResNet18(**kwargs):
'''ResNet18 '''ResNet18
''' '''
pretrained = kwargs.pop('pretrained', False)
model = _ResNet18(**kwargs) model = _ResNet18(**kwargs)
if pretrained:
path = paddle.utils.download.get_weights_path_from_url(_checkpoints['ResNet18'])
model.set_state_dict(paddle.load(path))
return model return model
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册