Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
a9c8aa2c
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a9c8aa2c
编写于
9月 05, 2018
作者:
B
Bai Yifan
提交者:
GitHub
9月 05, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix data-anchor-sampling and use depthwise conv (#1188)
* fix data-anchor-sampling and use depthwise conv
上级
06ab0c69
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
7 deletion
+20
-7
fluid/face_detection/image_util.py
fluid/face_detection/image_util.py
+19
-6
fluid/face_detection/pyramidbox.py
fluid/face_detection/pyramidbox.py
+1
-1
未找到文件。
fluid/face_detection/image_util.py
浏览文件 @
a9c8aa2c
...
@@ -123,25 +123,34 @@ def data_anchor_sampling(sampler, bbox_labels, image_width, image_height,
...
@@ -123,25 +123,34 @@ def data_anchor_sampling(sampler, bbox_labels, image_width, image_height,
hei
=
image_height
*
(
norm_ymax
-
norm_ymin
)
hei
=
image_height
*
(
norm_ymax
-
norm_ymin
)
range_size
=
0
range_size
=
0
area
=
wid
*
hei
for
scale_ind
in
range
(
0
,
len
(
scale_array
)
-
1
):
for
scale_ind
in
range
(
0
,
len
(
scale_array
)
-
1
):
area
=
wid
*
hei
if
area
>
scale_array
[
scale_ind
]
**
2
and
area
<
\
if
area
>
scale_array
[
scale_ind
]
**
2
and
area
<
\
scale_array
[
scale_ind
+
1
]
**
2
:
scale_array
[
scale_ind
+
1
]
**
2
:
range_size
=
scale_ind
+
1
range_size
=
scale_ind
+
1
break
break
if
area
>
scale_array
[
len
(
scale_array
)
-
2
]
**
2
:
range_size
=
len
(
scale_array
)
-
2
scale_choose
=
0.0
scale_choose
=
0.0
if
range_size
==
0
:
if
range_size
==
0
:
rand_idx_size
=
range_size
+
1
rand_idx_size
=
0
else
:
else
:
# np.random.randint range: [low, high)
# np.random.randint range: [low, high)
rng_rand_size
=
np
.
random
.
randint
(
0
,
range_size
+
1
)
rng_rand_size
=
np
.
random
.
randint
(
0
,
range_size
+
1
)
rand_idx_size
=
rng_rand_size
%
(
range_size
+
1
)
rand_idx_size
=
rng_rand_size
%
(
range_size
+
1
)
min_resize_val
=
scale_array
[
rand_idx_size
]
/
2.0
if
rand_idx_size
==
range_size
:
max_resize_val
=
min
(
2.0
*
scale_array
[
rand_idx_size
],
min_resize_val
=
scale_array
[
rand_idx_size
]
/
2.0
2
*
math
.
sqrt
(
wid
*
hei
))
max_resize_val
=
min
(
2.0
*
scale_array
[
rand_idx_size
],
scale_choose
=
np
.
random
.
uniform
(
min_resize_val
,
max_resize_val
)
2
*
math
.
sqrt
(
wid
*
hei
))
scale_choose
=
random
.
uniform
(
min_resize_val
,
max_resize_val
)
else
:
min_resize_val
=
scale_array
[
rand_idx_size
]
/
2.0
max_resize_val
=
2.0
*
scale_array
[
rand_idx_size
]
scale_choose
=
random
.
uniform
(
min_resize_val
,
max_resize_val
)
sample_bbox_size
=
wid
*
resize_width
/
scale_choose
sample_bbox_size
=
wid
*
resize_width
/
scale_choose
w_off_orig
=
0.0
w_off_orig
=
0.0
...
@@ -178,6 +187,8 @@ def data_anchor_sampling(sampler, bbox_labels, image_width, image_height,
...
@@ -178,6 +187,8 @@ def data_anchor_sampling(sampler, bbox_labels, image_width, image_height,
w_off
+
float
(
sample_bbox_size
/
image_width
),
w_off
+
float
(
sample_bbox_size
/
image_width
),
h_off
+
float
(
sample_bbox_size
/
image_height
))
h_off
+
float
(
sample_bbox_size
/
image_height
))
return
sampled_bbox
return
sampled_bbox
else
:
return
0
def
jaccard_overlap
(
sample_bbox
,
object_bbox
):
def
jaccard_overlap
(
sample_bbox
,
object_bbox
):
...
@@ -265,6 +276,8 @@ def generate_batch_random_samples(batch_sampler, bbox_labels, image_width,
...
@@ -265,6 +276,8 @@ def generate_batch_random_samples(batch_sampler, bbox_labels, image_width,
sample_bbox
=
data_anchor_sampling
(
sample_bbox
=
data_anchor_sampling
(
sampler
,
bbox_labels
,
image_width
,
image_height
,
scale_array
,
sampler
,
bbox_labels
,
image_width
,
image_height
,
scale_array
,
resize_width
,
resize_height
)
resize_width
,
resize_height
)
if
sample_bbox
==
0
:
break
if
satisfy_sample_constraint
(
sampler
,
sample_bbox
,
bbox_labels
):
if
satisfy_sample_constraint
(
sampler
,
sample_bbox
,
bbox_labels
):
sampled_bbox
.
append
(
sample_bbox
)
sampled_bbox
.
append
(
sample_bbox
)
found
=
found
+
1
found
=
found
+
1
...
...
fluid/face_detection/pyramidbox.py
浏览文件 @
a9c8aa2c
...
@@ -144,7 +144,7 @@ class PyramidBox(object):
...
@@ -144,7 +144,7 @@ class PyramidBox(object):
groups
=
ch
,
groups
=
ch
,
param_attr
=
w_attr
,
param_attr
=
w_attr
,
bias_attr
=
False
,
bias_attr
=
False
,
use_cudnn
=
Tru
e
)
use_cudnn
=
Fals
e
)
else
:
else
:
upsampling
=
fluid
.
layers
.
resize_bilinear
(
upsampling
=
fluid
.
layers
.
resize_bilinear
(
conv1
,
out_shape
=
up_to
.
shape
[
2
:])
conv1
,
out_shape
=
up_to
.
shape
[
2
:])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录