Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
b882bc89
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看板
未验证
提交
b882bc89
编写于
10月 23, 2019
作者:
K
Kaipeng Deng
提交者:
GitHub
10月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix detect use io.open (#3725)
use io.open instead open in rcnn/yolo/ssd
上级
5d35f15a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
11 deletion
+15
-11
PaddleCV/rcnn/eval_coco_map.py
PaddleCV/rcnn/eval_coco_map.py
+5
-4
PaddleCV/ssd/data/pascalvoc/download.py
PaddleCV/ssd/data/pascalvoc/download.py
+4
-3
PaddleCV/ssd/eval_coco_map.py
PaddleCV/ssd/eval_coco_map.py
+3
-2
PaddleCV/yolov3/eval.py
PaddleCV/yolov3/eval.py
+3
-2
未找到文件。
PaddleCV/rcnn/eval_coco_map.py
浏览文件 @
b882bc89
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
print_function
import
os
import
os
import
io
import
time
import
time
import
numpy
as
np
import
numpy
as
np
from
eval_helper
import
*
from
eval_helper
import
*
...
@@ -116,8 +117,8 @@ def eval():
...
@@ -116,8 +117,8 @@ def eval():
segms_res
)
>
0
,
"The number of valid mask detected is zero.
\n
\
segms_res
)
>
0
,
"The number of valid mask detected is zero.
\n
\
Please use reasonable model and check input data."
Please use reasonable model and check input data."
with
open
(
"detection_bbox_result.json"
,
'w'
)
as
outfile
:
with
io
.
open
(
"detection_bbox_result.json"
,
'w'
)
as
outfile
:
json
.
dump
(
dts_res
,
outfile
)
outfile
.
write
(
unicode
(
json
.
dumps
(
dts_res
))
)
print
(
"start evaluate bbox using coco api"
)
print
(
"start evaluate bbox using coco api"
)
cocoDt
=
cocoGt
.
loadRes
(
"detection_bbox_result.json"
)
cocoDt
=
cocoGt
.
loadRes
(
"detection_bbox_result.json"
)
cocoEval
=
COCOeval
(
cocoGt
,
cocoDt
,
'bbox'
)
cocoEval
=
COCOeval
(
cocoGt
,
cocoDt
,
'bbox'
)
...
@@ -126,8 +127,8 @@ def eval():
...
@@ -126,8 +127,8 @@ def eval():
cocoEval
.
summarize
()
cocoEval
.
summarize
()
if
cfg
.
MASK_ON
:
if
cfg
.
MASK_ON
:
with
open
(
"detection_segms_result.json"
,
'w'
)
as
outfile
:
with
io
.
open
(
"detection_segms_result.json"
,
'w'
)
as
outfile
:
json
.
dump
(
segms_res
,
outfile
)
outfile
.
write
(
unicode
(
json
.
dumps
(
segms_res
))
)
print
(
"start evaluate mask using coco api"
)
print
(
"start evaluate mask using coco api"
)
cocoDt
=
cocoGt
.
loadRes
(
"detection_segms_result.json"
)
cocoDt
=
cocoGt
.
loadRes
(
"detection_segms_result.json"
)
cocoEval
=
COCOeval
(
cocoGt
,
cocoDt
,
'segm'
)
cocoEval
=
COCOeval
(
cocoGt
,
cocoDt
,
'segm'
)
...
...
PaddleCV/ssd/data/pascalvoc/download.py
浏览文件 @
b882bc89
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
os
import
os
import
os.path
as
osp
import
os.path
as
osp
import
sys
import
sys
import
io
import
re
import
re
import
random
import
random
import
tarfile
import
tarfile
...
@@ -63,7 +64,7 @@ def walk_dir(devkit_dir, year):
...
@@ -63,7 +64,7 @@ def walk_dir(devkit_dir, year):
else
:
else
:
continue
continue
fpath
=
osp
.
join
(
filelist_dir
,
fname
)
fpath
=
osp
.
join
(
filelist_dir
,
fname
)
for
line
in
open
(
fpath
):
for
line
in
io
.
open
(
fpath
):
name_prefix
=
line
.
strip
().
split
()[
0
]
name_prefix
=
line
.
strip
().
split
()[
0
]
if
name_prefix
in
added
:
if
name_prefix
in
added
:
continue
continue
...
@@ -85,11 +86,11 @@ def prepare_filelist(devkit_dir, years, output_dir):
...
@@ -85,11 +86,11 @@ def prepare_filelist(devkit_dir, years, output_dir):
trainval_list
.
extend
(
trainval
)
trainval_list
.
extend
(
trainval
)
test_list
.
extend
(
test
)
test_list
.
extend
(
test
)
random
.
shuffle
(
trainval_list
)
random
.
shuffle
(
trainval_list
)
with
open
(
osp
.
join
(
output_dir
,
'trainval.txt'
),
'w'
)
as
ftrainval
:
with
io
.
open
(
osp
.
join
(
output_dir
,
'trainval.txt'
),
'w'
)
as
ftrainval
:
for
item
in
trainval_list
:
for
item
in
trainval_list
:
ftrainval
.
write
(
item
[
0
]
+
' '
+
item
[
1
]
+
'
\n
'
)
ftrainval
.
write
(
item
[
0
]
+
' '
+
item
[
1
]
+
'
\n
'
)
with
open
(
osp
.
join
(
output_dir
,
'test.txt'
),
'w'
)
as
ftest
:
with
io
.
open
(
osp
.
join
(
output_dir
,
'test.txt'
),
'w'
)
as
ftest
:
for
item
in
test_list
:
for
item
in
test_list
:
ftest
.
write
(
item
[
0
]
+
' '
+
item
[
1
]
+
'
\n
'
)
ftest
.
write
(
item
[
0
]
+
' '
+
item
[
1
]
+
'
\n
'
)
...
...
PaddleCV/ssd/eval_coco_map.py
浏览文件 @
b882bc89
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
os
import
os
import
io
import
time
import
time
import
numpy
as
np
import
numpy
as
np
import
argparse
import
argparse
...
@@ -128,8 +129,8 @@ def eval(args, data_args, test_list, batch_size, model_dir=None):
...
@@ -128,8 +129,8 @@ def eval(args, data_args, test_list, batch_size, model_dir=None):
print
(
"Batch {0}"
.
format
(
batch_id
))
print
(
"Batch {0}"
.
format
(
batch_id
))
dts_res
+=
get_dt_res
(
nmsed_out_v
,
data
)
dts_res
+=
get_dt_res
(
nmsed_out_v
,
data
)
with
open
(
"detection_result.json"
,
'w'
)
as
outfile
:
with
io
.
open
(
"detection_result.json"
,
'w'
)
as
outfile
:
json
.
dump
(
dts_res
,
outfile
)
outfile
.
write
(
unicode
(
json
.
dumps
(
dts_res
))
)
print
(
"start evaluate using coco api"
)
print
(
"start evaluate using coco api"
)
cocoGt
=
COCO
(
os
.
path
.
join
(
data_args
.
data_dir
,
test_list
))
cocoGt
=
COCO
(
os
.
path
.
join
(
data_args
.
data_dir
,
test_list
))
cocoDt
=
cocoGt
.
loadRes
(
"detection_result.json"
)
cocoDt
=
cocoGt
.
loadRes
(
"detection_result.json"
)
...
...
PaddleCV/yolov3/eval.py
浏览文件 @
b882bc89
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
print_function
import
os
import
os
import
io
import
time
import
time
import
json
import
json
import
numpy
as
np
import
numpy
as
np
...
@@ -113,8 +114,8 @@ def eval():
...
@@ -113,8 +114,8 @@ def eval():
print
(
"batch id: {}, time: {}"
.
format
(
batch_id
,
end_time
-
start_time
))
print
(
"batch id: {}, time: {}"
.
format
(
batch_id
,
end_time
-
start_time
))
total_time
+=
end_time
-
start_time
total_time
+=
end_time
-
start_time
with
open
(
"yolov3_result.json"
,
'w'
)
as
outfile
:
with
io
.
open
(
"yolov3_result.json"
,
'w'
)
as
outfile
:
json
.
dump
(
dts_res
,
outfile
)
outfile
.
write
(
unicode
(
json
.
dumps
(
dts_res
))
)
print
(
"start evaluate detection result with coco api"
)
print
(
"start evaluate detection result with coco api"
)
coco
=
COCO
(
os
.
path
.
join
(
cfg
.
data_dir
,
test_list
))
coco
=
COCO
(
os
.
path
.
join
(
cfg
.
data_dir
,
test_list
))
cocoDt
=
coco
.
loadRes
(
"yolov3_result.json"
)
cocoDt
=
coco
.
loadRes
(
"yolov3_result.json"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录