Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
c53882a0
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c53882a0
编写于
10月 21, 2019
作者:
G
Guanghua Yu
提交者:
qingqing01
10月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add face detection model link in README and support eval by singe-scale (#3665)
上级
89742766
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
21 deletion
+39
-21
configs/face_detection/README.md
configs/face_detection/README.md
+20
-11
tools/face_eval.py
tools/face_eval.py
+19
-10
未找到文件。
configs/face_detection/README.md
浏览文件 @
c53882a0
...
@@ -39,7 +39,7 @@ Loads `wider_face` type dataset with directory structures like this:
...
@@ -39,7 +39,7 @@ Loads `wider_face` type dataset with directory structures like this:
```
```
-
Download dataset manually:
-
Download dataset manually:
On the other hand, t
o download the WIDER FACE dataset, run the following commands:
T
o download the WIDER FACE dataset, run the following commands:
```
```
cd dataset/wider_face && ./download.sh
cd dataset/wider_face && ./download.sh
```
```
...
@@ -84,13 +84,13 @@ optimized network structure.
...
@@ -84,13 +84,13 @@ optimized network structure.
#### mAP in WIDER FACE
#### mAP in WIDER FACE
| Architecture | Type | Size | Img/gpu | Lr schd | Easy Set
| Medium Set | Hard Set
|
| Architecture | Type | Size | Img/gpu | Lr schd | Easy Set
| Medium Set | Hard Set | Download
|
|:------------:|:--------:|:----:|:-------:|:-------:|:--------
:|:-
---------:|:--------:|
|:------------:|:--------:|:----:|:-------:|:-------:|:--------
-:|:----------:|:
---------:|:--------:|
| BlazeFace | Original | 640 | 8 | 32w |
**0.915**
|
**0.892**
|
**0.797**
|
| BlazeFace | Original | 640 | 8 | 32w |
**0.915**
|
**0.892**
|
**0.797**
|
[
model
](
https://paddlemodels.bj.bcebos.com/object_detection/blazeface_original.tar
)
|
| BlazeFace | Lite | 640 | 8 | 32w | 0.909
| 0.885 | 0.781
|
| BlazeFace | Lite | 640 | 8 | 32w | 0.909
| 0.885 | 0.781 |
[
model
](
https://paddlemodels.bj.bcebos.com/object_detection/blazeface_lite.tar
)
|
| BlazeFace | NAS | 640 | 8 | 32w | 0.837
| 0.807 | 0.658
|
| BlazeFace | NAS | 640 | 8 | 32w | 0.837
| 0.807 | 0.658 |
[
model
](
https://paddlemodels.bj.bcebos.com/object_detection/blazeface_nas.tar
)
|
| FaceBoxes | Original | 640 | 8 | 32w | 0.875
| 0.848 | 0.568
|
| FaceBoxes | Original | 640 | 8 | 32w | 0.875
| 0.848 | 0.568 |
[
model
](
https://paddlemodels.bj.bcebos.com/object_detection/faceboxes_original.tar
)
|
| FaceBoxes | Lite | 640 | 8 | 32w | 0.898
| 0.872 | 0.752
|
| FaceBoxes | Lite | 640 | 8 | 32w | 0.898
| 0.872 | 0.752 |
[
model
](
https://paddlemodels.bj.bcebos.com/object_detection/faceboxes_lite.tar
)
|
**NOTES:**
**NOTES:**
-
Get mAP in
`Easy/Medium/Hard Set`
by multi-scale evaluation in
`tools/face_eval.py`
.
-
Get mAP in
`Easy/Medium/Hard Set`
by multi-scale evaluation in
`tools/face_eval.py`
.
...
@@ -140,7 +140,11 @@ For details can refer to [Evaluation](#Evaluate-on-the-FDDB).
...
@@ -140,7 +140,11 @@ For details can refer to [Evaluation](#Evaluate-on-the-FDDB).
## Get Started
## Get Started
`Training`
and
`Inference`
please refer to
[
GETTING_STARTED.md
](
../../docs/GETTING_STARTED.md
)
`Training`
and
`Inference`
please refer to
[
GETTING_STARTED.md
](
../../docs/GETTING_STARTED.md
)
-
**NOTES:**
Currently we do not support evaluation in training.
-
**NOTES:**
-
`BlazeFace`
and
`FaceBoxes`
is trained in 4 GPU with
`batch_size=8`
per gpu (total batch size as 32)
and trained 320000 iters.(If your GPU count is not 4, please refer to the rule of training parameters
in the table of
[
calculation rules
](
../../docs/GETTING_STARTED.md#faq
)
)
-
Currently we do not support evaluation in training.
### Evaluation
### Evaluation
```
```
...
@@ -152,9 +156,13 @@ python tools/face_eval.py -c configs/face_detection/blazeface.yml
...
@@ -152,9 +156,13 @@ python tools/face_eval.py -c configs/face_detection/blazeface.yml
-
`-d`
or
`--dataset_dir`
: Dataset path, same as dataset_dir of configs. Such as:
`-d dataset/wider_face`
.
-
`-d`
or
`--dataset_dir`
: Dataset path, same as dataset_dir of configs. Such as:
`-d dataset/wider_face`
.
-
`-f`
or
`--output_eval`
: Evaluation file directory, default is
`output/pred`
.
-
`-f`
or
`--output_eval`
: Evaluation file directory, default is
`output/pred`
.
-
`-e`
or
`--eval_mode`
: Evaluation mode, include
`widerface`
and
`fddb`
, default is
`widerface`
.
-
`-e`
or
`--eval_mode`
: Evaluation mode, include
`widerface`
and
`fddb`
, default is
`widerface`
.
-
`--multi_scale`
: If you add this action button in the command, it will select
`multi_scale`
evaluation.
Default is
`False`
, it will select
`single-scale`
evaluation.
After the evaluation is completed, the test result in txt format will be generated in
`output/pred`
,
After the evaluation is completed, the test result in txt format will be generated in
`output/pred`
,
and then mAP will be calculated according to different data sets:
and then mAP will be calculated according to different data sets. If you set
`--eval_mode=widerface`
,
it will
[
Evaluate on the WIDER FACE
](
#Evaluate-on-the-WIDER-FACE
)
.If you set
`--eval_mode=fddb`
,
it will
[
Evaluate on the FDDB
](
#Evaluate-on-the-FDDB
)
.
#### Evaluate on the WIDER FACE
#### Evaluate on the WIDER FACE
-
Download the official evaluation script to evaluate the AP metrics:
-
Download the official evaluation script to evaluate the AP metrics:
...
@@ -175,6 +183,7 @@ matlab -nodesktop -nosplash -nojvm -r "run wider_eval.m;quit;"
...
@@ -175,6 +183,7 @@ matlab -nodesktop -nosplash -nojvm -r "run wider_eval.m;quit;"
```
```
#### Evaluate on the FDDB
#### Evaluate on the FDDB
[
FDDB dataset
](
http://vis-www.cs.umass.edu/fddb/
)
details can refer to FDDB's official website.
-
Download the official dataset and evaluation script to evaluate the ROC metrics:
-
Download the official dataset and evaluation script to evaluate the ROC metrics:
```
```
#external link to the Faces in the Wild data set
#external link to the Faces in the Wild data set
...
@@ -229,7 +238,7 @@ regression parameters of a bounding box as a weighted mean between the overlappi
...
@@ -229,7 +238,7 @@ regression parameters of a bounding box as a weighted mean between the overlappi
less network layer and conv channel number than
`Lite`
.
less network layer and conv channel number than
`Lite`
.
### FaceBoxes
### FaceBoxes
**Introduction:**
**Introduction:**
[
FaceBoxes
](
https://arxiv.org/abs/1708.05234
)
which named A CPU Real-time Face Detector
[
FaceBoxes
](
https://arxiv.org/abs/1708.05234
)
which named A CPU Real-time Face Detector
with High Accuracy is face detector proposed by Shifeng Zhang, with high performance on
with High Accuracy is face detector proposed by Shifeng Zhang, with high performance on
both speed and accuracy. This paper is published by IJCB(2017).
both speed and accuracy. This paper is published by IJCB(2017).
...
...
tools/face_eval.py
浏览文件 @
c53882a0
...
@@ -56,7 +56,8 @@ def face_eval_run(exe,
...
@@ -56,7 +56,8 @@ def face_eval_run(exe,
img_root_dir
,
img_root_dir
,
gt_file
,
gt_file
,
pred_dir
=
'output/pred'
,
pred_dir
=
'output/pred'
,
eval_mode
=
'widerface'
):
eval_mode
=
'widerface'
,
multi_scale
=
False
):
# load ground truth files
# load ground truth files
with
open
(
gt_file
,
'r'
)
as
f
:
with
open
(
gt_file
,
'r'
)
as
f
:
gt_lines
=
f
.
readlines
()
gt_lines
=
f
.
readlines
()
...
@@ -76,16 +77,18 @@ def face_eval_run(exe,
...
@@ -76,16 +77,18 @@ def face_eval_run(exe,
if
eval_mode
==
'fddb'
:
if
eval_mode
==
'fddb'
:
image_path
+=
'.jpg'
image_path
+=
'.jpg'
image
=
Image
.
open
(
image_path
).
convert
(
'RGB'
)
image
=
Image
.
open
(
image_path
).
convert
(
'RGB'
)
shrink
,
max_shrink
=
get_shrink
(
image
.
size
[
1
],
image
.
size
[
0
])
if
multi_scale
:
shrink
,
max_shrink
=
get_shrink
(
image
.
size
[
1
],
image
.
size
[
0
])
det0
=
detect_face
(
exe
,
compile_program
,
fetches
,
image
,
shrink
)
det0
=
detect_face
(
exe
,
compile_program
,
fetches
,
image
,
shrink
)
det1
=
flip_test
(
exe
,
compile_program
,
fetches
,
image
,
shrink
)
det1
=
flip_test
(
exe
,
compile_program
,
fetches
,
image
,
shrink
)
[
det2
,
det3
]
=
multi_scale_test
(
exe
,
compile_program
,
fetches
,
image
,
[
det2
,
det3
]
=
multi_scale_test
(
exe
,
compile_program
,
fetches
,
image
,
max_shrink
)
max_shrink
)
det4
=
multi_scale_test_pyramid
(
exe
,
compile_program
,
fetches
,
image
,
det4
=
multi_scale_test_pyramid
(
exe
,
compile_program
,
fetches
,
image
,
max_shrink
)
max_shrink
)
det
=
np
.
row_stack
((
det0
,
det1
,
det2
,
det3
,
det4
))
det
=
np
.
row_stack
((
det0
,
det1
,
det2
,
det3
,
det4
))
dets
=
bbox_vote
(
det
)
dets
=
bbox_vote
(
det
)
else
:
dets
=
detect_face
(
exe
,
compile_program
,
fetches
,
image
,
1
)
if
eval_mode
==
'widerface'
:
if
eval_mode
==
'widerface'
:
save_widerface_bboxes
(
image_path
,
dets
,
pred_dir
)
save_widerface_bboxes
(
image_path
,
dets
,
pred_dir
)
else
:
else
:
...
@@ -261,7 +264,8 @@ def main():
...
@@ -261,7 +264,8 @@ def main():
img_root_dir
,
img_root_dir
,
gt_file
,
gt_file
,
pred_dir
=
pred_dir
,
pred_dir
=
pred_dir
,
eval_mode
=
FLAGS
.
eval_mode
)
eval_mode
=
FLAGS
.
eval_mode
,
multi_scale
=
FLAGS
.
multi_scale
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -285,5 +289,10 @@ if __name__ == '__main__':
...
@@ -285,5 +289,10 @@ if __name__ == '__main__':
type
=
str
,
type
=
str
,
help
=
"Evaluation mode, include `widerface` and `fddb`, default is `widerface`."
help
=
"Evaluation mode, include `widerface` and `fddb`, default is `widerface`."
)
)
parser
.
add_argument
(
"--multi_scale"
,
action
=
'store_true'
,
default
=
False
,
help
=
"If True it will select `multi_scale` evaluation. Default is `False`, it will select `single-scale` evaluation."
)
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
main
()
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录