Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
4338730e
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看板
提交
4338730e
编写于
6月 29, 2020
作者:
littletomatodonkey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ls training for dygraph
上级
6a0dce8a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
128 addition
and
63 deletion
+128
-63
ppcls/modeling/architectures/__init__.py
ppcls/modeling/architectures/__init__.py
+2
-0
ppcls/modeling/architectures/densenet.py
ppcls/modeling/architectures/densenet.py
+28
-10
ppcls/modeling/architectures/dpn.py
ppcls/modeling/architectures/dpn.py
+29
-11
ppcls/modeling/architectures/hrnet.py
ppcls/modeling/architectures/hrnet.py
+50
-32
tools/program.py
tools/program.py
+19
-10
未找到文件。
ppcls/modeling/architectures/__init__.py
浏览文件 @
4338730e
...
...
@@ -14,3 +14,5 @@
from
.resnet_name
import
*
from
.dpn
import
DPN68
from
.densenet
import
DenseNet121
from
.hrnet
import
HRNet_W18_C
\ No newline at end of file
ppcls/modeling/architectures/densenet.py
浏览文件 @
4338730e
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -268,26 +286,26 @@ class DenseNet(fluid.dygraph.Layer):
return
y
def
DenseNet121
():
model
=
DenseNet
(
layers
=
121
)
def
DenseNet121
(
**
args
):
model
=
DenseNet
(
layers
=
121
,
**
args
)
return
model
def
DenseNet161
():
model
=
DenseNet
(
layers
=
161
)
def
DenseNet161
(
**
args
):
model
=
DenseNet
(
layers
=
161
,
**
args
)
return
model
def
DenseNet169
():
model
=
DenseNet
(
layers
=
169
)
def
DenseNet169
(
**
args
):
model
=
DenseNet
(
layers
=
169
,
**
args
)
return
model
def
DenseNet201
():
model
=
DenseNet
(
layers
=
201
)
def
DenseNet201
(
**
args
):
model
=
DenseNet
(
layers
=
201
,
**
args
)
return
model
def
DenseNet264
():
model
=
DenseNet
(
layers
=
264
)
def
DenseNet264
(
**
args
):
model
=
DenseNet
(
layers
=
264
,
**
args
)
return
model
ppcls/modeling/architectures/dpn.py
浏览文件 @
4338730e
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
numpy
as
np
import
sys
import
paddle
...
...
@@ -386,26 +404,26 @@ class DPN(fluid.dygraph.Layer):
return
net_arg
def
DPN68
():
model
=
DPN
(
layers
=
68
)
def
DPN68
(
**
args
):
model
=
DPN
(
layers
=
68
,
**
args
)
return
model
def
DPN92
():
model
=
DPN
(
layers
=
92
)
def
DPN92
(
**
args
):
model
=
DPN
(
layers
=
92
,
**
args
)
return
model
def
DPN98
():
model
=
DPN
(
layers
=
98
)
def
DPN98
(
**
args
):
model
=
DPN
(
layers
=
98
,
**
args
)
return
model
def
DPN107
():
model
=
DPN
(
layers
=
107
)
def
DPN107
(
**
args
):
model
=
DPN
(
layers
=
107
,
**
args
)
return
model
def
DPN131
():
model
=
DPN
(
layers
=
131
)
def
DPN131
(
**
args
):
model
=
DPN
(
layers
=
131
,
**
args
)
return
model
ppcls/modeling/architectures/hrnet.py
浏览文件 @
4338730e
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
numpy
as
np
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -647,81 +665,81 @@ class HRNet(fluid.dygraph.Layer):
return
y
def
HRNet_W18_C
():
model
=
HRNet
(
width
=
18
)
def
HRNet_W18_C
(
**
args
):
model
=
HRNet
(
width
=
18
,
**
args
)
return
model
def
HRNet_W30_C
():
model
=
HRNet
(
width
=
30
)
def
HRNet_W30_C
(
**
args
):
model
=
HRNet
(
width
=
30
,
**
args
)
return
model
def
HRNet_W32_C
():
model
=
HRNet
(
width
=
32
)
def
HRNet_W32_C
(
**
args
):
model
=
HRNet
(
width
=
32
,
**
args
)
return
model
def
HRNet_W40_C
():
model
=
HRNet
(
width
=
40
)
def
HRNet_W40_C
(
**
args
):
model
=
HRNet
(
width
=
40
,
**
args
)
return
model
def
HRNet_W44_C
():
model
=
HRNet
(
width
=
44
)
def
HRNet_W44_C
(
**
args
):
model
=
HRNet
(
width
=
44
,
**
args
)
return
model
def
HRNet_W48_C
():
model
=
HRNet
(
width
=
48
)
def
HRNet_W48_C
(
**
args
):
model
=
HRNet
(
width
=
48
,
**
args
)
return
model
def
HRNet_W60_C
():
model
=
HRNet
(
width
=
60
)
def
HRNet_W60_C
(
**
args
):
model
=
HRNet
(
width
=
60
,
**
args
)
return
model
def
HRNet_W64_C
():
model
=
HRNet
(
width
=
64
)
def
HRNet_W64_C
(
**
args
):
model
=
HRNet
(
width
=
64
,
**
args
)
return
model
def
SE_HRNet_W18_C
():
model
=
HRNet
(
width
=
18
,
has_se
=
True
)
def
SE_HRNet_W18_C
(
**
args
):
model
=
HRNet
(
width
=
18
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W30_C
():
model
=
HRNet
(
width
=
30
,
has_se
=
True
)
def
SE_HRNet_W30_C
(
**
args
):
model
=
HRNet
(
width
=
30
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W32_C
():
model
=
HRNet
(
width
=
32
,
has_se
=
True
)
def
SE_HRNet_W32_C
(
**
args
):
model
=
HRNet
(
width
=
32
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W40_C
():
model
=
HRNet
(
width
=
40
,
has_se
=
True
)
def
SE_HRNet_W40_C
(
**
args
):
model
=
HRNet
(
width
=
40
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W44_C
():
model
=
HRNet
(
width
=
44
,
has_se
=
True
)
def
SE_HRNet_W44_C
(
**
args
):
model
=
HRNet
(
width
=
44
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W48_C
():
model
=
HRNet
(
width
=
48
,
has_se
=
True
)
def
SE_HRNet_W48_C
(
**
args
):
model
=
HRNet
(
width
=
48
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W60_C
():
model
=
HRNet
(
width
=
60
,
has_se
=
True
)
def
SE_HRNet_W60_C
(
**
args
):
model
=
HRNet
(
width
=
60
,
has_se
=
True
,
**
args
)
return
model
def
SE_HRNet_W64_C
():
model
=
HRNet
(
width
=
64
,
has_se
=
True
)
def
SE_HRNet_W64_C
(
**
args
):
model
=
HRNet
(
width
=
64
,
has_se
=
True
,
**
args
)
return
model
tools/program.py
浏览文件 @
4338730e
...
...
@@ -338,6 +338,15 @@ def run(dataloader, config, net, optimizer=None, epoch=0, mode='train'):
Returns:
"""
use_mix
=
config
.
get
(
"use_mix"
,
False
)
and
mode
==
"train"
if
use_mix
:
metric_list
=
OrderedDict
([
(
"loss"
,
AverageMeter
(
'loss'
,
'7.4f'
)),
(
"lr"
,
AverageMeter
(
'lr'
,
'f'
,
need_avg
=
False
)),
(
"batch_time"
,
AverageMeter
(
'elapse'
,
'.3f'
)),
])
else
:
topk_name
=
'top{}'
.
format
(
config
.
topk
)
metric_list
=
OrderedDict
([
(
"loss"
,
AverageMeter
(
'loss'
,
'7.4f'
)),
...
...
@@ -351,7 +360,7 @@ def run(dataloader, config, net, optimizer=None, epoch=0, mode='train'):
tic
=
time
.
time
()
for
idx
,
batch
in
enumerate
(
dataloader
()):
bs
=
len
(
batch
[
0
])
feeds
=
create_feeds
(
batch
,
config
.
get
(
"use_mix"
,
False
)
)
feeds
=
create_feeds
(
batch
,
use_mix
)
fetchs
=
compute
(
feeds
,
net
,
config
,
mode
)
if
mode
==
'train'
:
avg_loss
=
net
.
scale_loss
(
fetchs
[
'loss'
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录