Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
cd327e66
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
cd327e66
编写于
5月 12, 2020
作者:
W
wangguanzhong
提交者:
GitHub
5月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize error message, test=develop (#24420)
上级
7fedf26b
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
62 addition
and
36 deletion
+62
-36
paddle/fluid/operators/detection/box_clip_op.cc
paddle/fluid/operators/detection/box_clip_op.cc
+6
-7
paddle/fluid/operators/detection/box_clip_op.h
paddle/fluid/operators/detection/box_clip_op.h
+4
-2
paddle/fluid/operators/detection/box_coder_op.h
paddle/fluid/operators/detection/box_coder_op.h
+14
-4
paddle/fluid/operators/roi_align_op.cc
paddle/fluid/operators/roi_align_op.cc
+10
-9
paddle/fluid/operators/roi_align_op.cu
paddle/fluid/operators/roi_align_op.cu
+13
-6
paddle/fluid/operators/roi_align_op.h
paddle/fluid/operators/roi_align_op.h
+15
-8
未找到文件。
paddle/fluid/operators/detection/box_clip_op.cc
浏览文件 @
cd327e66
...
@@ -36,20 +36,19 @@ class BoxClipOp : public framework::OperatorWithKernel {
...
@@ -36,20 +36,19 @@ class BoxClipOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
input_box_dims
[
input_box_size
-
1
],
4
,
input_box_dims
[
input_box_size
-
1
],
4
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The last dimension "
"The last dimension
of Input(Input) in BoxClipOp must be 4.
"
"
of Input must be 4.
But received last dimension = %d"
,
"But received last dimension = %d"
,
input_box_dims
[
input_box_size
-
1
]));
input_box_dims
[
input_box_size
-
1
]));
PADDLE_ENFORCE_EQ
(
im_info_dims
.
size
(),
2
,
PADDLE_ENFORCE_EQ
(
im_info_dims
.
size
(),
2
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The rank of "
"The rank of Input(Input) in BoxClipOp must be 2."
"Input(Input) in BoxClipOp must be 2. But received "
" But received rank = %d"
,
"rank = %d"
,
im_info_dims
.
size
()));
im_info_dims
.
size
()));
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
im_info_dims
[
1
],
3
,
im_info_dims
[
1
],
3
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The last dimension "
"The last dimension
of Input(ImInfo) of BoxClipOp must be 3.
"
"
of ImInfo must be 3.
But received last dimension = %d"
,
"But received last dimension = %d"
,
im_info_dims
[
1
]));
im_info_dims
[
1
]));
}
}
ctx
->
ShareDim
(
"Input"
,
/*->*/
"Output"
);
ctx
->
ShareDim
(
"Input"
,
/*->*/
"Output"
);
...
...
paddle/fluid/operators/detection/box_clip_op.h
浏览文件 @
cd327e66
...
@@ -34,8 +34,10 @@ class BoxClipKernel : public framework::OpKernel<T> {
...
@@ -34,8 +34,10 @@ class BoxClipKernel : public framework::OpKernel<T> {
if
(
input_box
->
lod
().
size
())
{
if
(
input_box
->
lod
().
size
())
{
PADDLE_ENFORCE_EQ
(
input_box
->
lod
().
size
(),
1UL
,
PADDLE_ENFORCE_EQ
(
input_box
->
lod
().
size
(),
1UL
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"Input(Input) of "
"Input(Input) of BoxClip only supports 1 level "
"BoxClip only supports 1 level of LoD."
));
"of LoD. But received the "
"level = %d"
,
input_box
->
lod
().
size
()));
}
}
auto
box_lod
=
input_box
->
lod
().
back
();
auto
box_lod
=
input_box
->
lod
().
back
();
int64_t
n
=
static_cast
<
int64_t
>
(
box_lod
.
size
()
-
1
);
int64_t
n
=
static_cast
<
int64_t
>
(
box_lod
.
size
()
-
1
);
...
...
paddle/fluid/operators/detection/box_coder_op.h
浏览文件 @
cd327e66
...
@@ -21,12 +21,18 @@ namespace operators {
...
@@ -21,12 +21,18 @@ namespace operators {
enum
class
BoxCodeType
{
kEncodeCenterSize
=
0
,
kDecodeCenterSize
=
1
};
enum
class
BoxCodeType
{
kEncodeCenterSize
=
0
,
kDecodeCenterSize
=
1
};
inline
BoxCodeType
GetBoxCodeType
(
const
std
::
string
&
type
)
{
inline
BoxCodeType
GetBoxCodeType
(
const
std
::
string
&
type
)
{
PADDLE_ENFORCE_EQ
(
(
type
==
"encode_center_size"
)
||
(
type
==
"decode_center_size"
),
true
,
platform
::
errors
::
InvalidArgument
(
"The 'code_type' attribute in BoxCoder"
" must be 'encode_center_size' or 'decode_center_size'. "
"But received 'code_type' is %s"
,
type
));
if
(
type
==
"encode_center_size"
)
{
if
(
type
==
"encode_center_size"
)
{
return
BoxCodeType
::
kEncodeCenterSize
;
return
BoxCodeType
::
kEncodeCenterSize
;
}
else
if
(
type
==
"decode_center_size"
)
{
}
else
{
return
BoxCodeType
::
kDecodeCenterSize
;
return
BoxCodeType
::
kDecodeCenterSize
;
}
}
PADDLE_THROW
(
"Not support type %s."
,
type
);
}
}
template
<
typename
DeviceContext
,
typename
T
>
template
<
typename
DeviceContext
,
typename
T
>
...
@@ -188,7 +194,9 @@ class BoxCoderKernel : public framework::OpKernel<T> {
...
@@ -188,7 +194,9 @@ class BoxCoderKernel : public framework::OpKernel<T> {
PADDLE_ENFORCE_EQ
(
target_box
->
lod
().
size
(),
1UL
,
PADDLE_ENFORCE_EQ
(
target_box
->
lod
().
size
(),
1UL
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"Input(TargetBox) of BoxCoder operator "
"Input(TargetBox) of BoxCoder operator "
"supports LoD with only one level."
));
"supports LoD with only one level. But received "
"level = %d"
,
target_box
->
lod
().
size
()));
}
}
if
(
prior_box_var
)
{
if
(
prior_box_var
)
{
PADDLE_ENFORCE_EQ
(
variance
.
empty
(),
true
,
PADDLE_ENFORCE_EQ
(
variance
.
empty
(),
true
,
...
@@ -201,7 +209,9 @@ class BoxCoderKernel : public framework::OpKernel<T> {
...
@@ -201,7 +209,9 @@ class BoxCoderKernel : public framework::OpKernel<T> {
PADDLE_ENFORCE_EQ
(
static_cast
<
int
>
(
variance
.
size
()),
4
,
PADDLE_ENFORCE_EQ
(
static_cast
<
int
>
(
variance
.
size
()),
4
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"Size of attribute 'variance' of BoxCoder "
"Size of attribute 'variance' of BoxCoder "
"operator should be 4"
));
"operator should be 4. But received "
"size = %d"
,
variance
.
size
()));
}
}
auto
code_type
=
GetBoxCodeType
(
context
.
Attr
<
std
::
string
>
(
"code_type"
));
auto
code_type
=
GetBoxCodeType
(
context
.
Attr
<
std
::
string
>
(
"code_type"
));
bool
normalized
=
context
.
Attr
<
bool
>
(
"box_normalized"
);
bool
normalized
=
context
.
Attr
<
bool
>
(
"box_normalized"
);
...
...
paddle/fluid/operators/roi_align_op.cc
浏览文件 @
cd327e66
...
@@ -40,7 +40,7 @@ class ROIAlignOp : public framework::OperatorWithKernel {
...
@@ -40,7 +40,7 @@ class ROIAlignOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
rois_lod_dims
.
size
(),
1
,
rois_lod_dims
.
size
(),
1
,
platform
::
errors
::
InvalidArgument
(
"The RoisLod dimension should be 1"
platform
::
errors
::
InvalidArgument
(
"The RoisLod dimension should be 1"
", but got dim = %d"
,
", but got dim
ension
= %d"
,
rois_lod_dims
.
size
()));
rois_lod_dims
.
size
()));
}
}
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
...
@@ -69,20 +69,21 @@ class ROIAlignOp : public framework::OperatorWithKernel {
...
@@ -69,20 +69,21 @@ class ROIAlignOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_GT
(
pooled_height
,
0
,
PADDLE_ENFORCE_GT
(
pooled_height
,
0
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The
pooled output
"
"The
'pooled_height' attribute in RoIAlignOp is
"
"
height must greater than 0. But received
"
"
invalid. The height must be greater than 0. But
"
"
pooled_height
= %d"
,
"
received 'pooled_height'
= %d"
,
pooled_height
));
pooled_height
));
PADDLE_ENFORCE_GT
(
pooled_width
,
0
,
PADDLE_ENFORCE_GT
(
pooled_width
,
0
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The
pooled output
"
"The
'pooled_width' attribute in RoIAlignOp is
"
"
width must greater than 0. But received
"
"
invalid. The width must be greater than 0. But
"
"
pooled_width
= %d"
,
"
received 'pooled_width'
= %d"
,
pooled_width
));
pooled_width
));
PADDLE_ENFORCE_GT
(
spatial_scale
,
0.0
f
,
PADDLE_ENFORCE_GT
(
spatial_scale
,
0.0
f
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The spatial scale "
"The 'spatial_scale' attribute in RoIAlignOp is "
"must greater than 0 But received spatial_scale = %f"
,
"invalid. The scale must be greater than 0. But "
"received 'spatial_scale' = %f"
,
spatial_scale
));
spatial_scale
));
auto
out_dims
=
input_dims
;
auto
out_dims
=
input_dims
;
...
...
paddle/fluid/operators/roi_align_op.cu
浏览文件 @
cd327e66
...
@@ -284,19 +284,26 @@ class GPUROIAlignOpKernel : public framework::OpKernel<T> {
...
@@ -284,19 +284,26 @@ class GPUROIAlignOpKernel : public framework::OpKernel<T> {
auto
lod
=
rois
->
lod
();
auto
lod
=
rois
->
lod
();
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
lod
.
empty
(),
false
,
lod
.
empty
(),
false
,
"Input(ROIs) Tensor of ROIAlignOp does not contain LoD information."
);
platform
::
errors
::
InvalidArgument
(
"Input(ROIs) in ROIAlignOp does "
"not contain LoD information."
));
auto
rois_lod
=
lod
.
back
();
auto
rois_lod
=
lod
.
back
();
int
rois_batch_size
=
rois_lod
.
size
()
-
1
;
int
rois_batch_size
=
rois_lod
.
size
()
-
1
;
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
rois_batch_size
,
batch_size
,
rois_batch_size
,
batch_size
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The
rois_batch_size and imgs
"
"The
batch size of rois and batch size
"
"
batch_size must be the same. But received rois_batch_
size = %d, "
"
of images must be the same. But received rois batch
size = %d, "
"
batch_
size = %d"
,
"
and images batch
size = %d"
,
rois_batch_size
,
batch_size
));
rois_batch_size
,
batch_size
));
int
rois_num_with_lod
=
rois_lod
[
rois_batch_size
];
int
rois_num_with_lod
=
rois_lod
[
rois_batch_size
];
PADDLE_ENFORCE_EQ
(
rois_num
,
rois_num_with_lod
,
PADDLE_ENFORCE_EQ
(
"The rois_num from input and lod must be the same."
);
rois_num
,
rois_num_with_lod
,
platform
::
errors
::
InvalidArgument
(
"The actual number of rois and the number of rois "
"provided from Input(RoIsLoD) in RoIAlign must be the same."
" But received actual number of rois is %d, and the number "
"of rois from RoIsLoD is %d"
,
rois_num
,
rois_num_with_lod
));
for
(
int
n
=
0
;
n
<
rois_batch_size
;
++
n
)
{
for
(
int
n
=
0
;
n
<
rois_batch_size
;
++
n
)
{
for
(
size_t
i
=
rois_lod
[
n
];
i
<
rois_lod
[
n
+
1
];
++
i
)
{
for
(
size_t
i
=
rois_lod
[
n
];
i
<
rois_lod
[
n
+
1
];
++
i
)
{
roi_batch_id_data
[
i
]
=
n
;
roi_batch_id_data
[
i
]
=
n
;
...
...
paddle/fluid/operators/roi_align_op.h
浏览文件 @
cd327e66
...
@@ -171,9 +171,9 @@ class CPUROIAlignOpKernel : public framework::OpKernel<T> {
...
@@ -171,9 +171,9 @@ class CPUROIAlignOpKernel : public framework::OpKernel<T> {
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
rois_batch_size
-
1
,
batch_size
,
rois_batch_size
-
1
,
batch_size
,
platform
::
errors
::
InvalidArgument
(
platform
::
errors
::
InvalidArgument
(
"The
rois_batch_size and img
s "
"The
batch size of rois and the batch size of image
s "
"
batch_size must be the same. But received rois_batch_size =
%d, "
"
must be the same. But received the batch size of rois is
%d, "
"
batch_size =
%d"
,
"
and the batch size of images is
%d"
,
rois_batch_size
,
batch_size
));
rois_batch_size
,
batch_size
));
auto
*
rois_lod
=
rois_lod_t
->
data
<
int64_t
>
();
auto
*
rois_lod
=
rois_lod_t
->
data
<
int64_t
>
();
for
(
int
n
=
0
;
n
<
rois_batch_size
-
1
;
++
n
)
{
for
(
int
n
=
0
;
n
<
rois_batch_size
-
1
;
++
n
)
{
...
@@ -183,9 +183,10 @@ class CPUROIAlignOpKernel : public framework::OpKernel<T> {
...
@@ -183,9 +183,10 @@ class CPUROIAlignOpKernel : public framework::OpKernel<T> {
}
}
}
else
{
}
else
{
auto
lod
=
rois
->
lod
();
auto
lod
=
rois
->
lod
();
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
lod
.
empty
(),
false
,
lod
.
empty
(),
false
,
platform
::
errors
::
InvalidArgument
(
"Input(ROIs) Tensor of ROIAlignOp does not contain LoD information."
);
"Input(ROIs) Tensor of ROIAlignOp "
"does not contain LoD information."
));
auto
rois_lod
=
lod
.
back
();
auto
rois_lod
=
lod
.
back
();
int
rois_batch_size
=
rois_lod
.
size
()
-
1
;
int
rois_batch_size
=
rois_lod
.
size
()
-
1
;
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
...
@@ -196,8 +197,14 @@ class CPUROIAlignOpKernel : public framework::OpKernel<T> {
...
@@ -196,8 +197,14 @@ class CPUROIAlignOpKernel : public framework::OpKernel<T> {
"batch_size = %d"
,
"batch_size = %d"
,
rois_batch_size
,
batch_size
));
rois_batch_size
,
batch_size
));
int
rois_num_with_lod
=
rois_lod
[
rois_batch_size
];
int
rois_num_with_lod
=
rois_lod
[
rois_batch_size
];
PADDLE_ENFORCE_EQ
(
rois_num
,
rois_num_with_lod
,
PADDLE_ENFORCE_EQ
(
"The rois_num from input and lod must be the same."
);
rois_num
,
rois_num_with_lod
,
platform
::
errors
::
InvalidArgument
(
"The actual number of rois and the number of rois "
"provided from Input(RoIsLoD) in RoIAlign must be the same."
" But received actual number of rois is %d, and the number "
"of rois from RoIsLoD is %d"
,
rois_num
,
rois_num_with_lod
));
for
(
int
n
=
0
;
n
<
rois_batch_size
;
++
n
)
{
for
(
int
n
=
0
;
n
<
rois_batch_size
;
++
n
)
{
for
(
size_t
i
=
rois_lod
[
n
];
i
<
rois_lod
[
n
+
1
];
++
i
)
{
for
(
size_t
i
=
rois_lod
[
n
];
i
<
rois_lod
[
n
+
1
];
++
i
)
{
roi_batch_id_data
[
i
]
=
n
;
roi_batch_id_data
[
i
]
=
n
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录