Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
8ce83816
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8ce83816
编写于
2月 17, 2020
作者:
Y
Yang Zhang
提交者:
GitHub
2月 17, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove leftover `Switch` ops (#240)
* Replace `switch` ops with `cond` * Use func instead of lambda
上级
582d3c25
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
40 addition
and
36 deletion
+40
-36
ppdet/modeling/architectures/cascade_mask_rcnn.py
ppdet/modeling/architectures/cascade_mask_rcnn.py
+20
-18
ppdet/modeling/architectures/mask_rcnn.py
ppdet/modeling/architectures/mask_rcnn.py
+20
-18
未找到文件。
ppdet/modeling/architectures/cascade_mask_rcnn.py
浏览文件 @
8ce83816
...
@@ -321,14 +321,14 @@ class CascadeMaskRCNN(object):
...
@@ -321,14 +321,14 @@ class CascadeMaskRCNN(object):
dtype
=
'float32'
,
dtype
=
'float32'
,
persistable
=
False
,
persistable
=
False
,
name
=
mask_name
)
name
=
mask_name
)
with
fluid
.
layers
.
control_flow
.
Switch
()
as
switch
:
with
switch
.
case
(
cond
):
def
noop
(
):
fluid
.
layers
.
assign
(
input
=
bbox_pred
,
output
=
mask_pred
)
fluid
.
layers
.
assign
(
input
=
bbox_pred
,
output
=
mask_pred
)
with
switch
.
default
():
def
process_boxes
():
bbox
=
fluid
.
layers
.
slice
(
bbox_pred
,
[
1
],
starts
=
[
2
],
ends
=
[
6
])
bbox
=
fluid
.
layers
.
slice
(
bbox_pred
,
[
1
],
starts
=
[
2
],
ends
=
[
6
])
im_scale
=
fluid
.
layers
.
slice
(
im_scale
=
fluid
.
layers
.
slice
(
im_info
,
[
1
],
starts
=
[
2
],
ends
=
[
3
])
im_info
,
[
1
],
starts
=
[
2
],
ends
=
[
3
])
im_scale
=
fluid
.
layers
.
sequence_expand
(
im_scale
,
bbox
)
im_scale
=
fluid
.
layers
.
sequence_expand
(
im_scale
,
bbox
)
mask_rois
=
bbox
*
im_scale
mask_rois
=
bbox
*
im_scale
...
@@ -341,6 +341,8 @@ class CascadeMaskRCNN(object):
...
@@ -341,6 +341,8 @@ class CascadeMaskRCNN(object):
mask_out
=
self
.
mask_head
.
get_prediction
(
mask_feat
,
bbox
)
mask_out
=
self
.
mask_head
.
get_prediction
(
mask_feat
,
bbox
)
fluid
.
layers
.
assign
(
input
=
mask_out
,
output
=
mask_pred
)
fluid
.
layers
.
assign
(
input
=
mask_out
,
output
=
mask_pred
)
fluid
.
layers
.
cond
(
cond
,
noop
,
process_boxes
)
return
mask_pred
,
bbox_pred
return
mask_pred
,
bbox_pred
def
_input_check
(
self
,
require_fields
,
feed_vars
):
def
_input_check
(
self
,
require_fields
,
feed_vars
):
...
...
ppdet/modeling/architectures/mask_rcnn.py
浏览文件 @
8ce83816
...
@@ -240,14 +240,14 @@ class MaskRCNN(object):
...
@@ -240,14 +240,14 @@ class MaskRCNN(object):
dtype
=
'float32'
,
dtype
=
'float32'
,
persistable
=
False
,
persistable
=
False
,
name
=
mask_name
)
name
=
mask_name
)
with
fluid
.
layers
.
control_flow
.
Switch
()
as
switch
:
with
switch
.
case
(
cond
):
def
noop
(
):
fluid
.
layers
.
assign
(
input
=
bbox_pred
,
output
=
mask_pred
)
fluid
.
layers
.
assign
(
input
=
bbox_pred
,
output
=
mask_pred
)
with
switch
.
default
():
def
process_boxes
():
bbox
=
fluid
.
layers
.
slice
(
bbox_pred
,
[
1
],
starts
=
[
2
],
ends
=
[
6
])
bbox
=
fluid
.
layers
.
slice
(
bbox_pred
,
[
1
],
starts
=
[
2
],
ends
=
[
6
])
im_scale
=
fluid
.
layers
.
slice
(
im_scale
=
fluid
.
layers
.
slice
(
im_info
,
[
1
],
starts
=
[
2
],
ends
=
[
3
])
im_info
,
[
1
],
starts
=
[
2
],
ends
=
[
3
])
im_scale
=
fluid
.
layers
.
sequence_expand
(
im_scale
,
bbox
)
im_scale
=
fluid
.
layers
.
sequence_expand
(
im_scale
,
bbox
)
mask_rois
=
bbox
*
im_scale
mask_rois
=
bbox
*
im_scale
...
@@ -261,6 +261,8 @@ class MaskRCNN(object):
...
@@ -261,6 +261,8 @@ class MaskRCNN(object):
mask_out
=
self
.
mask_head
.
get_prediction
(
mask_feat
,
bbox
)
mask_out
=
self
.
mask_head
.
get_prediction
(
mask_feat
,
bbox
)
fluid
.
layers
.
assign
(
input
=
mask_out
,
output
=
mask_pred
)
fluid
.
layers
.
assign
(
input
=
mask_out
,
output
=
mask_pred
)
fluid
.
layers
.
cond
(
cond
,
noop
,
process_boxes
)
return
mask_pred
,
bbox_pred
return
mask_pred
,
bbox_pred
def
_input_check
(
self
,
require_fields
,
feed_vars
):
def
_input_check
(
self
,
require_fields
,
feed_vars
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录