Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
b399ee2a
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看板
提交
b399ee2a
编写于
3月 08, 2019
作者:
D
dengkaipeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix doc. test=develop
上级
ad897304
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
23 addition
and
17 deletion
+23
-17
paddle/fluid/operators/detection/yolo_box_op.cc
paddle/fluid/operators/detection/yolo_box_op.cc
+21
-15
paddle/fluid/operators/detection/yolo_box_op.cu
paddle/fluid/operators/detection/yolo_box_op.cu
+1
-1
paddle/fluid/operators/detection/yolo_box_op.h
paddle/fluid/operators/detection/yolo_box_op.h
+1
-1
未找到文件。
paddle/fluid/operators/detection/yolo_box_op.cc
浏览文件 @
b399ee2a
/* Copyright (c) 201
8
PaddlePaddle Authors. All Rights Reserve.
/* Copyright (c) 201
9
PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
...
...
@@ -48,11 +48,11 @@ class YoloBoxOp : public framework::OperatorWithKernel {
"Input(ImgSize) dim[0] and Input(X) dim[0] should be same."
);
PADDLE_ENFORCE_EQ
(
dim_imgsize
[
1
],
2
,
"Input(ImgSize) dim[1] should be 2."
);
PADDLE_ENFORCE_GT
(
anchors
.
size
(),
0
,
"Attr(anchors) length should be greater th
e
n 0."
);
"Attr(anchors) length should be greater th
a
n 0."
);
PADDLE_ENFORCE_EQ
(
anchors
.
size
()
%
2
,
0
,
"Attr(anchors) length should be even integer."
);
PADDLE_ENFORCE_GT
(
class_num
,
0
,
"Attr(class_num) should be an integer greater th
e
n 0."
);
"Attr(class_num) should be an integer greater th
a
n 0."
);
int
box_num
=
dim_x
[
2
]
*
dim_x
[
3
]
*
anchor_num
;
std
::
vector
<
int64_t
>
dim_boxes
({
dim_x
[
0
],
box_num
,
4
});
...
...
@@ -76,7 +76,7 @@ class YoloBoxOpMaker : public framework::OpProtoAndCheckerMaker {
AddInput
(
"X"
,
"The input tensor of YoloBox operator, "
"This is a 4-D tensor with shape of [N, C, H, W]."
"H and W should be same, and the second dimen
t
ion(C) stores"
"H and W should be same, and the second dimen
s
ion(C) stores"
"box locations, confidence score and classification one-hot"
"keys of each anchor box. Generally, X should be the output"
"of YOLOv3 network."
);
...
...
@@ -88,7 +88,7 @@ class YoloBoxOpMaker : public framework::OpProtoAndCheckerMaker {
AddOutput
(
"Boxes"
,
"The output tensor of detection boxes of YoloBox operator, "
"This is a 3-D tensor with shape of [N, M, 4], N is the"
"batch num, M is output box number, and the 3rd dimen
t
ion"
"batch num, M is output box number, and the 3rd dimen
s
ion"
"stores [xmin, ymin, xmax, ymax] coordinates of boxes."
);
AddOutput
(
"Scores"
,
"The output tensor ofdetection boxes scores of YoloBox"
...
...
@@ -112,36 +112,42 @@ class YoloBoxOpMaker : public framework::OpProtoAndCheckerMaker {
"be ignored."
)
.
SetDefault
(
0.01
);
AddComment
(
R"DOC(
This operator generate YOLO detection boxes fro
n
output of YOLOv3 network.
This operator generate YOLO detection boxes fro
m
output of YOLOv3 network.
The output of previous network is in shape [N, C, H, W], while H and W
should be the same, specify the grid size, each grid point predict given
number boxes, this given number is specified by anchors, it should be
half anchors length, which following will be represented as S. In the
second dimen
tion(the channel diment
ion), C should be S * (class_num + 5),
second dimen
sion(the channel dimens
ion), C should be S * (class_num + 5),
class_num is the box categoriy number of source dataset(such as coco),
so in the second dimen
t
ion, stores 4 box location coordinates x, y, w, h
so in the second dimen
s
ion, stores 4 box location coordinates x, y, w, h
and confidence score of the box and class one-hot key of each anchor box.
While the 4 location coordinates if
$$tx, ty, tw, th$$, the box predictions
correspnd to:
While the 4 location coordinates if
:math:`tx, ty, tw, th`, the box
predictions
correspnd to:
$$
b_x = \sigma(t_x) + c_x
$$
$$
b_y = \sigma(t_y) + c_y
$$
$$
b_w = p_w e^{t_w}
$$
$$
b_h = p_h e^{t_h}
$$
While
$$c_x, c_y$$ is the left top corner of current grid and $$p_w, p_h$$
is specified by anchors.
While
:math:`c_x, c_y` is the left top corner of current grid and
:math:`p_w, p_h`
is specified by anchors.
The logistic scores of the 5rd channel of each anchor prediction boxes
represent the confidence score of each prediction scores, and the logistic
scores of the last class_num channels of each anchor prediction boxes
represent the classifcation scores. Boxes with confidence scores less th
e
n
conf_thresh should be ignored, and box
es final scores if the products result
of
confidence scores and classification scores.
represent the classifcation scores. Boxes with confidence scores less th
a
n
conf_thresh should be ignored, and box
final scores is the product of
confidence scores and classification scores.
)DOC"
);
}
...
...
paddle/fluid/operators/detection/yolo_box_op.cu
浏览文件 @
b399ee2a
/* Copyright (c) 201
8
PaddlePaddle Authors. All Rights Reserved.
/* Copyright (c) 201
9
PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
...
...
paddle/fluid/operators/detection/yolo_box_op.h
浏览文件 @
b399ee2a
/* Copyright (c) 201
8
PaddlePaddle Authors. All Rights Reserve.
/* Copyright (c) 201
9
PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录