Skip to content

Commit

Permalink
Merge pull request #2185 from open-mmlab/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tau-J authored Apr 7, 2023
2 parents 31244d0 + 8dd07a7 commit 72c3093
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 106 deletions.
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,36 @@ MMPose v1.0.0 is a major update, including many API and config file changes. Cur
<details close>
<summary><b>Migration Progress</b></summary>

| Algorithm | Status |
| :--- | :---: |
| MTUT (CVPR 2019) | |
| MSPN (ArXiv 2019)| done |
| InterNet (ECCV 2020) | |
| DEKR (CVPR 2021) | done |
| HigherHRNet (CVPR 2020) | |
| DeepPose (CVPR 2014) | done |
| RLE (ICCV 2021) | done |
| SoftWingloss (TIP 2021) | |
| VideoPose3D (CVPR 2019) | |
| Hourglass (ECCV 2016) | done |
| LiteHRNet (CVPR 2021) | done |
| AdaptiveWingloss (ICCV 2019) | done |
| SimpleBaseline2D (ECCV 2018) | done |
| PoseWarper (NeurIPS 2019) | |
| SimpleBaseline3D (ICCV 2017) | |
| HMR (CVPR 2018) | |
| UDP (CVPR 2020) | done |
| VIPNAS (CVPR 2021) | done |
| Wingloss (CVPR 2018) | |
| DarkPose (CVPR 2020) | done |
| Algorithm | Status |
| :-------------------------------- | :---------: |
| MTUT (CVPR 2019) | |
| MSPN (ArXiv 2019) | done |
| InterNet (ECCV 2020) | |
| DEKR (CVPR 2021) | done |
| HigherHRNet (CVPR 2020) | |
| DeepPose (CVPR 2014) | done |
| RLE (ICCV 2021) | done |
| SoftWingloss (TIP 2021) | |
| VideoPose3D (CVPR 2019) | |
| Hourglass (ECCV 2016) | done |
| LiteHRNet (CVPR 2021) | done |
| AdaptiveWingloss (ICCV 2019) | done |
| SimpleBaseline2D (ECCV 2018) | done |
| PoseWarper (NeurIPS 2019) | |
| SimpleBaseline3D (ICCV 2017) | |
| HMR (CVPR 2018) | |
| UDP (CVPR 2020) | done |
| VIPNAS (CVPR 2021) | done |
| Wingloss (CVPR 2018) | |
| DarkPose (CVPR 2020) | done |
| Associative Embedding (NIPS 2017) | in progress |
| VoxelPose (ECCV 2020) | |
| RSN (ECCV 2020) | done |
| CID (CVPR 2022) | done |
| CPM (CVPR 2016) | done |
| HRNet (CVPR 2019) | done |
| HRNetv2 (TPAMI 2019) | done |
| SCNet (CVPR 2020) | done |
| VoxelPose (ECCV 2020) | |
| RSN (ECCV 2020) | done |
| CID (CVPR 2022) | done |
| CPM (CVPR 2016) | done |
| HRNet (CVPR 2019) | done |
| HRNetv2 (TPAMI 2019) | done |
| SCNet (CVPR 2020) | done |

</details>

Expand Down
59 changes: 30 additions & 29 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,40 +128,41 @@ MMPose v1.0.0 是一个重大更新,包括了大量的 API 和配置文件的
<details close>
<summary><b>迁移进度</b></summary>

| 算法名称 | 迁移进度 |
| :--- | :---: |
| MTUT (CVPR 2019) | |
| MSPN (ArXiv 2019)| done |
| InterNet (ECCV 2020) | |
| DEKR (CVPR 2021) | done |
| HigherHRNet (CVPR 2020) | |
| DeepPose (CVPR 2014) | done |
| RLE (ICCV 2021) | done |
| SoftWingloss (TIP 2021) | |
| VideoPose3D (CVPR 2019) | |
| Hourglass (ECCV 2016) | done |
| LiteHRNet (CVPR 2021) | done |
| AdaptiveWingloss (ICCV 2019) | done |
| SimpleBaseline2D (ECCV 2018) | done |
| PoseWarper (NeurIPS 2019) | |
| SimpleBaseline3D (ICCV 2017) | |
| HMR (CVPR 2018) | |
| UDP (CVPR 2020) | done |
| VIPNAS (CVPR 2021) | done |
| Wingloss (CVPR 2018) | |
| DarkPose (CVPR 2020) | done |
| 算法名称 | 迁移进度 |
| :-------------------------------- | :---------: |
| MTUT (CVPR 2019) | |
| MSPN (ArXiv 2019) | done |
| InterNet (ECCV 2020) | |
| DEKR (CVPR 2021) | done |
| HigherHRNet (CVPR 2020) | |
| DeepPose (CVPR 2014) | done |
| RLE (ICCV 2021) | done |
| SoftWingloss (TIP 2021) | |
| VideoPose3D (CVPR 2019) | |
| Hourglass (ECCV 2016) | done |
| LiteHRNet (CVPR 2021) | done |
| AdaptiveWingloss (ICCV 2019) | done |
| SimpleBaseline2D (ECCV 2018) | done |
| PoseWarper (NeurIPS 2019) | |
| SimpleBaseline3D (ICCV 2017) | |
| HMR (CVPR 2018) | |
| UDP (CVPR 2020) | done |
| VIPNAS (CVPR 2021) | done |
| Wingloss (CVPR 2018) | |
| DarkPose (CVPR 2020) | done |
| Associative Embedding (NIPS 2017) | in progress |
| VoxelPose (ECCV 2020) | |
| RSN (ECCV 2020) | done |
| CID (CVPR 2022) | done |
| CPM (CVPR 2016) | done |
| HRNet (CVPR 2019) | done |
| HRNetv2 (TPAMI 2019) | done |
| SCNet (CVPR 2020) | done |
| VoxelPose (ECCV 2020) | |
| RSN (ECCV 2020) | done |
| CID (CVPR 2022) | done |
| CPM (CVPR 2016) | done |
| HRNet (CVPR 2019) | done |
| HRNetv2 (TPAMI 2019) | done |
| SCNet (CVPR 2020) | done |

</details>

如果您使用的算法还没有完成迁移,您也可以继续使用访问 [0.x 分支](https://github.com/open-mmlab/mmpose/tree/0.x)[旧版文档](https://mmpose.readthedocs.io/zh_CN/0.x/)

## 安装

关于安装的详细说明请参考[安装文档](https://mmpose.readthedocs.io/zh_CN/latest/installation.html)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ Results on COCO val2017 with detector having human AP of 56.4 on COCO val2017 da
| Arch | Input Size | AP | AP<sup>50</sup> | AP<sup>75</sup> | AR | AR<sup>50</sup> | ckpt | log |
| :-------------------------------------------- | :--------: | :---: | :-------------: | :-------------: | :---: | :-------------: | :-------------------------------------------: | :-------------------------------------------: |
| [ViTPose-S](/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-small-simple_8xb64-210e_coco-256x192.py) | 256x192 | 0.736 | 0.900 | 0.811 | 0.790 | 0.940 | [ckpt](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-small-simple_8xb64-210e_coco-256x192-4c101a76_20230314.pth) | [log](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-small-simple_8xb64-210e_coco-256x192-4c101a76_20230314.json) |
| [ViTPose-B](/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192.py) | 256x192 | 0.756 | 0.906 | 0.826 | 0.809 | 0.946 | [ckpt](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192-fd73707d_20230314.pth) | [log](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192-fd73707d_20230314.json) |
| [ViTPose-B](/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192.py) | 256x192 | 0.756 | 0.906 | 0.826 | 0.809 | 0.946 | [ckpt](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192-0b8234ea_20230407.pth) | [log](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192-0b8234ea_20230407.json) |
| [ViTPose-L](/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-large-simple_8xb64-210e_coco-256x192.py) | 256x192 | 0.781 | 0.914 | 0.853 | 0.833 | 0.952 | [ckpt](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-large-simple_8xb64-210e_coco-256x192-3a7ee9e1_20230314.pth) | [log](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-large-simple_8xb64-210e_coco-256x192-3a7ee9e1_20230314.json) |
| [ViTPose-H](/configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-huge-simple_8xb64-210e_coco-256x192.py) | 256x192 | 0.789 | 0.916 | 0.856 | 0.839 | 0.953 | [ckpt](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-huge-simple_8xb64-210e_coco-256x192-ffd48c05_20230314.pth) | [log](https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-huge-simple_8xb64-210e_coco-256x192-ffd48c05_20230314.json) |
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Models:
AR: 0.809
AR@0.5: 0.946
Task: Body 2D Keypoint
Weights: https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192-fd73707d_20230314.pth
Weights: https://download.openmmlab.com/mmpose/v1/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-base-simple_8xb64-210e_coco-256x192-0b8234ea_20230407.pth
- Config: configs/body_2d_keypoint/topdown_heatmap/coco/td-hm_ViTPose-large-simple_8xb64-210e_coco-256x192.py
In Collection: ViTPose
Alias: vitpose-l
Expand Down
31 changes: 16 additions & 15 deletions mmpose/datasets/datasets/base/base_coco_style_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import numpy as np
from mmengine.dataset import BaseDataset, force_full_init
from mmengine.fileio import load
from mmengine.utils import check_file_exist, is_list_of
from mmengine.fileio import exists, get_local_path, load
from mmengine.utils import is_list_of
from xtcocotools.coco import COCO

from mmpose.registry import DATASETS
Expand Down Expand Up @@ -195,18 +195,19 @@ def load_data_list(self) -> List[dict]:
def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
"""Load data from annotations in COCO format."""

check_file_exist(self.ann_file)
assert exists(self.ann_file), 'Annotation file does not exist'

coco = COCO(self.ann_file)
with get_local_path(self.ann_file) as local_path:
self.coco = COCO(local_path)
# set the metainfo about categories, which is a list of dict
# and each dict contains the 'id', 'name', etc. about this category
self._metainfo['CLASSES'] = coco.loadCats(coco.getCatIds())
self._metainfo['CLASSES'] = self.coco.loadCats(self.coco.getCatIds())

instance_list = []
image_list = []

for img_id in coco.getImgIds():
img = coco.loadImgs(img_id)[0]
for img_id in self.coco.getImgIds():
img = self.coco.loadImgs(img_id)[0]
img.update({
'img_id':
img_id,
Expand All @@ -215,8 +216,8 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
})
image_list.append(img)

ann_ids = coco.getAnnIds(imgIds=img_id)
for ann in coco.loadAnns(ann_ids):
ann_ids = self.coco.getAnnIds(imgIds=img_id)
for ann in self.coco.loadAnns(ann_ids):

instance_info = self.parse_data_info(
dict(raw_ann_info=ann, raw_img_info=img))
Expand Down Expand Up @@ -380,18 +381,18 @@ def _get_bottomup_data_infos(self, instance_list: List[Dict],
def _load_detection_results(self) -> List[dict]:
"""Load data from detection results with dummy keypoint annotations."""

check_file_exist(self.ann_file)
check_file_exist(self.bbox_file)

assert exists(self.ann_file), 'Annotation file does not exist'
assert exists(self.bbox_file), 'Bbox file does not exist'
# load detection results
det_results = load(self.bbox_file)
assert is_list_of(det_results, dict)

# load coco annotations to build image id-to-name index
coco = COCO(self.ann_file)
with get_local_path(self.ann_file) as local_path:
self.coco = COCO(local_path)
# set the metainfo about categories, which is a list of dict
# and each dict contains the 'id', 'name', etc. about this category
self._metainfo['CLASSES'] = coco.loadCats(coco.getCatIds())
self._metainfo['CLASSES'] = self.coco.loadCats(self.coco.getCatIds())

num_keypoints = self.metainfo['num_keypoints']
data_list = []
Expand All @@ -401,7 +402,7 @@ def _load_detection_results(self) -> List[dict]:
if det['category_id'] != 1:
continue

img = coco.loadImgs(det['image_id'])[0]
img = self.coco.loadImgs(det['image_id'])[0]

img_path = osp.join(self.data_prefix['img'], img['file_name'])
bbox_xywh = np.array(
Expand Down
18 changes: 10 additions & 8 deletions mmpose/datasets/datasets/body/mpii_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Callable, List, Optional, Sequence, Tuple, Union

import numpy as np
from mmengine.utils import check_file_exist
from mmengine.fileio import exists, get_local_path
from scipy.io import loadmat

from mmpose.registry import DATASETS
Expand Down Expand Up @@ -137,14 +137,16 @@ def __init__(self,
def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
"""Load data from annotations in MPII format."""

check_file_exist(self.ann_file)
with open(self.ann_file) as anno_file:
anns = json.load(anno_file)
assert exists(self.ann_file), 'Annotation file does not exist'
with get_local_path(self.ann_file) as local_path:
with open(local_path) as anno_file:
self.anns = json.load(anno_file)

if self.headbox_file:
check_file_exist(self.headbox_file)
headbox_dict = loadmat(self.headbox_file)
headboxes_src = np.transpose(headbox_dict['headboxes_src'],
assert exists(self.headbox_file), 'Headbox file does not exist'
with get_local_path(self.headbox_file) as local_path:
self.headbox_dict = loadmat(local_path)
headboxes_src = np.transpose(self.headbox_dict['headboxes_src'],
[2, 0, 1])
SC_BIAS = 0.6

Expand All @@ -156,7 +158,7 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
# mpii bbox scales are normalized with factor 200.
pixel_std = 200.

for idx, ann in enumerate(anns):
for idx, ann in enumerate(self.anns):
center = np.array(ann['center'], dtype=np.float32)
scale = np.array([ann['scale'], ann['scale']],
dtype=np.float32) * pixel_std
Expand Down
13 changes: 7 additions & 6 deletions mmpose/datasets/datasets/body/mpii_trb_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import List, Tuple

import numpy as np
from mmengine.utils import check_file_exist
from mmengine.fileio import exists, get_local_path

from mmpose.registry import DATASETS
from mmpose.structures.bbox import bbox_cs2xyxy
Expand Down Expand Up @@ -106,11 +106,12 @@ class MpiiTrbDataset(BaseCocoStyleDataset):
def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
"""Load data from annotations in MPII-TRB format."""

check_file_exist(self.ann_file)
with open(self.ann_file) as anno_file:
data = json.load(anno_file)
assert exists(self.ann_file), 'Annotation file does not exist'
with get_local_path(self.ann_file) as local_path:
with open(local_path) as anno_file:
self.data = json.load(anno_file)

imgid2info = {img['id']: img for img in data['images']}
imgid2info = {img['id']: img for img in self.data['images']}

instance_list = []
image_list = []
Expand All @@ -119,7 +120,7 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
# mpii-trb bbox scales are normalized with factor 200.
pixel_std = 200.

for ann in data['annotations']:
for ann in self.data['annotations']:
img_id = ann['image_id']

# center, scale in shape [1, 2] and bbox in [1, 4]
Expand Down
16 changes: 8 additions & 8 deletions mmpose/datasets/datasets/body/posetrack18_video_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Callable, List, Optional, Sequence, Union

import numpy as np
from mmengine.fileio import load
from mmengine.utils import check_file_exist, is_list_of
from mmengine.fileio import exists, get_local_path, load
from mmengine.utils import is_list_of
from xtcocotools.coco import COCO

from mmpose.registry import DATASETS
Expand Down Expand Up @@ -287,22 +287,22 @@ def parse_data_info(self, raw_data_info: dict) -> Optional[dict]:

def _load_detection_results(self) -> List[dict]:
"""Load data from detection results with dummy keypoint annotations."""

check_file_exist(self.ann_file)
check_file_exist(self.bbox_file)
assert exists(self.ann_file), 'Annotation file does not exist'
assert exists(self.bbox_file), 'Bbox file does not exist'

# load detection results
det_results = load(self.bbox_file)
assert is_list_of(det_results, dict)

# load coco annotations to build image id-to-name index
coco = COCO(self.ann_file)
with get_local_path(self.ann_file) as local_path:
self.coco = COCO(local_path)

# mapping image name to id
name2id = {}
# mapping image id to name
id2name = {}
for img_id, image in coco.imgs.items():
for img_id, image in self.coco.imgs.items():
file_name = image['file_name']
id2name[img_id] = file_name
name2id[file_name] = img_id
Expand Down Expand Up @@ -333,7 +333,7 @@ def _load_detection_results(self) -> List[dict]:
img_id = name2id[det['image_name']]
else:
img_id = det['image_id']
img_ann = coco.loadImgs(img_id)[0]
img_ann = self.coco.loadImgs(img_id)[0]
nframes = int(img_ann['nframes'])

# deal with multiple image paths
Expand Down
15 changes: 8 additions & 7 deletions mmpose/datasets/datasets/hand/coco_wholebody_hand_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import List, Tuple

import numpy as np
from mmengine.utils import check_file_exist
from mmengine.fileio import exists, get_local_path
from xtcocotools.coco import COCO

from mmpose.registry import DATASETS
Expand Down Expand Up @@ -87,15 +87,16 @@ class CocoWholeBodyHandDataset(BaseCocoStyleDataset):
def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
"""Load data from annotations in COCO format."""

check_file_exist(self.ann_file)
assert exists(self.ann_file), 'Annotation file does not exist'

coco = COCO(self.ann_file)
with get_local_path(self.ann_file) as local_path:
self.coco = COCO(local_path)
instance_list = []
image_list = []
id = 0

for img_id in coco.getImgIds():
img = coco.loadImgs(img_id)[0]
for img_id in self.coco.getImgIds():
img = self.coco.loadImgs(img_id)[0]

img.update({
'img_id':
Expand All @@ -105,8 +106,8 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
})
image_list.append(img)

ann_ids = coco.getAnnIds(imgIds=img_id, iscrowd=False)
anns = coco.loadAnns(ann_ids)
ann_ids = self.coco.getAnnIds(imgIds=img_id, iscrowd=False)
anns = self.coco.loadAnns(ann_ids)
for ann in anns:
for type in ['left', 'right']:
# filter invalid hand annotations, there might be two
Expand Down
Loading

0 comments on commit 72c3093

Please sign in to comment.