Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
c9a2c16c
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
285
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c9a2c16c
编写于
7月 30, 2020
作者:
C
chenguowei01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update models
上级
9148fa5c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
17 deletion
+9
-17
dygraph/models/hrnet.py
dygraph/models/hrnet.py
+1
-6
dygraph/models/unet.py
dygraph/models/unet.py
+8
-11
未找到文件。
dygraph/models/hrnet.py
浏览文件 @
c9a2c16c
...
...
@@ -20,12 +20,7 @@ from paddle.fluid.param_attr import ParamAttr
from
paddle.fluid.layer_helper
import
LayerHelper
from
paddle.fluid.dygraph.nn
import
Conv2D
,
Pool2D
,
Linear
from
paddle.fluid.initializer
import
Normal
try
:
from
paddle.fluid.dygraph
import
SyncBatchNorm
as
BatchNorm
print
(
'using sync batch norm'
)
except
:
from
paddle.fluid.dygraph
import
BatchNorm
print
(
'using batch norm'
)
from
paddle.fluid.dygraph
import
SyncBatchNorm
as
BatchNorm
__all__
=
[
"HRNet_W18_Small_V1"
,
"HRNet_W18_Small_V2"
,
"HRNet_W18"
,
"HRNet_W30"
,
...
...
dygraph/models/unet.py
浏览文件 @
c9a2c16c
...
...
@@ -14,15 +14,12 @@
import
paddle.fluid
as
fluid
from
paddle.fluid.dygraph
import
Conv2D
,
Pool2D
try
:
from
paddle.fluid.dygraph
import
SyncBatchNorm
as
BatchNorm
except
:
from
paddle.fluid.dygraph
import
BatchNorm
from
paddle.fluid.dygraph
import
SyncBatchNorm
as
BatchNorm
class
UNet
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
,
num_classes
,
ignore_index
=
255
):
super
().
__init__
()
super
(
UNet
,
self
).
__init__
()
self
.
encode
=
UnetEncoder
()
self
.
decode
=
UnetDecode
()
self
.
get_logit
=
GetLogit
(
64
,
num_classes
)
...
...
@@ -65,7 +62,7 @@ class UNet(fluid.dygraph.Layer):
class
UnetEncoder
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
):
super
().
__init__
()
super
(
UnetEncoder
,
self
).
__init__
()
self
.
double_conv
=
DoubleConv
(
3
,
64
)
self
.
down1
=
Down
(
64
,
128
)
self
.
down2
=
Down
(
128
,
256
)
...
...
@@ -88,7 +85,7 @@ class UnetEncoder(fluid.dygraph.Layer):
class
UnetDecode
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
):
super
().
__init__
()
super
(
UnetDecode
,
self
).
__init__
()
self
.
up1
=
Up
(
512
,
256
)
self
.
up2
=
Up
(
256
,
128
)
self
.
up3
=
Up
(
128
,
64
)
...
...
@@ -104,7 +101,7 @@ class UnetDecode(fluid.dygraph.Layer):
class
DoubleConv
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
,
num_channels
,
num_filters
):
super
().
__init__
()
super
(
DoubleConv
,
self
).
__init__
()
self
.
conv0
=
Conv2D
(
num_channels
=
num_channels
,
num_filters
=
num_filters
,
...
...
@@ -132,7 +129,7 @@ class DoubleConv(fluid.dygraph.Layer):
class
Down
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
,
num_channels
,
num_filters
):
super
().
__init__
()
super
(
Down
,
self
).
__init__
()
self
.
max_pool
=
Pool2D
(
pool_size
=
2
,
pool_type
=
'max'
,
pool_stride
=
2
,
pool_padding
=
0
)
self
.
double_conv
=
DoubleConv
(
num_channels
,
num_filters
)
...
...
@@ -145,7 +142,7 @@ class Down(fluid.dygraph.Layer):
class
Up
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
,
num_channels
,
num_filters
):
super
().
__init__
()
super
(
Up
,
self
).
__init__
()
self
.
double_conv
=
DoubleConv
(
2
*
num_channels
,
num_filters
)
def
forward
(
self
,
x
,
short_cut
):
...
...
@@ -158,7 +155,7 @@ class Up(fluid.dygraph.Layer):
class
GetLogit
(
fluid
.
dygraph
.
Layer
):
def
__init__
(
self
,
num_channels
,
num_classes
):
super
().
__init__
()
super
(
GetLogit
,
self
).
__init__
()
self
.
conv
=
Conv2D
(
num_channels
=
num_channels
,
num_filters
=
num_classes
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录