Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
7ccd4896
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
1 年多 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7ccd4896
编写于
3月 25, 2021
作者:
L
lyuwenyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add alexnet vgg resnet series
上级
f1b0e8cc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
116 addition
and
3 deletion
+116
-3
hubconf.py
hubconf.py
+116
-3
未找到文件。
hubconf.py
浏览文件 @
7ccd4896
...
...
@@ -3,9 +3,9 @@ dependencies = ['paddle', 'numpy']
import
paddle
from
ppcls.modeling.architectures
import
alexnet
as
_alexnet
from
ppcls.modeling.architectures
import
vgg
as
_vgg
from
ppcls.modeling.architectures
import
resnet
as
_resnet
# _checkpoints = {
# 'ResNet18': 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet18_pretrained.pdparams',
# 'ResNet34': 'https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet34_pretrained.pdparams',
...
...
@@ -37,6 +37,80 @@ def _load_pretrained_urls():
_checkpoints
=
_load_pretrained_urls
()
def
AlexNet
(
**
kwargs
):
'''AlexNet
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_alexnet
.
AlexNet
(
**
kwargs
)
if
pretrained
:
assert
'AlexNet'
in
_checkpoints
,
'Not provide `AlexNet` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'AlexNet'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
VGG11
(
**
kwargs
):
'''VGG11
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_vgg
.
VGG11
(
**
kwargs
)
if
pretrained
:
assert
'VGG11'
in
_checkpoints
,
'Not provide `VGG11` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'VGG11'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
VGG13
(
**
kwargs
):
'''VGG13
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_vgg
.
VGG13
(
**
kwargs
)
if
pretrained
:
assert
'VGG13'
in
_checkpoints
,
'Not provide `VGG13` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'VGG13'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
VGG16
(
**
kwargs
):
'''VGG16
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_vgg
.
VGG16
(
**
kwargs
)
if
pretrained
:
assert
'VGG16'
in
_checkpoints
,
'Not provide `VGG16` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'VGG16'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
VGG19
(
**
kwargs
):
'''VGG19
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_vgg
.
VGG19
(
**
kwargs
)
if
pretrained
:
assert
'VGG19'
in
_checkpoints
,
'Not provide `VGG19` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'VGG19'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
ResNet18
(
**
kwargs
):
'''ResNet18
'''
...
...
@@ -51,7 +125,6 @@ def ResNet18(**kwargs):
return
model
def
ResNet34
(
**
kwargs
):
'''ResNet34
'''
...
...
@@ -66,3 +139,43 @@ def ResNet34(**kwargs):
return
model
def
ResNet50
(
**
kwargs
):
'''ResNet50
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_resnet
.
ResNet50
(
**
kwargs
)
if
pretrained
:
assert
'ResNet50'
in
_checkpoints
,
'Not provide `ResNet50` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'ResNet50'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
ResNet101
(
**
kwargs
):
'''ResNet101
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_resnet
.
ResNet101
(
**
kwargs
)
if
pretrained
:
assert
'ResNet101'
in
_checkpoints
,
'Not provide `ResNet101` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'ResNet101'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
def
ResNet152
(
**
kwargs
):
'''ResNet152
'''
pretrained
=
kwargs
.
pop
(
'pretrained'
,
False
)
model
=
_resnet
.
ResNet152
(
**
kwargs
)
if
pretrained
:
assert
'ResNet152'
in
_checkpoints
,
'Not provide `ResNet152` pretrained model.'
path
=
paddle
.
utils
.
download
.
get_weights_path_from_url
(
_checkpoints
[
'ResNet152'
])
model
.
set_state_dict
(
paddle
.
load
(
path
))
return
model
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录