Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
3d021fb2
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
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看板
提交
3d021fb2
编写于
8月 13, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Port object_detection to Python3
上级
06820fcb
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
12 deletion
+15
-12
fluid/object_detection/reader.py
fluid/object_detection/reader.py
+2
-1
fluid/object_detection/train.py
fluid/object_detection/train.py
+10
-10
fluid/object_detection/utility.py
fluid/object_detection/utility.py
+3
-1
未找到文件。
fluid/object_detection/reader.py
浏览文件 @
3d021fb2
...
...
@@ -22,6 +22,7 @@ import xml.etree.ElementTree
import
os
import
time
import
copy
import
six
class
Settings
(
object
):
...
...
@@ -151,7 +152,7 @@ def preprocess(img, bbox_labels, mode, settings):
mirror
=
int
(
random
.
uniform
(
0
,
2
))
if
mirror
==
1
:
img
=
img
[:,
::
-
1
,
:]
for
i
in
xrange
(
len
(
sampled_labels
)):
for
i
in
six
.
moves
.
xrange
(
len
(
sampled_labels
)):
tmp
=
sampled_labels
[
i
][
1
]
sampled_labels
[
i
][
1
]
=
1
-
sampled_labels
[
i
][
3
]
sampled_labels
[
i
][
3
]
=
1
-
tmp
...
...
fluid/object_detection/train.py
浏览文件 @
3d021fb2
...
...
@@ -88,16 +88,16 @@ def train(args,
if
'coco'
in
data_args
.
dataset
:
# learning rate decay in 12, 19 pass, respectively
if
'2014'
in
train_file_list
:
epocs
=
82783
/
batch_size
epocs
=
82783
/
/
batch_size
boundaries
=
[
epocs
*
12
,
epocs
*
19
]
elif
'2017'
in
train_file_list
:
epocs
=
118287
/
batch_size
epocs
=
118287
/
/
batch_size
boundaries
=
[
epocs
*
12
,
epocs
*
19
]
values
=
[
learning_rate
,
learning_rate
*
0.5
,
learning_rate
*
0.25
]
elif
'pascalvoc'
in
data_args
.
dataset
:
epocs
=
19200
/
batch_size
epocs
=
19200
/
/
batch_size
boundaries
=
[
epocs
*
40
,
epocs
*
60
,
epocs
*
80
,
epocs
*
100
]
values
=
[
learning_rate
,
learning_rate
*
0.5
,
learning_rate
*
0.25
,
...
...
@@ -137,7 +137,7 @@ def train(args,
model_path
=
os
.
path
.
join
(
model_save_dir
,
postfix
)
if
os
.
path
.
isdir
(
model_path
):
shutil
.
rmtree
(
model_path
)
print
'save models to %s'
%
(
model_path
)
print
(
'save models to %s'
%
(
model_path
)
)
fluid
.
io
.
save_persistables
(
exe
,
model_path
)
best_map
=
0.
...
...
@@ -193,15 +193,15 @@ def train(args,
total_time
+=
end_time
-
start_time
train_avg_loss
=
np
.
mean
(
every_pass_loss
)
if
devices_num
==
1
:
print
(
"kpis train_cost %s"
%
train_avg_loss
)
print
(
"kpis test_acc %s"
%
mean_map
)
print
(
"kpis train_speed %s"
%
(
total_time
/
epoch_idx
))
print
(
"kpis train_cost %s"
%
train_avg_loss
)
print
(
"kpis test_acc %s"
%
mean_map
)
print
(
"kpis train_speed %s"
%
(
total_time
/
epoch_idx
))
else
:
print
(
"kpis train_cost_card%s %s"
%
print
(
"kpis train_cost_card%s %s"
%
(
devices_num
,
train_avg_loss
))
print
(
"kpis test_acc_card%s %s"
%
print
(
"kpis test_acc_card%s %s"
%
(
devices_num
,
mean_map
))
print
(
"kpis train_speed_card%s %f"
%
print
(
"kpis train_speed_card%s %f"
%
(
devices_num
,
total_time
/
epoch_idx
))
...
...
fluid/object_detection/utility.py
浏览文件 @
3d021fb2
...
...
@@ -16,8 +16,10 @@
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
distutils.util
import
numpy
as
np
import
six
from
paddle.fluid
import
core
...
...
@@ -37,7 +39,7 @@ def print_arguments(args):
:type args: argparse.Namespace
"""
print
(
"----------- Configuration Arguments -----------"
)
for
arg
,
value
in
sorted
(
vars
(
args
).
iteritems
(
)):
for
arg
,
value
in
sorted
(
six
.
iteritems
(
vars
(
args
)
)):
print
(
"%s: %s"
%
(
arg
,
value
))
print
(
"------------------------------------------------"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录