Skip to content

Commit

Permalink
add 300wlp
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang-Changhui committed Sep 22, 2023
1 parent 3eb49e2 commit a5da393
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 153 deletions.
134 changes: 0 additions & 134 deletions configs/_base_/datasets/300w_LP.py

This file was deleted.

86 changes: 86 additions & 0 deletions configs/_base_/datasets/300wlp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
dataset_info = dict(
dataset_name='300wlp',
paper_info=dict(
author='Xiangyu Zhu1, and Zhen Lei1 '
'and Xiaoming Liu2, and Hailin Shi1 '
'and Stan Z. Li1',
title='300 faces in-the-wild challenge: '
'Database and results',
container='Image and vision computing',
year='2016',
homepage='http://www.cbsr.ia.ac.cn/users/xiangyuzhu/'
'projects/3DDFA/main.htm',
),
keypoint_info={
0: dict(name='kpt-0', id=0, color=[255, 0, 0], type='', swap=''),
1: dict(name='kpt-1', id=1, color=[255, 0, 0], type='', swap=''),
2: dict(name='kpt-2', id=2, color=[255, 0, 0], type='', swap=''),
3: dict(name='kpt-3', id=3, color=[255, 0, 0], type='', swap=''),
4: dict(name='kpt-4', id=4, color=[255, 0, 0], type='', swap=''),
5: dict(name='kpt-5', id=5, color=[255, 0, 0], type='', swap=''),
6: dict(name='kpt-6', id=6, color=[255, 0, 0], type='', swap=''),
7: dict(name='kpt-7', id=7, color=[255, 0, 0], type='', swap=''),
8: dict(name='kpt-8', id=8, color=[255, 0, 0], type='', swap=''),
9: dict(name='kpt-9', id=9, color=[255, 0, 0], type='', swap=''),
10: dict(name='kpt-10', id=10, color=[255, 0, 0], type='', swap=''),
11: dict(name='kpt-11', id=11, color=[255, 0, 0], type='', swap=''),
12: dict(name='kpt-12', id=12, color=[255, 0, 0], type='', swap=''),
13: dict(name='kpt-13', id=13, color=[255, 0, 0], type='', swap=''),
14: dict(name='kpt-14', id=14, color=[255, 0, 0], type='', swap=''),
15: dict(name='kpt-15', id=15, color=[255, 0, 0], type='', swap=''),
16: dict(name='kpt-16', id=16, color=[255, 0, 0], type='', swap=''),
17: dict(name='kpt-17', id=17, color=[255, 0, 0], type='', swap=''),
18: dict(name='kpt-18', id=18, color=[255, 0, 0], type='', swap=''),
19: dict(name='kpt-19', id=19, color=[255, 0, 0], type='', swap=''),
20: dict(name='kpt-20', id=20, color=[255, 0, 0], type='', swap=''),
21: dict(name='kpt-21', id=21, color=[255, 0, 0], type='', swap=''),
22: dict(name='kpt-22', id=22, color=[255, 0, 0], type='', swap=''),
23: dict(name='kpt-23', id=23, color=[255, 0, 0], type='', swap=''),
24: dict(name='kpt-24', id=24, color=[255, 0, 0], type='', swap=''),
25: dict(name='kpt-25', id=25, color=[255, 0, 0], type='', swap=''),
26: dict(name='kpt-26', id=26, color=[255, 0, 0], type='', swap=''),
27: dict(name='kpt-27', id=27, color=[255, 0, 0], type='', swap=''),
28: dict(name='kpt-28', id=28, color=[255, 0, 0], type='', swap=''),
29: dict(name='kpt-29', id=29, color=[255, 0, 0], type='', swap=''),
30: dict(name='kpt-30', id=30, color=[255, 0, 0], type='', swap=''),
31: dict(name='kpt-31', id=31, color=[255, 0, 0], type='', swap=''),
32: dict(name='kpt-32', id=32, color=[255, 0, 0], type='', swap=''),
33: dict(name='kpt-33', id=33, color=[255, 0, 0], type='', swap=''),
34: dict(name='kpt-34', id=34, color=[255, 0, 0], type='', swap=''),
35: dict(name='kpt-35', id=35, color=[255, 0, 0], type='', swap=''),
36: dict(name='kpt-36', id=36, color=[255, 0, 0], type='', swap=''),
37: dict(name='kpt-37', id=37, color=[255, 0, 0], type='', swap=''),
38: dict(name='kpt-38', id=38, color=[255, 0, 0], type='', swap=''),
39: dict(name='kpt-39', id=39, color=[255, 0, 0], type='', swap=''),
40: dict(name='kpt-40', id=40, color=[255, 0, 0], type='', swap=''),
41: dict(name='kpt-41', id=41, color=[255, 0, 0], type='', swap=''),
42: dict(name='kpt-42', id=42, color=[255, 0, 0], type='', swap=''),
43: dict(name='kpt-43', id=43, color=[255, 0, 0], type='', swap=''),
44: dict(name='kpt-44', id=44, color=[255, 0, 0], type='', swap=''),
45: dict(name='kpt-45', id=45, color=[255, 0, 0], type='', swap=''),
46: dict(name='kpt-46', id=46, color=[255, 0, 0], type='', swap=''),
47: dict(name='kpt-47', id=47, color=[255, 0, 0], type='', swap=''),
48: dict(name='kpt-48', id=48, color=[255, 0, 0], type='', swap=''),
49: dict(name='kpt-49', id=49, color=[255, 0, 0], type='', swap=''),
50: dict(name='kpt-50', id=50, color=[255, 0, 0], type='', swap=''),
51: dict(name='kpt-51', id=51, color=[255, 0, 0], type='', swap=''),
52: dict(name='kpt-52', id=52, color=[255, 0, 0], type='', swap=''),
53: dict(name='kpt-53', id=53, color=[255, 0, 0], type='', swap=''),
54: dict(name='kpt-54', id=54, color=[255, 0, 0], type='', swap=''),
55: dict(name='kpt-55', id=55, color=[255, 0, 0], type='', swap=''),
56: dict(name='kpt-56', id=56, color=[255, 0, 0], type='', swap=''),
57: dict(name='kpt-57', id=57, color=[255, 0, 0], type='', swap=''),
58: dict(name='kpt-58', id=58, color=[255, 0, 0], type='', swap=''),
59: dict(name='kpt-59', id=59, color=[255, 0, 0], type='', swap=''),
60: dict(name='kpt-60', id=60, color=[255, 0, 0], type='', swap=''),
61: dict(name='kpt-61', id=61, color=[255, 0, 0], type='', swap=''),
62: dict(name='kpt-62', id=62, color=[255, 0, 0], type='', swap=''),
63: dict(name='kpt-63', id=63, color=[255, 0, 0], type='', swap=''),
64: dict(name='kpt-64', id=64, color=[255, 0, 0], type='', swap=''),
65: dict(name='kpt-65', id=65, color=[255, 0, 0], type='', swap=''),
66: dict(name='kpt-66', id=66, color=[255, 0, 0], type='', swap=''),
67: dict(name='kpt-67', id=67, color=[255, 0, 0], type='', swap=''),
},
skeleton_info={},
joint_weights=[1.] * 68,
sigmas=[])
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<details>
<summary align="right"><a href="http://www.cbsr.ia.ac.cn/users/xiangyuzhu/projects/3DDFA/main.htm">300WLP (IEEE'2017)</a></summary>


```bibtex
@article{zhu2017face,
title={Face alignment in full pose range: A 3d total solution},
Expand All @@ -38,7 +37,6 @@ Results on 300W-LP dataset

The model is trained on 300W-LP train.

| Arch | Input Size | NME<sub>*full*</sub> | NME<sub>*test*</sub> | ckpt | log |
| :----------------------------------------------------------- | :--------: | :------------------: | :------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| Arch | Input Size | NME<sub>*full*</sub> | NME<sub>*test*</sub> | ckpt | log |
| :------------------------------------------------- | :--------: | :------------------: | :------------------: | :------------------------------------------------: | :------------------------------------------------: |
| [pose_hrnetv2_w18](/configs/face_2d_keypoint/topdown_heatmap/300wlp/td-hm_hrnetv2-w18_8xb64-60e_300wlp-256x256.py) | 256x256 | 0.0413 | 0.04125 | [ckpt](https://download.openmmlab.com/mmpose/v1/face_2d_keypoint/topdown_heatmap/300wlp/hrnetv2_w18_300wlp_256x256-fb433d21_20230922.pth) | [log](https://download.openmmlab.com/mmpose/v1/face_2d_keypoint/topdown_heatmap/300wlp/hrnetv2_w18_300wlp_256x256-fb433d21_20230922.json) |

3 changes: 2 additions & 1 deletion mmpose/datasets/datasets/face/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from .coco_wholebody_face_dataset import CocoWholeBodyFaceDataset
from .cofw_dataset import COFWDataset
from .face_300w_dataset import Face300WDataset
from .face_300wlp_dataset import Face300WLPDataset
from .lapa_dataset import LapaDataset
from .wflw_dataset import WFLWDataset
from .face_300wlp_dataset import Face300WLPDataset

__all__ = [
'Face300WDataset', 'WFLWDataset', 'AFLWDataset', 'COFWDataset',
'CocoWholeBodyFaceDataset', 'LapaDataset', 'Face300WLPDataset'
Expand Down
8 changes: 1 addition & 7 deletions mmpose/datasets/datasets/face/face_300wlp_dataset.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from typing import Optional

import numpy as np

from mmpose.registry import DATASETS
from mmpose.structures.bbox import bbox_cs2xyxy
from ..base import BaseCocoStyleDataset


Expand Down Expand Up @@ -57,5 +52,4 @@ class Face300WLPDataset(BaseCocoStyleDataset):
image. Default: 1000.
"""

METAINFO: dict = dict(from_file='configs/_base_/datasets/300w_LP.py')

METAINFO: dict = dict(from_file='configs/_base_/datasets/300wlp.py')
2 changes: 1 addition & 1 deletion projects/just_dance/configs/_base_
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase

import numpy as np

from mmpose.datasets.datasets.face import Face300WLPDataset
Expand Down Expand Up @@ -136,5 +137,3 @@ def test_exceptions_and_warnings(self):
data_mode='bottomup',
test_mode=True,
filter_cfg=dict(bbox_score_thr=0.3))


16 changes: 12 additions & 4 deletions tools/dataset_converters/300wlp2coco.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) OpenMMLab. All rights reserved.
import json
import os
import os.path as osp
Expand Down Expand Up @@ -27,8 +28,13 @@ def move_img(img_path, save_img):


# split 300w-lp data
def split_data(file_img, train_path, val_path,
test_path, shuffle=True, ratio1=0.8, ratio2=0.1):
def split_data(file_img,
train_path,
val_path,
test_path,
shuffle=True,
ratio1=0.8,
ratio2=0.1):
img_list = os.listdir(file_img)
if shuffle:
np.random.shuffle(img_list)
Expand Down Expand Up @@ -140,7 +146,7 @@ def convert_300WLP_to_coco(root_path, img_pathDir, out_file):
print(f'done {out_file}')


if __name__ == "__main__":
if __name__ == '__main__':
# 1.Move all images to one folder
# 2.split 300W-LP data
# 3.convert json
Expand All @@ -160,4 +166,6 @@ def convert_300WLP_to_coco(root_path, img_pathDir, out_file):
os.makedirs(anno_path_json)
for tv in ['val', 'test', 'train']:
print(f'processing {tv}')
convert_300WLP_to_coco(root_path, tv, anno_path_json + '/' + f'face_landmarks_300wlp_{tv}.json')
convert_300WLP_to_coco(
root_path, tv,
anno_path_json + '/' + f'face_landmarks_300wlp_{tv}.json')

0 comments on commit a5da393

Please sign in to comment.