Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
c19a0f30
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看板
提交
c19a0f30
编写于
2月 17, 2019
作者:
D
dengkaipeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix iou calc error
上级
eea7f8c0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
15 deletion
+15
-15
fluid/PaddleCV/yolov3/box_utils.py
fluid/PaddleCV/yolov3/box_utils.py
+10
-10
fluid/PaddleCV/yolov3/eval.py
fluid/PaddleCV/yolov3/eval.py
+4
-4
fluid/PaddleCV/yolov3/reader.py
fluid/PaddleCV/yolov3/reader.py
+1
-1
未找到文件。
fluid/PaddleCV/yolov3/box_utils.py
浏览文件 @
c19a0f30
...
...
@@ -84,11 +84,11 @@ def box_iou_xywh(box1, box2):
inter_x1
=
np
.
maximum
(
b1_x1
,
b2_x1
)
inter_x2
=
np
.
minimum
(
b1_x2
,
b2_x2
)
inter_y1
=
np
.
maximum
(
b1_y1
,
b2_y1
)
inter_y2
=
np
.
m
ax
imum
(
b1_y2
,
b2_y2
)
inter_y2
=
np
.
m
in
imum
(
b1_y2
,
b2_y2
)
inter_w
=
inter_x2
-
inter_x1
+
1
inter_h
=
inter_y2
-
inter_y1
+
1
inter_w
[
inter_w
<
0
]
=
=
0
inter_h
[
inter_h
<
0
]
=
=
0
inter_w
[
inter_w
<
0
]
=
0
inter_h
[
inter_h
<
0
]
=
0
inter_area
=
inter_w
*
inter_h
b1_area
=
(
b1_x2
-
b1_x1
+
1
)
*
(
b1_y2
-
b1_y1
+
1
)
...
...
@@ -106,15 +106,15 @@ def box_iou_xyxy(box1, box2):
inter_x1
=
np
.
maximum
(
b1_x1
,
b2_x1
)
inter_x2
=
np
.
minimum
(
b1_x2
,
b2_x2
)
inter_y1
=
np
.
maximum
(
b1_y1
,
b2_y1
)
inter_y2
=
np
.
m
ax
imum
(
b1_y2
,
b2_y2
)
inter_w
=
inter_x2
-
inter_x1
+
1
inter_h
=
inter_y2
-
inter_y1
+
1
inter_w
[
inter_w
<
0
]
=
=
0
inter_h
[
inter_h
<
0
]
=
=
0
inter_y2
=
np
.
m
in
imum
(
b1_y2
,
b2_y2
)
inter_w
=
inter_x2
-
inter_x1
inter_h
=
inter_y2
-
inter_y1
inter_w
[
inter_w
<
0
]
=
0
inter_h
[
inter_h
<
0
]
=
0
inter_area
=
inter_w
*
inter_h
b1_area
=
(
b1_x2
-
b1_x1
+
1
)
*
(
b1_y2
-
b1_y1
+
1
)
b2_area
=
(
b2_x2
-
b2_x1
+
1
)
*
(
b2_y2
-
b2_y1
+
1
)
b1_area
=
(
b1_x2
-
b1_x1
)
*
(
b1_y2
-
b1_y
1
)
b2_area
=
(
b2_x2
-
b2_x1
)
*
(
b2_y2
-
b2_y
1
)
return
inter_area
/
(
b1_area
+
b2_area
-
inter_area
)
...
...
fluid/PaddleCV/yolov3/eval.py
浏览文件 @
c19a0f30
...
...
@@ -61,19 +61,19 @@ def eval():
print
(
"Load in labels {} with ids {}"
.
format
(
label_names
,
label_ids
))
feeder
=
fluid
.
DataFeeder
(
place
=
place
,
feed_list
=
model
.
feeds
())
def
get_pred_result
(
boxes
,
conf
s
,
labels
,
im_id
):
def
get_pred_result
(
boxes
,
score
s
,
labels
,
im_id
):
result
=
[]
for
box
,
conf
,
label
in
zip
(
boxes
,
conf
s
,
labels
):
for
box
,
score
,
label
in
zip
(
boxes
,
score
s
,
labels
):
x1
,
y1
,
x2
,
y2
=
box
w
=
x2
-
x1
+
1
h
=
y2
-
y1
+
2
h
=
y2
-
y1
+
1
bbox
=
[
x1
,
y1
,
w
,
h
]
res
=
{
'image_id'
:
im_id
,
'category_id'
:
label_ids
[
int
(
label
)],
'bbox'
:
bbox
,
'score'
:
conf
'score'
:
score
}
result
.
append
(
res
)
return
result
...
...
fluid/PaddleCV/yolov3/reader.py
浏览文件 @
c19a0f30
...
...
@@ -41,7 +41,7 @@ class DataSetReader(object):
# cfg.data_dir = "dataset/coco"
# cfg.train_file_list = 'annotations/instances_val2017.json'
# cfg.train_data_dir = 'val2017'
cfg
.
dataset
=
"coco2017"
#
cfg.dataset = "coco2017"
if
'coco2014'
in
cfg
.
dataset
:
cfg
.
train_file_list
=
'annotations/instances_train2014.json'
cfg
.
train_data_dir
=
'train2014'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录