Skip to content

Commit

Permalink
[Feature] Support New config type (open-mmlab#2463)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tau-J authored Jun 19, 2023
1 parent 6d9d05e commit a912a39
Show file tree
Hide file tree
Showing 35 changed files with 1,133 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ https://user-images.githubusercontent.com/15977946/124654387-0fd3c500-ded1-11eb-

## What's New

- We are excited to release **YOLOX-Pose**, a One-Stage multi-person pose estimation model based on YOLOX. Checkout our [project page](/projects/yolox-pose/) for more details.
- We are excited to release **YOLOX-Pose**, a One-Stage multi-person pose estimation model based on YOLOX. Checkout our [project page](/projects/yolox_pose/) for more details.

![yolox-pose_intro](https://user-images.githubusercontent.com/26127467/226655503-3cee746e-6e42-40be-82ae-6e7cae2a4c7e.jpg)

Expand All @@ -108,15 +108,15 @@ https://user-images.githubusercontent.com/15977946/124654387-0fd3c500-ded1-11eb-
- Build individual projects with full power of MMPose but not bound up with heavy frameworks
- Checkout new projects:
- [RTMPose](/projects/rtmpose/)
- [YOLOX-Pose](/projects/yolox-pose/)
- [YOLOX-Pose](/projects/yolox_pose/)
- [MMPose4AIGC](/projects/mmpose4aigc/)
- Become a contributors and make MMPose greater. Start your journey from the [example project](/projects/example_project/)

<br/>

- 2022-04-06: MMPose [v1.0.0](https://github.com/open-mmlab/mmpose/releases/tag/v1.0.0) is officially released, with the main updates including:

- Release of [YOLOX-Pose](/projects/yolox-pose/), a One-Stage multi-person pose estimation model based on YOLOX
- Release of [YOLOX-Pose](/projects/yolox_pose/), a One-Stage multi-person pose estimation model based on YOLOX
- Development of [MMPose for AIGC](/projects/mmpose4aigc/) based on RTMPose, generating high-quality skeleton images for Pose-guided AIGC projects
- Support for OpenPose-style skeleton visualization
- More complete and user-friendly [documentation and tutorials](https://mmpose.readthedocs.io/en/latest/overview.html)
Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ https://user-images.githubusercontent.com/15977946/124654387-0fd3c500-ded1-11eb-
- 通过独立项目的形式,利用 MMPose 的强大功能,同时不被代码框架所束缚
- 最新添加的项目包括:
- [RTMPose](/projects/rtmpose/)
- [YOLOX-Pose](/projects/yolox-pose/)
- [YOLOX-Pose](/projects/yolox_pose/)
- [MMPose4AIGC](/projects/mmpose4aigc/)
- 从简单的 [示例项目](/projects/example_project/) 开启您的 MMPose 代码贡献者之旅吧,让我们共同打造更好用的 MMPose!

<br/>

- 2022-04-06:MMPose [v1.0.0](https://github.com/open-mmlab/mmpose/releases/tag/v1.0.0) 正式发布了,主要更新包括:

- 发布了 [YOLOX-Pose](/projects/yolox-pose/),一个基于 YOLOX 的 One-Stage 多人姿态估计模型
- 发布了 [YOLOX-Pose](/projects/yolox_pose/),一个基于 YOLOX 的 One-Stage 多人姿态估计模型
- 基于 RTMPose 开发的 [MMPose for AIGC](/projects/mmpose4aigc/),生成高质量骨架图片用于 Pose-guided AIGC 项目
- 支持 OpenPose 风格的骨架可视化
- 更加完善、友好的 [文档和教程](https://mmpose.readthedocs.io/zh_CN/latest/overview.html)
Expand Down
14 changes: 13 additions & 1 deletion demo/MMPose_Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "8xX3YewOtqV0"
Expand All @@ -28,6 +29,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "bkw-kUD8t3t8"
Expand Down Expand Up @@ -611,6 +613,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "r2bf94XpyFnk"
Expand Down Expand Up @@ -743,7 +746,9 @@
" \"\"\"Visualize predicted keypoints (and heatmaps) of one image.\"\"\"\n",
"\n",
" # predict bbox\n",
" init_default_scope(detector.cfg.get('default_scope', 'mmdet'))\n",
" scope = detector.cfg.get('default_scope', 'mmdet')\n",
" if scope is not None:\n",
" init_default_scope(scope)\n",
" detect_result = inference_detector(detector, img_path)\n",
" pred_instance = detect_result.pred_instances.cpu().numpy()\n",
" bboxes = np.concatenate(\n",
Expand Down Expand Up @@ -854,6 +859,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "42HG6DSNI0Ke"
Expand Down Expand Up @@ -1089,6 +1095,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "H-dMbjgnJzbH"
Expand All @@ -1100,6 +1107,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "jCu4npV2rl_Q"
Expand Down Expand Up @@ -1195,6 +1203,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "UmGitQZkUnom"
Expand Down Expand Up @@ -1495,6 +1504,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "UlD8iDZehE2S"
Expand Down Expand Up @@ -1655,6 +1665,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "ChVqB1oYncmo"
Expand Down Expand Up @@ -3533,6 +3544,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "sdLwcaojhE2T"
Expand Down
8 changes: 6 additions & 2 deletions mmpose/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def init_model(config: Union[str, Path, Config],
config.model.train_cfg = None

# register all modules in mmpose into the registries
init_default_scope(config.get('default_scope', 'mmpose'))
scope = config.get('default_scope', 'mmpose')
if scope is not None:
init_default_scope(scope)

model = build_pose_estimator(config.model)
model = revert_sync_batchnorm(model)
Expand Down Expand Up @@ -149,7 +151,9 @@ def inference_topdown(model: nn.Module,
``data_sample.pred_instances.keypoints`` and
``data_sample.pred_instances.keypoint_scores``.
"""
init_default_scope(model.cfg.get('default_scope', 'mmpose'))
scope = model.cfg.get('default_scope', 'mmpose')
if scope is not None:
init_default_scope(scope)
pipeline = Compose(model.cfg.test_dataloader.dataset.pipeline)

if bboxes is None:
Expand Down
4 changes: 3 additions & 1 deletion mmpose/apis/inferencers/base_mmpose_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ def _init_pipeline(self, cfg: ConfigType) -> Callable:
``np.ndarray``. The returned pipeline will be used to process
a single data.
"""
init_default_scope(cfg.get('default_scope', 'mmpose'))
scope = cfg.get('default_scope', 'mmpose')
if scope is not None:
init_default_scope(scope)
return Compose(cfg.test_dataloader.dataset.pipeline)

def update_model_visualizer_settings(self, **kwargs):
Expand Down
54 changes: 54 additions & 0 deletions mmpose/configs/_base_/default_runtime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) OpenMMLab. All rights reserved.
from mmengine.hooks import (CheckpointHook, DistSamplerSeedHook, IterTimerHook,
LoggerHook, ParamSchedulerHook, SyncBuffersHook)
from mmengine.runner import LogProcessor
from mmengine.visualization import LocalVisBackend

from mmpose.engine.hooks import PoseVisualizationHook
from mmpose.visualization import PoseLocalVisualizer

default_scope = None

# hooks
default_hooks = dict(
timer=dict(type=IterTimerHook),
logger=dict(type=LoggerHook, interval=50),
param_scheduler=dict(type=ParamSchedulerHook),
checkpoint=dict(type=CheckpointHook, interval=10),
sampler_seed=dict(type=DistSamplerSeedHook),
visualization=dict(type=PoseVisualizationHook, enable=False),
)

# custom hooks
custom_hooks = [
# Synchronize model buffers such as running_mean and running_var in BN
# at the end of each epoch
dict(type=SyncBuffersHook)
]

# multi-processing backend
env_cfg = dict(
cudnn_benchmark=False,
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
dist_cfg=dict(backend='nccl'),
)

# visualizer
vis_backends = [dict(type=LocalVisBackend)]
visualizer = dict(
type=PoseLocalVisualizer, vis_backends=vis_backends, name='visualizer')

# logger
log_processor = dict(
type=LogProcessor, window_size=50, by_epoch=True, num_digits=6)
log_level = 'INFO'
load_from = None
resume = False

# file I/O backend
backend_args = dict(backend='local')

# training/validation/testing progress
train_cfg = dict(by_epoch=True)
val_cfg = dict()
test_cfg = dict()
Loading

0 comments on commit a912a39

Please sign in to comment.