Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
c8c51ac7
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c8c51ac7
编写于
7月 08, 2020
作者:
G
Guanghua Yu
提交者:
GitHub
7月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix use cv2 in face_detection (#1034)
上级
fb650fbb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
28 deletion
+11
-28
configs/face_detection/blazeface_nas.yml
configs/face_detection/blazeface_nas.yml
+0
-9
configs/face_detection/blazeface_nas_v2.yml
configs/face_detection/blazeface_nas_v2.yml
+1
-10
tools/face_eval.py
tools/face_eval.py
+10
-9
未找到文件。
configs/face_detection/blazeface_nas.yml
浏览文件 @
c8c51ac7
...
...
@@ -98,10 +98,6 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!ResizeImage
interp
:
1
target_size
:
640
use_cv2
:
false
-
!Permute
{}
-
!NormalizeImage
is_scale
:
false
...
...
@@ -111,7 +107,6 @@ EvalReader:
TestReader
:
inputs_def
:
image_shape
:
[
3
,
640
,
640
]
fields
:
[
'
image'
,
'
im_id'
,
'
im_shape'
]
dataset
:
!ImageFolder
...
...
@@ -119,10 +114,6 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!ResizeImage
interp
:
1
target_size
:
640
use_cv2
:
false
-
!Permute
{}
-
!NormalizeImage
is_scale
:
false
...
...
configs/face_detection/blazeface_nas_v2.yml
浏览文件 @
c8c51ac7
...
...
@@ -7,7 +7,7 @@ log_smooth_window: 20
log_iter
:
20
metric
:
WIDERFACE
save_dir
:
output
weights
:
output/blazeface_nas/model_final
weights
:
output/blazeface_nas
_v2
/model_final
# 1(label_class) + 1(background)
num_classes
:
2
...
...
@@ -98,10 +98,6 @@ EvalReader:
-
!DecodeImage
to_rgb
:
true
-
!NormalizeBox
{}
-
!ResizeImage
interp
:
1
target_size
:
640
use_cv2
:
false
-
!Permute
{}
-
!NormalizeImage
is_scale
:
false
...
...
@@ -111,7 +107,6 @@ EvalReader:
TestReader
:
inputs_def
:
image_shape
:
[
3
,
640
,
640
]
fields
:
[
'
image'
,
'
im_id'
,
'
im_shape'
]
dataset
:
!ImageFolder
...
...
@@ -119,10 +114,6 @@ TestReader:
sample_transforms
:
-
!DecodeImage
to_rgb
:
true
-
!ResizeImage
interp
:
1
target_size
:
640
use_cv2
:
false
-
!Permute
{}
-
!NormalizeImage
is_scale
:
false
...
...
tools/face_eval.py
浏览文件 @
c8c51ac7
...
...
@@ -25,7 +25,7 @@ if parent_path not in sys.path:
import
paddle.fluid
as
fluid
import
numpy
as
np
from
PIL
import
Image
import
cv2
from
collections
import
OrderedDict
import
ppdet.utils.checkpoint
as
checkpoint
...
...
@@ -81,9 +81,10 @@ def face_eval_run(exe,
if
eval_mode
==
'fddb'
:
image_path
+=
'.jpg'
assert
os
.
path
.
exists
(
image_path
)
image
=
Image
.
open
(
image_path
).
convert
(
'RGB'
)
image
=
cv2
.
imread
(
image_path
)
image
=
cv2
.
cvtColor
(
image
,
cv2
.
COLOR_BGR2RGB
)
if
multi_scale
:
shrink
,
max_shrink
=
get_shrink
(
image
.
s
ize
[
1
],
image
.
size
[
0
])
shrink
,
max_shrink
=
get_shrink
(
image
.
s
hape
[
0
],
image
.
shape
[
1
])
det0
=
detect_face
(
exe
,
compile_program
,
fetches
,
image
,
shrink
)
det1
=
flip_test
(
exe
,
compile_program
,
fetches
,
image
,
shrink
)
[
det2
,
det3
]
=
multi_scale_test
(
exe
,
compile_program
,
fetches
,
...
...
@@ -106,10 +107,10 @@ def face_eval_run(exe,
def
detect_face
(
exe
,
compile_program
,
fetches
,
image
,
shrink
):
image_shape
=
[
3
,
image
.
s
ize
[
1
],
image
.
size
[
0
]]
image_shape
=
[
3
,
image
.
s
hape
[
0
],
image
.
shape
[
1
]]
if
shrink
!=
1
:
h
,
w
=
int
(
image_shape
[
1
]
*
shrink
),
int
(
image_shape
[
2
]
*
shrink
)
image
=
image
.
resize
((
w
,
h
),
Image
.
ANTIALIAS
)
image
=
cv2
.
resize
(
image
,
(
w
,
h
)
)
image_shape
=
[
3
,
h
,
w
]
img
=
face_img_process
(
image
)
...
...
@@ -133,13 +134,13 @@ def detect_face(exe, compile_program, fetches, image, shrink):
def
flip_test
(
exe
,
compile_program
,
fetches
,
image
,
shrink
):
img
=
image
.
transpose
(
Image
.
FLIP_LEFT_RIGHT
)
img
=
cv2
.
flip
(
image
,
1
)
det_f
=
detect_face
(
exe
,
compile_program
,
fetches
,
img
,
shrink
)
det_t
=
np
.
zeros
(
det_f
.
shape
)
# image.size: [width, height
]
det_t
[:,
0
]
=
im
age
.
size
[
0
]
-
det_f
[:,
2
]
img_width
=
image
.
shape
[
1
]
det_t
[:,
0
]
=
im
g_width
-
det_f
[:,
2
]
det_t
[:,
1
]
=
det_f
[:,
1
]
det_t
[:,
2
]
=
im
age
.
size
[
0
]
-
det_f
[:,
0
]
det_t
[:,
2
]
=
im
g_width
-
det_f
[:,
0
]
det_t
[:,
3
]
=
det_f
[:,
3
]
det_t
[:,
4
]
=
det_f
[:,
4
]
return
det_t
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录