Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
29c12a62
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
29c12a62
编写于
3月 05, 2019
作者:
Z
zhengya01
提交者:
GitHub
3月 05, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request
#18
from PaddlePaddle/develop
Adapt icnet to custom input shape. (#1711)
上级
b1dcb209
cfae7c3e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
4 deletion
+14
-4
fluid/PaddleCV/icnet/cityscape.py
fluid/PaddleCV/icnet/cityscape.py
+12
-2
fluid/PaddleCV/icnet/icnet.py
fluid/PaddleCV/icnet/icnet.py
+2
-2
未找到文件。
fluid/PaddleCV/icnet/cityscape.py
浏览文件 @
29c12a62
...
@@ -155,6 +155,17 @@ class DataGenerater:
...
@@ -155,6 +155,17 @@ class DataGenerater:
else
:
else
:
return
np
.
pad
(
image
,
((
0
,
pad_h
),
(
0
,
pad_w
)),
'constant'
)
return
np
.
pad
(
image
,
((
0
,
pad_h
),
(
0
,
pad_w
)),
'constant'
)
def
random_crop
(
self
,
im
,
out_shape
,
is_color
=
True
):
h
,
w
=
im
.
shape
[:
2
]
h_start
=
np
.
random
.
randint
(
0
,
h
-
out_shape
[
0
]
+
1
)
w_start
=
np
.
random
.
randint
(
0
,
w
-
out_shape
[
1
]
+
1
)
h_end
,
w_end
=
h_start
+
out_shape
[
0
],
w_start
+
out_shape
[
1
]
if
is_color
:
im
=
im
[
h_start
:
h_end
,
w_start
:
w_end
,
:]
else
:
im
=
im
[
h_start
:
h_end
,
w_start
:
w_end
]
return
im
def
resize
(
self
,
image
,
label
,
out_size
):
def
resize
(
self
,
image
,
label
,
out_size
):
"""
"""
Resize image and label by padding or cropping.
Resize image and label by padding or cropping.
...
@@ -166,8 +177,7 @@ class DataGenerater:
...
@@ -166,8 +177,7 @@ class DataGenerater:
combined
=
np
.
concatenate
((
image
,
label
),
axis
=
2
)
combined
=
np
.
concatenate
((
image
,
label
),
axis
=
2
)
combined
=
self
.
padding_as
(
combined
=
self
.
padding_as
(
combined
,
out_size
[
0
],
out_size
[
1
],
is_color
=
True
)
combined
,
out_size
[
0
],
out_size
[
1
],
is_color
=
True
)
combined
=
dataset
.
image
.
random_crop
(
combined
=
self
.
random_crop
(
combined
,
out_size
,
is_color
=
True
)
combined
,
out_size
[
0
],
is_color
=
True
)
image
=
combined
[:,
:,
0
:
3
]
image
=
combined
[:,
:,
0
:
3
]
label
=
combined
[:,
:,
3
:
4
]
+
ignore_label
label
=
combined
[:,
:,
3
:
4
]
+
ignore_label
return
image
,
label
return
image
,
label
...
...
fluid/PaddleCV/icnet/icnet.py
浏览文件 @
29c12a62
...
@@ -235,12 +235,12 @@ def proj_block(input, filter_num, padding=0, dilation=None, stride=1,
...
@@ -235,12 +235,12 @@ def proj_block(input, filter_num, padding=0, dilation=None, stride=1,
def
sub_net_4
(
input
,
input_shape
):
def
sub_net_4
(
input
,
input_shape
):
tmp
=
interp
(
input
,
out_shape
=
np
.
ceil
(
input_shape
//
32
))
tmp
=
interp
(
input
,
out_shape
=
(
input_shape
//
32
))
tmp
=
dilation_convs
(
tmp
)
tmp
=
dilation_convs
(
tmp
)
tmp
=
pyramis_pooling
(
tmp
,
input_shape
)
tmp
=
pyramis_pooling
(
tmp
,
input_shape
)
tmp
=
conv
(
tmp
,
1
,
1
,
256
,
1
,
1
,
name
=
"conv5_4_k1"
)
tmp
=
conv
(
tmp
,
1
,
1
,
256
,
1
,
1
,
name
=
"conv5_4_k1"
)
tmp
=
bn
(
tmp
,
relu
=
True
)
tmp
=
bn
(
tmp
,
relu
=
True
)
tmp
=
interp
(
tmp
,
input_shape
//
16
)
tmp
=
interp
(
tmp
,
out_shape
=
np
.
ceil
(
input_shape
/
16
)
)
return
tmp
return
tmp
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录