Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
1e696ac2
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 2 年 前同步成功
通知
118
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看板
提交
1e696ac2
编写于
12月 23, 2021
作者:
G
gaotingquan
提交者:
Tingquan Gao
12月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: remove unnecessary register_hook() call & pre-commit
上级
a86c4b29
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
28 addition
and
18 deletion
+28
-18
ppcls/arch/backbone/legendary_models/esnet.py
ppcls/arch/backbone/legendary_models/esnet.py
+5
-1
ppcls/arch/backbone/legendary_models/hrnet.py
ppcls/arch/backbone/legendary_models/hrnet.py
+7
-4
ppcls/arch/backbone/legendary_models/inception_v3.py
ppcls/arch/backbone/legendary_models/inception_v3.py
+0
-1
ppcls/arch/backbone/legendary_models/mobilenet_v1.py
ppcls/arch/backbone/legendary_models/mobilenet_v1.py
+1
-2
ppcls/arch/backbone/legendary_models/mobilenet_v3.py
ppcls/arch/backbone/legendary_models/mobilenet_v3.py
+0
-1
ppcls/arch/backbone/legendary_models/pp_lcnet.py
ppcls/arch/backbone/legendary_models/pp_lcnet.py
+10
-6
ppcls/arch/backbone/legendary_models/resnet.py
ppcls/arch/backbone/legendary_models/resnet.py
+0
-1
ppcls/arch/backbone/legendary_models/vgg.py
ppcls/arch/backbone/legendary_models/vgg.py
+5
-2
未找到文件。
ppcls/arch/backbone/legendary_models/esnet.py
浏览文件 @
1e696ac2
...
...
@@ -217,7 +217,8 @@ class ESNet(TheseusLayer):
class_num
=
1000
,
scale
=
1.0
,
dropout_prob
=
0.2
,
class_expand
=
1280
):
class_expand
=
1280
,
return_patterns
=
None
):
super
().
__init__
()
self
.
scale
=
scale
self
.
class_num
=
class_num
...
...
@@ -268,6 +269,9 @@ class ESNet(TheseusLayer):
self
.
flatten
=
nn
.
Flatten
(
start_axis
=
1
,
stop_axis
=-
1
)
self
.
fc
=
Linear
(
self
.
class_expand
,
self
.
class_num
)
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
def
forward
(
self
,
x
):
x
=
self
.
conv1
(
x
)
x
=
self
.
max_pool
(
x
)
...
...
ppcls/arch/backbone/legendary_models/hrnet.py
浏览文件 @
1e696ac2
...
...
@@ -244,7 +244,7 @@ class HighResolutionModule(TheseusLayer):
for
i
in
range
(
len
(
num_filters
)):
self
.
basic_block_list
.
append
(
nn
.
Sequential
(
*
[
nn
.
Sequential
(
*
[
BasicBlock
(
num_channels
=
num_filters
[
i
],
num_filters
=
num_filters
[
i
],
...
...
@@ -367,7 +367,11 @@ class HRNet(TheseusLayer):
model: nn.Layer. Specific HRNet model depends on args.
"""
def
__init__
(
self
,
width
=
18
,
has_se
=
False
,
class_num
=
1000
,
return_patterns
=
None
):
def
__init__
(
self
,
width
=
18
,
has_se
=
False
,
class_num
=
1000
,
return_patterns
=
None
):
super
().
__init__
()
self
.
width
=
width
...
...
@@ -394,7 +398,7 @@ class HRNet(TheseusLayer):
stride
=
2
,
act
=
"relu"
)
self
.
layer1
=
nn
.
Sequential
(
*
[
self
.
layer1
=
nn
.
Sequential
(
*
[
BottleneckBlock
(
num_channels
=
64
if
i
==
0
else
256
,
num_filters
=
64
,
...
...
@@ -458,7 +462,6 @@ class HRNet(TheseusLayer):
weight_attr
=
ParamAttr
(
initializer
=
Uniform
(
-
stdv
,
stdv
)))
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
self
.
register_forward_post_hook
(
self
.
_return_dict_hook
)
def
forward
(
self
,
x
):
x
=
self
.
conv_layer1_1
(
x
)
...
...
ppcls/arch/backbone/legendary_models/inception_v3.py
浏览文件 @
1e696ac2
...
...
@@ -498,7 +498,6 @@ class Inception_V3(TheseusLayer):
bias_attr
=
ParamAttr
())
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
self
.
register_forward_post_hook
(
self
.
_return_dict_hook
)
def
forward
(
self
,
x
):
x
=
self
.
inception_stem
(
x
)
...
...
ppcls/arch/backbone/legendary_models/mobilenet_v1.py
浏览文件 @
1e696ac2
...
...
@@ -128,7 +128,7 @@ class MobileNet(TheseusLayer):
[
int
(
512
*
scale
),
512
,
1024
,
512
,
2
],
[
int
(
1024
*
scale
),
1024
,
1024
,
1024
,
1
]]
self
.
blocks
=
nn
.
Sequential
(
*
[
self
.
blocks
=
nn
.
Sequential
(
*
[
DepthwiseSeparable
(
num_channels
=
params
[
0
],
num_filters1
=
params
[
1
],
...
...
@@ -147,7 +147,6 @@ class MobileNet(TheseusLayer):
weight_attr
=
ParamAttr
(
initializer
=
KaimingNormal
()))
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
self
.
register_forward_post_hook
(
self
.
_return_dict_hook
)
def
forward
(
self
,
x
):
x
=
self
.
conv
(
x
)
...
...
ppcls/arch/backbone/legendary_models/mobilenet_v3.py
浏览文件 @
1e696ac2
...
...
@@ -202,7 +202,6 @@ class MobileNetV3(TheseusLayer):
self
.
fc
=
Linear
(
self
.
class_expand
,
class_num
)
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
self
.
register_forward_post_hook
(
self
.
_return_dict_hook
)
def
forward
(
self
,
x
):
x
=
self
.
conv
(
x
)
...
...
ppcls/arch/backbone/legendary_models/pp_lcnet.py
浏览文件 @
1e696ac2
...
...
@@ -171,7 +171,8 @@ class PPLCNet(TheseusLayer):
scale
=
1.0
,
class_num
=
1000
,
dropout_prob
=
0.2
,
class_expand
=
1280
):
class_expand
=
1280
,
return_patterns
=
None
):
super
().
__init__
()
self
.
scale
=
scale
self
.
class_expand
=
class_expand
...
...
@@ -182,7 +183,7 @@ class PPLCNet(TheseusLayer):
num_filters
=
make_divisible
(
16
*
scale
),
stride
=
2
)
self
.
blocks2
=
nn
.
Sequential
(
*
[
self
.
blocks2
=
nn
.
Sequential
(
*
[
DepthwiseSeparable
(
num_channels
=
make_divisible
(
in_c
*
scale
),
num_filters
=
make_divisible
(
out_c
*
scale
),
...
...
@@ -192,7 +193,7 @@ class PPLCNet(TheseusLayer):
for
i
,
(
k
,
in_c
,
out_c
,
s
,
se
)
in
enumerate
(
NET_CONFIG
[
"blocks2"
])
])
self
.
blocks3
=
nn
.
Sequential
(
*
[
self
.
blocks3
=
nn
.
Sequential
(
*
[
DepthwiseSeparable
(
num_channels
=
make_divisible
(
in_c
*
scale
),
num_filters
=
make_divisible
(
out_c
*
scale
),
...
...
@@ -202,7 +203,7 @@ class PPLCNet(TheseusLayer):
for
i
,
(
k
,
in_c
,
out_c
,
s
,
se
)
in
enumerate
(
NET_CONFIG
[
"blocks3"
])
])
self
.
blocks4
=
nn
.
Sequential
(
*
[
self
.
blocks4
=
nn
.
Sequential
(
*
[
DepthwiseSeparable
(
num_channels
=
make_divisible
(
in_c
*
scale
),
num_filters
=
make_divisible
(
out_c
*
scale
),
...
...
@@ -212,7 +213,7 @@ class PPLCNet(TheseusLayer):
for
i
,
(
k
,
in_c
,
out_c
,
s
,
se
)
in
enumerate
(
NET_CONFIG
[
"blocks4"
])
])
self
.
blocks5
=
nn
.
Sequential
(
*
[
self
.
blocks5
=
nn
.
Sequential
(
*
[
DepthwiseSeparable
(
num_channels
=
make_divisible
(
in_c
*
scale
),
num_filters
=
make_divisible
(
out_c
*
scale
),
...
...
@@ -222,7 +223,7 @@ class PPLCNet(TheseusLayer):
for
i
,
(
k
,
in_c
,
out_c
,
s
,
se
)
in
enumerate
(
NET_CONFIG
[
"blocks5"
])
])
self
.
blocks6
=
nn
.
Sequential
(
*
[
self
.
blocks6
=
nn
.
Sequential
(
*
[
DepthwiseSeparable
(
num_channels
=
make_divisible
(
in_c
*
scale
),
num_filters
=
make_divisible
(
out_c
*
scale
),
...
...
@@ -248,6 +249,9 @@ class PPLCNet(TheseusLayer):
self
.
fc
=
Linear
(
self
.
class_expand
,
class_num
)
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
def
forward
(
self
,
x
):
x
=
self
.
conv1
(
x
)
...
...
ppcls/arch/backbone/legendary_models/resnet.py
浏览文件 @
1e696ac2
...
...
@@ -340,7 +340,6 @@ class ResNet(TheseusLayer):
self
.
data_format
=
data_format
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
self
.
register_forward_post_hook
(
self
.
_return_dict_hook
)
def
forward
(
self
,
x
):
with
paddle
.
static
.
amp
.
fp16_guard
():
...
...
ppcls/arch/backbone/legendary_models/vgg.py
浏览文件 @
1e696ac2
...
...
@@ -111,7 +111,11 @@ class VGGNet(TheseusLayer):
model: nn.Layer. Specific VGG model depends on args.
"""
def
__init__
(
self
,
config
,
stop_grad_layers
=
0
,
class_num
=
1000
,
return_patterns
=
None
):
def
__init__
(
self
,
config
,
stop_grad_layers
=
0
,
class_num
=
1000
,
return_patterns
=
None
):
super
().
__init__
()
self
.
stop_grad_layers
=
stop_grad_layers
...
...
@@ -139,7 +143,6 @@ class VGGNet(TheseusLayer):
self
.
fc3
=
Linear
(
4096
,
class_num
)
if
return_patterns
is
not
None
:
self
.
update_res
(
return_patterns
)
self
.
register_forward_post_hook
(
self
.
_return_dict_hook
)
def
forward
(
self
,
inputs
):
x
=
self
.
conv_block_1
(
inputs
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录