Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
0dfeb391
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看板
提交
0dfeb391
编写于
8月 20, 2018
作者:
B
baiyf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
port python3
上级
0db126d8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
12 addition
and
10 deletion
+12
-10
fluid/face_detection/profile.py
fluid/face_detection/profile.py
+1
-1
fluid/face_detection/pyramidbox.py
fluid/face_detection/pyramidbox.py
+5
-5
fluid/face_detection/reader.py
fluid/face_detection/reader.py
+2
-1
fluid/face_detection/train.py
fluid/face_detection/train.py
+2
-2
fluid/face_detection/utility.py
fluid/face_detection/utility.py
+2
-1
未找到文件。
fluid/face_detection/profile.py
浏览文件 @
0dfeb391
...
...
@@ -59,7 +59,7 @@ def train(args, config, train_file_list, optimizer_method):
loss
=
network
.
vgg_ssd_loss
()
fetches
=
[
loss
]
epocs
=
12880
/
batch_size
epocs
=
12880
/
/
batch_size
boundaries
=
[
epocs
*
40
,
epocs
*
60
,
epocs
*
80
,
epocs
*
100
]
values
=
[
learning_rate
,
learning_rate
*
0.5
,
learning_rate
*
0.25
,
...
...
fluid/face_detection/pyramidbox.py
浏览文件 @
0dfeb391
import
numpy
as
np
import
six
import
paddle.fluid
as
fluid
from
paddle.fluid.param_attr
import
ParamAttr
from
paddle.fluid.initializer
import
Xavier
...
...
@@ -27,13 +27,13 @@ def conv_block(input, groups, filters, ksizes, strides=None, with_pool=True):
w_attr
=
ParamAttr
(
learning_rate
=
1.
,
initializer
=
Xavier
())
b_attr
=
ParamAttr
(
learning_rate
=
2.
,
regularizer
=
L2Decay
(
0.
))
conv
=
input
for
i
in
xrange
(
groups
):
for
i
in
six
.
moves
.
xrange
(
groups
):
conv
=
fluid
.
layers
.
conv2d
(
input
=
conv
,
num_filters
=
filters
[
i
],
filter_size
=
ksizes
[
i
],
stride
=
strides
[
i
],
padding
=
(
ksizes
[
i
]
-
1
)
/
2
,
padding
=
(
ksizes
[
i
]
-
1
)
/
/
2
,
param_attr
=
w_attr
,
bias_attr
=
b_attr
,
act
=
'relu'
)
...
...
@@ -220,7 +220,7 @@ class PyramidBox(object):
def
permute_and_reshape
(
input
,
last_dim
):
trans
=
fluid
.
layers
.
transpose
(
input
,
perm
=
[
0
,
2
,
3
,
1
])
compile_shape
=
[
trans
.
shape
[
0
],
np
.
prod
(
trans
.
shape
[
1
:])
/
last_dim
,
last_dim
trans
.
shape
[
0
],
np
.
prod
(
trans
.
shape
[
1
:])
/
/
last_dim
,
last_dim
]
run_shape
=
fluid
.
layers
.
assign
(
np
.
array
([
0
,
-
1
,
last_dim
]).
astype
(
"int32"
))
...
...
@@ -291,7 +291,7 @@ class PyramidBox(object):
def
permute_and_reshape
(
input
,
last_dim
):
trans
=
fluid
.
layers
.
transpose
(
input
,
perm
=
[
0
,
2
,
3
,
1
])
compile_shape
=
[
trans
.
shape
[
0
],
np
.
prod
(
trans
.
shape
[
1
:])
/
last_dim
,
last_dim
trans
.
shape
[
0
],
np
.
prod
(
trans
.
shape
[
1
:])
/
/
last_dim
,
last_dim
]
run_shape
=
fluid
.
layers
.
assign
(
np
.
array
([
0
,
-
1
,
last_dim
]).
astype
(
"int32"
))
...
...
fluid/face_detection/reader.py
浏览文件 @
0dfeb391
...
...
@@ -24,6 +24,7 @@ import time
import
copy
import
random
import
cv2
import
six
from
data_util
import
GeneratorEnqueuer
...
...
@@ -151,7 +152,7 @@ def preprocess(img, bbox_labels, mode, settings, image_path):
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/face_detection/train.py
浏览文件 @
0dfeb391
...
...
@@ -57,7 +57,7 @@ def train(args, config, train_file_list, optimizer_method):
loss
=
network
.
vgg_ssd_loss
()
fetches
=
[
loss
]
steps_per_pass
=
12880
/
batch_size
steps_per_pass
=
12880
/
/
batch_size
boundaries
=
[
steps_per_pass
*
50
,
steps_per_pass
*
80
,
steps_per_pass
*
120
,
steps_per_pass
*
140
]
values
=
[
...
...
@@ -110,7 +110,7 @@ def train(args, config, train_file_list, optimizer_method):
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
)
def
tensor
(
data
,
place
,
lod
=
None
):
...
...
fluid/face_detection/utility.py
浏览文件 @
0dfeb391
...
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
distutils.util
import
six
def
print_arguments
(
args
):
...
...
@@ -34,7 +35,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录