Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
d0ec9c38
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d0ec9c38
编写于
6月 07, 2022
作者:
W
wjj19950828
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed for ci
上级
8069fff5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
14 deletion
+11
-14
x2paddle/op_mapper/onnx2paddle/onnx_custom_layer/roi_align.py
...ddle/op_mapper/onnx2paddle/onnx_custom_layer/roi_align.py
+6
-11
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
+5
-3
未找到文件。
x2paddle/op_mapper/onnx2paddle/onnx_custom_layer/roi_align.py
浏览文件 @
d0ec9c38
...
@@ -21,18 +21,13 @@ from paddle.common_ops_import import Variable, LayerHelper, check_variable_and_d
...
@@ -21,18 +21,13 @@ from paddle.common_ops_import import Variable, LayerHelper, check_variable_and_d
@
paddle
.
jit
.
not_to_static
@
paddle
.
jit
.
not_to_static
def
roi_align
(
input
,
def
roi_align
(
input
,
rois
,
rois
,
output_size
,
pooled_height
,
pooled_width
,
spatial_scale
=
1.0
,
spatial_scale
=
1.0
,
sampling_ratio
=-
1
,
sampling_ratio
=-
1
,
rois_num
=
None
,
rois_num
=
None
,
aligned
=
True
,
aligned
=
True
,
name
=
None
):
name
=
None
):
check_type
(
output_size
,
'output_size'
,
(
int
,
tuple
),
'roi_align'
)
if
isinstance
(
output_size
,
int
):
output_size
=
(
output_size
,
output_size
)
pooled_height
,
pooled_width
=
output_size
if
in_dynamic_mode
():
if
in_dynamic_mode
():
assert
rois_num
is
not
None
,
"rois_num should not be None in dygraph mode."
assert
rois_num
is
not
None
,
"rois_num should not be None in dygraph mode."
align_out
=
_C_ops
.
roi_align
(
align_out
=
_C_ops
.
roi_align
(
...
@@ -71,15 +66,15 @@ def roi_align(input,
...
@@ -71,15 +66,15 @@ def roi_align(input,
class
ROIAlign
(
object
):
class
ROIAlign
(
object
):
def
__init__
(
self
,
pooled_height
,
pooled_width
,
spatial_scale
,
def
__init__
(
self
,
pooled_height
,
pooled_width
,
spatial_scale
,
sampling_ratio
,
rois_num
):
sampling_ratio
):
self
.
roialign_layer_attrs
=
{
self
.
roialign_layer_attrs
=
{
"pooled_height"
:
pooled_height
,
"pooled_height"
:
pooled_height
,
"pooled_width"
:
pooled_width
,
"pooled_width"
:
pooled_width
,
"spatial_scale"
:
spatial_scale
,
"spatial_scale"
:
spatial_scale
,
'sampling_ratio'
:
sampling_ratio
,
'sampling_ratio'
:
sampling_ratio
,
'rois_num'
:
rois_num
,
}
}
def
__call__
(
self
,
x0
,
x1
):
def
__call__
(
self
,
x0
,
x1
,
x2
):
out
=
roi_align
(
input
=
x0
,
rois
=
x1
,
**
self
.
roialign_layer_attrs
)
out
=
roi_align
(
input
=
x0
,
rois
=
x1
,
rois_num
=
x2
,
**
self
.
roialign_layer_attrs
)
return
out
return
out
x2paddle/op_mapper/onnx2paddle/opset9/opset.py
浏览文件 @
d0ec9c38
...
@@ -538,12 +538,14 @@ class OpSet9():
...
@@ -538,12 +538,14 @@ class OpSet9():
'pooled_width'
:
pooled_width
,
'pooled_width'
:
pooled_width
,
'spatial_scale'
:
spatial_scale
,
'spatial_scale'
:
spatial_scale
,
'sampling_ratio'
:
sampling_ratio
,
'sampling_ratio'
:
sampling_ratio
,
'rois_num'
:
val_rois_num
,
}
}
self
.
paddle_graph
.
add_layer
(
self
.
paddle_graph
.
add_layer
(
'custom_layer:ROIAlign'
,
'custom_layer:ROIAlign'
,
inputs
=
{
'input'
:
val_x
.
name
,
inputs
=
{
'rois'
:
val_rois
.
name
},
'input'
:
val_x
.
name
,
'rois'
:
val_rois
.
name
,
'rois_num'
:
val_rois_num
},
outputs
=
[
node
.
name
],
outputs
=
[
node
.
name
],
**
layer_attrs
)
**
layer_attrs
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录