Skip to content

Add script to evaluate face detection by WIDERFace #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions models/face_detection_yunet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Notes:
- For details on training this model, please visit https://github.com/ShiqiYu/libfacedetection.train.
- This ONNX model has fixed input shape, but OpenCV DNN infers on the exact shape of input image. See https://github.com/opencv/opencv_zoo/issues/44 for more information.

Results of accuracy evaluation with [tools/eval](../../tools/eval).

| Models | Easy AP | Medium AP | Hard AP |
|-------------|---------|-----------|---------|
| YuNet | 0.8498 | 0.8384 | 0.7357 |
| YuNet quant | 0.7751 | 0.8145 | 0.7312 |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium AP is much higher than Easy AP for YuNet quant?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WanliZhong You can doublecheck with the offcial eval tools of WiderFace

Copy link
Member Author

@WanliZhong WanliZhong Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of the original script is also the same.
image


\*: 'quant' stands for 'quantized'.

## Demo

Run the following command to try the demo:
Expand Down
43 changes: 42 additions & 1 deletion tools/eval/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Make sure you have the following packages installed:

```shell
pip install tqdm
pip install scipy
```

Generally speaking, evaluation can be done with the following command:
Expand All @@ -13,7 +14,8 @@ python eval.py -m model_name -d dataset_name -dr dataset_root_dir
```

Supported datasets:
- [ImageNet](./datasets/imagenet.py)
- [ImageNet](#imagenet)
- [WIDERFace](#widerface)

## ImageNet

Expand Down Expand Up @@ -53,3 +55,42 @@ Run evaluation with the following command:
python eval.py -m mobilenet -d imagenet -dr /path/to/imagenet
```

## WIDERFace

The script is modified based on [WiderFace-Evaluation](https://github.com/wondervictor/WiderFace-Evaluation).

### Prepare data

Please visit http://shuoyang1213.me/WIDERFACE to download the WIDERFace dataset [Validation Images](https://huggingface.co/datasets/wider_face/resolve/main/data/WIDER_val.zip), [Face annotations](http://shuoyang1213.me/WIDERFACE/support/bbx_annotation/wider_face_split.zip) and [eval_tools](http://shuoyang1213.me/WIDERFACE/support/eval_script/eval_tools.zip). Organize files as follow:

```shell
$ tree -L 2 /path/to/widerface
.
├── eval_tools
│   ├── boxoverlap.m
│   ├── evaluation.m
│   ├── ground_truth
│   ├── nms.m
│   ├── norm_score.m
│   ├── plot
│   ├── read_pred.m
│   └── wider_eval.m
├── wider_face_split
│   ├── readme.txt
│   ├── wider_face_test_filelist.txt
│   ├── wider_face_test.mat
│   ├── wider_face_train_bbx_gt.txt
│   ├── wider_face_train.mat
│   ├── wider_face_val_bbx_gt.txt
│   └── wider_face_val.mat
└── WIDER_val
└── images
```

### Evaluation

Run evaluation with the following command:

```shell
python eval.py -m yunet -d widerface -dr /path/to/widerface
```
2 changes: 2 additions & 0 deletions tools/eval/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .imagenet import ImageNet
from .widerface import WIDERFace

class Registery:
def __init__(self, name):
Expand All @@ -13,3 +14,4 @@ def register(self, item):

DATASETS = Registery("Datasets")
DATASETS.register(ImageNet)
DATASETS.register(WIDERFace)
Loading