├── src
├── nodes
│ ├── newyear_node.py
│ ├── __init__.py
│ ├── hat_effect_node.py
│ └── firecracker_effect_node.py
└── __init__.py
├── model_configs
└── mmpose
│ ├── _base_
│ ├── filters
│ │ ├── gaussian.py
│ │ ├── one_euro.py
│ │ ├── savizky_golay.py
│ │ ├── smoothnet_t8_h36m.py
│ │ ├── smoothnet_t16_h36m.py
│ │ ├── smoothnet_t32_h36m.py
│ │ ├── smoothnet_t64_h36m.py
│ │ └── smoothnet_h36m.md
│ ├── default_runtime.py
│ └── datasets
│ │ ├── deepfashion_lower.py
│ │ ├── deepfashion_upper.py
│ │ ├── deepfashion_full.py
│ │ ├── zebra.py
│ │ ├── aflw.py
│ │ ├── cofw.py
│ │ ├── jhmdb.py
│ │ ├── atrw.py
│ │ ├── mpi_inf_3dhp.py
│ │ ├── campus.py
│ │ ├── shelf.py
│ │ ├── crowdpose.py
│ │ ├── aic.py
│ │ ├── ap10k.py
│ │ ├── h36m.py
│ │ ├── mpii.py
│ │ ├── mhp.py
│ │ ├── interhand2d.py
│ │ ├── onehand10k.py
│ │ ├── panoptic_body3d.py
│ │ ├── panoptic_hand2d.py
│ │ ├── freihand2d.py
│ │ ├── posetrack18.py
│ │ ├── ochuman.py
│ │ ├── animalpose.py
│ │ ├── macaque.py
│ │ ├── rhd2d.py
│ │ ├── horse10.py
│ │ └── fly.py
│ ├── vipnas_mbv3_coco_wholebody_256x192_dark.py
│ └── hrnet_w32_animalpose_256x256.py
├── configs
└── examples
│ ├── pose_estimation
│ ├── test_camera.py
│ ├── pose_tracking.py
│ ├── webcam_demo.md
│ └── pose_estimation.py
│ ├── new_year
│ ├── README.md
│ └── new_year.py
│ ├── valentine_magic
│ ├── README.md
│ └── valentine_magic.py
│ ├── bing_dwen_dwen
│ ├── README.md
│ ├── bing_dwen_dwen.py
│ └── resource-info.json
│ └── face_swap
│ ├── README.md
│ └── face_swap.py
├── .pre-commit-config.yaml
├── README.md
├── README_en.md
├── run.py
└── .gitignore
/src/nodes/newyear_node.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/__init__.py:
--------------------------------------------------------------------------------
1 | from . import nodes # noqa
2 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/gaussian.py:
--------------------------------------------------------------------------------
1 | filter_cfg = dict(
2 | type='GaussianFilter',
3 | window_size=11,
4 | sigma=4.0,
5 | )
6 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/one_euro.py:
--------------------------------------------------------------------------------
1 | filter_cfg = dict(
2 | type='OneEuroFilter',
3 | min_cutoff=0.004,
4 | beta=0.7,
5 | )
6 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/savizky_golay.py:
--------------------------------------------------------------------------------
1 | filter_cfg = dict(
2 | type='SavizkyGolayFilter',
3 | window_size=11,
4 | polyorder=2,
5 | )
6 |
--------------------------------------------------------------------------------
/src/nodes/__init__.py:
--------------------------------------------------------------------------------
1 | from .bingdwendwen_node import BingDwenDwenNode
2 | from .faceswap_node import FaceSwapNode
3 | from .firecracker_effect_node import FirecrackerEffectNode
4 | from .hat_effect_node import HatEffectNode
5 | from .valentine_magic_node import ValentineMagicNode
6 |
7 | __all__ = [
8 | 'BingDwenDwenNode', 'FaceSwapNode', 'ValentineMagicNode', 'HatEffectNode',
9 | 'FirecrackerEffectNode'
10 | ]
11 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/smoothnet_t8_h36m.py:
--------------------------------------------------------------------------------
1 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
2 | # 8. The model is trained using root-centered keypoint coordinates around the
3 | # pelvis (index:0), thus we set root_index=0 for the filter
4 | filter_cfg = dict(
5 | type='SmoothNetFilter',
6 | window_size=8,
7 | output_size=8,
8 | checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
9 | 'smoothnet_ws8_h36m.pth',
10 | hidden_size=512,
11 | res_hidden_size=256,
12 | num_blocks=3,
13 | root_index=0)
14 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/smoothnet_t16_h36m.py:
--------------------------------------------------------------------------------
1 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
2 | # 16. The model is trained using root-centered keypoint coordinates around the
3 | # pelvis (index:0), thus we set root_index=0 for the filter
4 | filter_cfg = dict(
5 | type='SmoothNetFilter',
6 | window_size=16,
7 | output_size=16,
8 | checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
9 | 'smoothnet_ws16_h36m.pth',
10 | hidden_size=512,
11 | res_hidden_size=256,
12 | num_blocks=3,
13 | root_index=0)
14 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/smoothnet_t32_h36m.py:
--------------------------------------------------------------------------------
1 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
2 | # 32. The model is trained using root-centered keypoint coordinates around the
3 | # pelvis (index:0), thus we set root_index=0 for the filter
4 | filter_cfg = dict(
5 | type='SmoothNetFilter',
6 | window_size=32,
7 | output_size=32,
8 | checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
9 | 'smoothnet_ws32_h36m.pth',
10 | hidden_size=512,
11 | res_hidden_size=256,
12 | num_blocks=3,
13 | root_index=0)
14 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/smoothnet_t64_h36m.py:
--------------------------------------------------------------------------------
1 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
2 | # 64. The model is trained using root-centered keypoint coordinates around the
3 | # pelvis (index:0), thus we set root_index=0 for the filter
4 | filter_cfg = dict(
5 | type='SmoothNetFilter',
6 | window_size=64,
7 | output_size=64,
8 | checkpoint='https://download.openmmlab.com/mmpose/plugin/smoothnet/'
9 | 'smoothnet_ws64_h36m.pth',
10 | hidden_size=512,
11 | res_hidden_size=256,
12 | num_blocks=3,
13 | root_index=0)
14 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/default_runtime.py:
--------------------------------------------------------------------------------
1 | checkpoint_config = dict(interval=10)
2 |
3 | log_config = dict(
4 | interval=50,
5 | hooks=[
6 | dict(type='TextLoggerHook'),
7 | # dict(type='TensorboardLoggerHook')
8 | ])
9 |
10 | log_level = 'INFO'
11 | load_from = None
12 | resume_from = None
13 | dist_params = dict(backend='nccl')
14 | workflow = [('train', 1)]
15 |
16 | # disable opencv multithreading to avoid system being overloaded
17 | opencv_num_threads = 0
18 | # set multi-process start method as `fork` to speed up the training
19 | mp_start_method = 'fork'
20 |
--------------------------------------------------------------------------------
/configs/examples/pose_estimation/test_camera.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | name='Test Webcam',
4 | camera_id=0,
5 | camera_max_fps=30,
6 | nodes=[
7 | dict(type='MonitorNode',
8 | name='monitor',
9 | enable_key='m',
10 | enable=False,
11 | input_buffer='_frame_',
12 | output_buffer='display'),
13 | # 'RecorderNode':
14 | # This node save the output video into a file.
15 | dict(type='RecorderNode',
16 | name='recorder',
17 | out_video_file='webcam_output.mp4',
18 | input_buffer='display',
19 | output_buffer='_display_')
20 | ])
21 |
--------------------------------------------------------------------------------
/configs/examples/new_year/README.md:
--------------------------------------------------------------------------------
1 | # New Year Hat and Firecracker Effects
2 |
3 | This demo provides new year effects with pose estimation results, like adding hat on the head and firecracker in the hands.
4 |
5 |
6 |

7 |
8 |
9 | ## Instruction
10 |
11 | ### Get started
12 |
13 | Launch the demo from the mmpose root directory:
14 |
15 | ```shell
16 | python run.py --config configs/examples/new_year/new_year.py
17 | ```
18 |
19 | ### Hotkeys
20 |
21 | | Hotkey | Function |
22 | | ------ | ------------------------------------- |
23 | | t | Toggle the hat effect on/off. |
24 | | f | Toggle the firecracker effect on/off. |
25 | | h | Show help information. |
26 | | m | Show the monitoring information. |
27 | | q | Exit. |
28 |
--------------------------------------------------------------------------------
/configs/examples/valentine_magic/README.md:
--------------------------------------------------------------------------------
1 | # Valentine Magic
2 |
3 | Do you want to show your **love** to your beloved one, especially on Valentine's Day? Express it with your pose using MMPose right away and see the Valentine Magic!
4 |
5 | Try to pose a **hand heart** gesture, and see what will happen?
6 |
7 | Prefer a **blow kiss**? Here comes your flying heart~
8 |
9 |
10 |

11 |
12 |
13 | ## Instruction
14 |
15 | ### Get started
16 |
17 | Launch the demo from the mmpose root directory:
18 |
19 | ```shell
20 | python run.py --config configs/examples/valentine_magic/valentine_magic.py
21 | ```
22 |
23 | ### Hotkeys
24 |
25 | | Hotkey | Function |
26 | | ------ | ----------------------------------------- |
27 | | l | Toggle the Valentine Magic effect on/off. |
28 | | v | Toggle the pose visualization on/off. |
29 | | h | Show help information. |
30 | | m | Show diagnostic information. |
31 | | q | Exit. |
32 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/deepfashion_lower.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='deepfashion_lower',
3 | paper_info=dict(
4 | author='Liu, Ziwei and Luo, Ping and Qiu, Shi '
5 | 'and Wang, Xiaogang and Tang, Xiaoou',
6 | title='DeepFashion: Powering Robust Clothes Recognition '
7 | 'and Retrieval with Rich Annotations',
8 | container='Proceedings of IEEE Conference on Computer '
9 | 'Vision and Pattern Recognition (CVPR)',
10 | year='2016',
11 | homepage='http://mmlab.ie.cuhk.edu.hk/projects/'
12 | 'DeepFashion/LandmarkDetection.html',
13 | ),
14 | keypoint_info={
15 | 0:
16 | dict(name='left waistline',
17 | id=0,
18 | color=[255, 255, 255],
19 | type='',
20 | swap='right waistline'),
21 | 1:
22 | dict(name='right waistline',
23 | id=1,
24 | color=[255, 255, 255],
25 | type='',
26 | swap='left waistline'),
27 | 2:
28 | dict(name='left hem',
29 | id=2,
30 | color=[255, 255, 255],
31 | type='',
32 | swap='right hem'),
33 | 3:
34 | dict(name='right hem',
35 | id=3,
36 | color=[255, 255, 255],
37 | type='',
38 | swap='left hem'),
39 | },
40 | skeleton_info={},
41 | joint_weights=[1.] * 4,
42 | sigmas=[])
43 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | exclude: ^tests/data/
2 | repos:
3 | - repo: https://github.com/PyCQA/flake8
4 | rev: 3.8.3
5 | hooks:
6 | - id: flake8
7 | - repo: https://github.com/PyCQA/isort
8 | rev: 5.10.1
9 | hooks:
10 | - id: isort
11 | - repo: https://github.com/pre-commit/mirrors-yapf
12 | rev: v0.30.0
13 | hooks:
14 | - id: yapf
15 | - repo: https://github.com/pre-commit/pre-commit-hooks
16 | rev: v3.1.0
17 | hooks:
18 | - id: trailing-whitespace
19 | - id: check-yaml
20 | - id: end-of-file-fixer
21 | - id: requirements-txt-fixer
22 | - id: double-quote-string-fixer
23 | - id: check-merge-conflict
24 | - id: fix-encoding-pragma
25 | args: ["--remove"]
26 | - id: mixed-line-ending
27 | args: ["--fix=lf"]
28 | - repo: https://github.com/myint/docformatter
29 | rev: v1.3.1
30 | hooks:
31 | - id: docformatter
32 | args: ["--in-place", "--wrap-descriptions", "79"]
33 | - repo: https://github.com/codespell-project/codespell
34 | rev: v2.1.0
35 | hooks:
36 | - id: codespell
37 | args: ["--skip", "*.ipynb", "-L", "mot"]
38 | - repo: https://github.com/executablebooks/mdformat
39 | rev: 0.7.14
40 | hooks:
41 | - id: mdformat
42 | args: ["--number"]
43 | additional_dependencies:
44 | - git+https://github.com/mzr1996/mdformat-tables.git#egg=mdformat-tables
45 | - mdformat-gfm
46 | - mdformat_frontmatter
47 | - linkify-it-py
48 |
--------------------------------------------------------------------------------
/configs/examples/bing_dwen_dwen/README.md:
--------------------------------------------------------------------------------
1 | # Meow Dwen Dwen
2 |
3 | Do you know [Bing DwenDwen (冰墩墩)](https://en.wikipedia.org/wiki/Bing_Dwen_Dwen_and_Shuey_Rhon_Rhon), the mascot of 2022 Beijing Olympic Games?
4 |
5 |
6 |

7 |
8 |
9 | Now you can dress your cat up in this costume and TA-DA! Be prepared for super cute **Meow Dwen Dwen**.
10 |
11 |
12 |

13 |
14 |
15 | You are a dog fan? Hold on, here comes Woof Dwen Dwen.
16 |
17 |
18 |

19 |
20 |
21 | ## Instruction
22 |
23 | ### Get started
24 |
25 | Launch the demo from the mmpose root directory:
26 |
27 | ```shell
28 | python run.py --config configs/examples/bing_dwen_dwen/bing_dwen_dwen.py
29 | ```
30 |
31 | ### Hotkeys
32 |
33 | | Hotkey | Function |
34 | | ------ | ---------------------------- |
35 | | s | Change the background. |
36 | | h | Show help information. |
37 | | m | Show diagnostic information. |
38 | | q | Exit. |
39 |
40 | ### Configuration
41 |
42 | - **Use video input**
43 |
44 | As you can see in the config, we set `camera_id` as the path of the input image. You can also set it as a video file path (or url), or a webcam ID number (e.g. `camera_id=0`), to capture the dynamic face from the video input.
45 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/deepfashion_upper.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='deepfashion_upper',
3 | paper_info=dict(
4 | author='Liu, Ziwei and Luo, Ping and Qiu, Shi '
5 | 'and Wang, Xiaogang and Tang, Xiaoou',
6 | title='DeepFashion: Powering Robust Clothes Recognition '
7 | 'and Retrieval with Rich Annotations',
8 | container='Proceedings of IEEE Conference on Computer '
9 | 'Vision and Pattern Recognition (CVPR)',
10 | year='2016',
11 | homepage='http://mmlab.ie.cuhk.edu.hk/projects/'
12 | 'DeepFashion/LandmarkDetection.html',
13 | ),
14 | keypoint_info={
15 | 0:
16 | dict(name='left collar',
17 | id=0,
18 | color=[255, 255, 255],
19 | type='',
20 | swap='right collar'),
21 | 1:
22 | dict(name='right collar',
23 | id=1,
24 | color=[255, 255, 255],
25 | type='',
26 | swap='left collar'),
27 | 2:
28 | dict(name='left sleeve',
29 | id=2,
30 | color=[255, 255, 255],
31 | type='',
32 | swap='right sleeve'),
33 | 3:
34 | dict(name='right sleeve',
35 | id=3,
36 | color=[255, 255, 255],
37 | type='',
38 | swap='left sleeve'),
39 | 4:
40 | dict(name='left hem',
41 | id=4,
42 | color=[255, 255, 255],
43 | type='',
44 | swap='right hem'),
45 | 5:
46 | dict(name='right hem',
47 | id=5,
48 | color=[255, 255, 255],
49 | type='',
50 | swap='left hem'),
51 | },
52 | skeleton_info={},
53 | joint_weights=[1.] * 6,
54 | sigmas=[])
55 |
--------------------------------------------------------------------------------
/configs/examples/face_swap/README.md:
--------------------------------------------------------------------------------
1 | # Sunglasses and Bug-eye Effects
2 |
3 | Look! Where is my face?:eyes: And whose face is it?:laughing:
4 |
5 |
6 |

7 |
8 |
9 | ## Instruction
10 |
11 | ### Get started
12 |
13 | Launch the demo from the mmpose root directory:
14 |
15 | ```shell
16 | python run.py --config configs/examples/face_swap/face_swap.py
17 | ```
18 |
19 | ### Hotkeys
20 |
21 | | Hotkey | Function |
22 | | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23 | | s | Switch between modes - Shuffle: Randomly shuffle all faces
- Clone: Choose one face and clone it for everyone
- None: Nothing happens and everyone is safe :)
|
24 | | v | Toggle the pose visualization on/off. |
25 | | h | Show help information. |
26 | | m | Show diagnostic information. |
27 | | q | Exit. |
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # mmpose-webcam-demo
2 |
3 | 简体中文 | [English](/README_en.md)
4 |
5 | 基于 MMPose Webcam API 开发应用或 demo 的项目模板
6 |
7 |
8 |

9 |
10 |
11 | ## 配置环境
12 |
13 | ### 创建虚拟环境
14 |
15 | ```shell
16 | conda create -n mmpose-demo python=3.9 pytorch=1.10 cudatoolkit=11.3 torchvision -c pytorch -y
17 | conda activate mmpose-demo
18 | ```
19 |
20 | ### 安装 MMCV 和 MMDetection
21 |
22 | ```shell
23 | pip install openmim
24 | mim install mmcv-full
25 | pip install mmdet
26 | ```
27 |
28 | ### 安装 MMPose
29 |
30 | 为了能随时同步最新的 MMPose 代码,我们推荐将 MMPose 克隆到本地,并通过开发模式安装
31 |
32 | ```shell
33 | cd ..
34 | git clone clone https://github.com/open-mmlab/mmpose.git
35 | cd mmpose
36 | pip install -e .
37 | ```
38 |
39 | 测试 MMPose 安装成功
40 |
41 | ```shell
42 | python -c "from mmpose.apis import webcam"
43 | ```
44 |
45 | ### 配置 pre-commit hook
46 |
47 | ```shell
48 | # 在 mmpose-webcam-demo 目录中执行以下操作
49 | pip install pre-commit
50 | pre-commit install
51 | ```
52 |
53 | ## 运行示例
54 |
55 | ```shell
56 | # use GPU
57 | python run.py --config configs/pose_estimation/pose_estimation.py
58 |
59 | # use CPU
60 | python run.py --config configs/pose_estimation/pose_estimation.py --cpu
61 |
62 | # use debug mode
63 | python run.py --config configs/pose_estimation/pose_estimation.py --debug
64 | ```
65 |
66 | ## 相关链接
67 |
68 | - 关于摄像头应用接口(MMPose Webcam API)
69 | - [教程文档](https://mmpose.readthedocs.io/zh_CN/latest/tutorials/7_webcam_api.html)
70 | - [API 查询](https://mmpose.readthedocs.io/zh_CN/latest/api.html#mmpose-apis-webcam)
71 | - 关于 MMPose
72 | - [代码仓库](https://github.com/open-mmlab/mmpose)
73 | - [使用文档](https://mmpose.readthedocs.io/zh_CN/latest/)
74 | - [模型池](https://mmpose.readthedocs.io/zh_CN/latest/modelzoo.html)
75 | - 关于 “万物生姿” MMPose 姿态估计创意 Demo 大赛
76 | - [活动主页](https://openmmlab.com/community/mmpose-demo)
77 | - [作品提交](https://github.com/open-mmlab/mmpose/issues/1407)
78 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/deepfashion_full.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='deepfashion_full',
3 | paper_info=dict(
4 | author='Liu, Ziwei and Luo, Ping and Qiu, Shi '
5 | 'and Wang, Xiaogang and Tang, Xiaoou',
6 | title='DeepFashion: Powering Robust Clothes Recognition '
7 | 'and Retrieval with Rich Annotations',
8 | container='Proceedings of IEEE Conference on Computer '
9 | 'Vision and Pattern Recognition (CVPR)',
10 | year='2016',
11 | homepage='http://mmlab.ie.cuhk.edu.hk/projects/'
12 | 'DeepFashion/LandmarkDetection.html',
13 | ),
14 | keypoint_info={
15 | 0:
16 | dict(name='left collar',
17 | id=0,
18 | color=[255, 255, 255],
19 | type='',
20 | swap='right collar'),
21 | 1:
22 | dict(name='right collar',
23 | id=1,
24 | color=[255, 255, 255],
25 | type='',
26 | swap='left collar'),
27 | 2:
28 | dict(name='left sleeve',
29 | id=2,
30 | color=[255, 255, 255],
31 | type='',
32 | swap='right sleeve'),
33 | 3:
34 | dict(name='right sleeve',
35 | id=3,
36 | color=[255, 255, 255],
37 | type='',
38 | swap='left sleeve'),
39 | 4:
40 | dict(name='left waistline',
41 | id=0,
42 | color=[255, 255, 255],
43 | type='',
44 | swap='right waistline'),
45 | 5:
46 | dict(name='right waistline',
47 | id=1,
48 | color=[255, 255, 255],
49 | type='',
50 | swap='left waistline'),
51 | 6:
52 | dict(name='left hem',
53 | id=2,
54 | color=[255, 255, 255],
55 | type='',
56 | swap='right hem'),
57 | 7:
58 | dict(name='right hem',
59 | id=3,
60 | color=[255, 255, 255],
61 | type='',
62 | swap='left hem'),
63 | },
64 | skeleton_info={},
65 | joint_weights=[1.] * 8,
66 | sigmas=[])
67 |
--------------------------------------------------------------------------------
/README_en.md:
--------------------------------------------------------------------------------
1 | # mmpose-webcam-demo
2 |
3 | [简体中文](/README.md) | English
4 |
5 | A template to build demos and applications with MMPose Webcam API
6 |
7 |
8 |

9 |
10 |
11 | ## Configure Environment
12 |
13 | ### Create a conda environment
14 |
15 | ```shell
16 | conda create -n mmpose-demo python=3.9 pytorch=1.10 cudatoolkit=11.3 torchvision -c pytorch -y
17 | conda activate mmpose-demo
18 | ```
19 |
20 | ### Install MMCV and MMDetection
21 |
22 | ```shell
23 | pip install openmim
24 | mim install mmcv-full
25 | pip install mmdet
26 | ```
27 |
28 | ### Install MMPose
29 |
30 | Clone MMPose and install it in the editable mode, so the latest updates of MMPose can be synchronized easily.
31 |
32 | ```shell
33 | cd ..
34 | git clone clone https://github.com/open-mmlab/mmpose.git
35 | cd mmpose
36 | pip install -e .
37 | ```
38 |
39 | Check MMPose installation.
40 |
41 | ```shell
42 | python -c "from mmpose.apis import webcam"
43 | ```
44 |
45 | ### Configure pre-commit hook
46 |
47 | ```shell
48 | # In mmpose-webcam-demo repo folder
49 | pip install pre-commit
50 | pre-commit install
51 | ```
52 |
53 | ## Run the Demo
54 |
55 | ```shell
56 | # use GPU
57 | python run.py --config configs/pose_estimation/pose_estimation.py
58 |
59 | # use CPU
60 | python run.py --config configs/pose_estimation/pose_estimation.py --cpu
61 |
62 | # use debug mode
63 | python run.py --config configs/pose_estimation/pose_estimation.py --debug
64 | ```
65 |
66 | ## Useful Linnks
67 |
68 | - Webcam API
69 | - [Tutorial](https://mmpose.readthedocs.io/en/latest/tutorials/7_webcam_api.html)
70 | - [API Reference](https://mmpose.readthedocs.io/en/latest/api.html#mmpose-apis-webcam)
71 | - MMPose
72 | - [Code](https://github.com/open-mmlab/mmpose)
73 | - [Documentation](https://mmpose.readthedocs.io/en/latest/)
74 | - [Model Zoo](https://mmpose.readthedocs.io/en/latest/modelzoo.html)
75 | - About "Infinity Pose" MMPose Creative Demo Competition
76 | - [Event Home Page](https://openmmlab.com/community/mmpose-demo)
77 | - [Submission](https://github.com/open-mmlab/mmpose/issues/1407)
78 |
--------------------------------------------------------------------------------
/run.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 |
3 | import logging
4 | import sys
5 | from argparse import ArgumentParser
6 |
7 | from mmcv import Config, DictAction
8 | from mmpose.apis.webcam import WebcamExecutor
9 | from mmpose.apis.webcam.nodes import model_nodes
10 |
11 | sys.path.append('.')
12 | from src import * # noqa
13 |
14 |
15 | def parse_args():
16 | parser = ArgumentParser('Webcam executor configs')
17 | parser.add_argument(
18 | '--config',
19 | type=str,
20 | default='configs/examples/pose_estimation/pose_estimation.py')
21 |
22 | parser.add_argument(
23 | '--cfg-options',
24 | nargs='+',
25 | action=DictAction,
26 | default={},
27 | help='Override settings in the config. The key-value pair '
28 | 'in xxx=yyy format will be merged into config file. For example, '
29 | "'--cfg-options executor_cfg.camera_id=1'")
30 | parser.add_argument('--debug',
31 | action='store_true',
32 | help='Show debug information')
33 |
34 | parser.add_argument('--cpu',
35 | action='store_true',
36 | help='Use CPU for model inference.')
37 | parser.add_argument('--cuda',
38 | action='store_true',
39 | help='Use GPU for model inference.')
40 |
41 | return parser.parse_args()
42 |
43 |
44 | def set_device(cfg: Config, device: str):
45 | """Set model device in config.
46 |
47 | Args:
48 | cfg (Config): Webcam config
49 | device (str): device indicator like "cpu" or "cuda:0"
50 | """
51 |
52 | device = device.lower()
53 | assert device == 'cpu' or device.startswith('cuda:')
54 |
55 | for node_cfg in cfg.executor_cfg.nodes:
56 | if node_cfg.type in model_nodes.__all__:
57 | node_cfg.update(device=device)
58 |
59 | return cfg
60 |
61 |
62 | def run():
63 | args = parse_args()
64 | cfg = Config.fromfile(args.config)
65 | cfg.merge_from_dict(args.cfg_options)
66 |
67 | if args.debug:
68 | logging.basicConfig(level=logging.DEBUG)
69 |
70 | if args.cpu:
71 | cfg = set_device(cfg, 'cpu')
72 |
73 | if args.cuda:
74 | cfg = set_device(cfg, 'cuda:0')
75 |
76 | webcam_exe = WebcamExecutor(**cfg.executor_cfg)
77 | webcam_exe.run()
78 |
79 |
80 | if __name__ == '__main__':
81 | run()
82 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/zebra.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='zebra',
3 | paper_info=dict(
4 | author='Graving, Jacob M and Chae, Daniel and Naik, Hemal and '
5 | 'Li, Liang and Koger, Benjamin and Costelloe, Blair R and '
6 | 'Couzin, Iain D',
7 | title='DeepPoseKit, a software toolkit for fast and robust '
8 | 'animal pose estimation using deep learning',
9 | container='Elife',
10 | year='2019',
11 | homepage='https://github.com/jgraving/DeepPoseKit-Data',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='snout', id=0, color=[255, 255, 255], type='', swap=''),
16 | 1:
17 | dict(name='head', id=1, color=[255, 255, 255], type='', swap=''),
18 | 2:
19 | dict(name='neck', id=2, color=[255, 255, 255], type='', swap=''),
20 | 3:
21 | dict(name='forelegL1',
22 | id=3,
23 | color=[255, 255, 255],
24 | type='',
25 | swap='forelegR1'),
26 | 4:
27 | dict(name='forelegR1',
28 | id=4,
29 | color=[255, 255, 255],
30 | type='',
31 | swap='forelegL1'),
32 | 5:
33 | dict(name='hindlegL1',
34 | id=5,
35 | color=[255, 255, 255],
36 | type='',
37 | swap='hindlegR1'),
38 | 6:
39 | dict(name='hindlegR1',
40 | id=6,
41 | color=[255, 255, 255],
42 | type='',
43 | swap='hindlegL1'),
44 | 7:
45 | dict(name='tailbase', id=7, color=[255, 255, 255], type='', swap=''),
46 | 8:
47 | dict(name='tailtip', id=8, color=[255, 255, 255], type='', swap='')
48 | },
49 | skeleton_info={
50 | 0: dict(link=('head', 'snout'), id=0, color=[255, 255, 255]),
51 | 1: dict(link=('neck', 'head'), id=1, color=[255, 255, 255]),
52 | 2: dict(link=('forelegL1', 'neck'), id=2, color=[255, 255, 255]),
53 | 3: dict(link=('forelegR1', 'neck'), id=3, color=[255, 255, 255]),
54 | 4: dict(link=('hindlegL1', 'tailbase'), id=4, color=[255, 255, 255]),
55 | 5: dict(link=('hindlegR1', 'tailbase'), id=5, color=[255, 255, 255]),
56 | 6: dict(link=('tailbase', 'neck'), id=6, color=[255, 255, 255]),
57 | 7: dict(link=('tailtip', 'tailbase'), id=7, color=[255, 255, 255])
58 | },
59 | joint_weights=[1.] * 9,
60 | sigmas=[])
61 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
131 | # Custom items
132 | *.mp4
133 |
--------------------------------------------------------------------------------
/configs/examples/face_swap/face_swap.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | name='FaceSwap',
4 | camera_id=0,
5 | camera_max_fps=20,
6 | nodes=[
7 | dict(
8 | type='DetectorNode',
9 | name='detector',
10 | model_config='model_configs/mmdet/'
11 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
12 | model_checkpoint='https://download.openmmlab.com'
13 | '/mmdetection/v2.0/ssd/'
14 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
15 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
16 | input_buffer='_input_', # `_input_` is an executor-reserved buffer
17 | output_buffer='det_result'),
18 | dict(type='TopDownPoseEstimatorNode',
19 | name='human pose estimator',
20 | model_config='model_configs/mmpose/'
21 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
22 | model_checkpoint='https://download.openmmlab.com/mmpose/top_down/'
23 | 'vipnas/vipnas_mbv3_coco_wholebody_256x192_dark'
24 | '-e2158108_20211205.pth',
25 | labels=['person'],
26 | smooth=True,
27 | input_buffer='det_result',
28 | output_buffer='human_pose'),
29 | dict(
30 | type='ObjectAssignerNode',
31 | name='ResultBinder',
32 | frame_buffer='_frame_', # `_frame_` is a runner-reserved buffer
33 | object_buffer='human_pose',
34 | output_buffer='frame'),
35 | dict(type='FaceSwapNode',
36 | name='FaceSwapper',
37 | mode_key='s',
38 | input_buffer='frame',
39 | output_buffer='face_swap'),
40 | dict(type='ObjectVisualizerNode',
41 | name='Visualizer',
42 | enable_key='v',
43 | input_buffer='face_swap',
44 | output_buffer='vis_pose'),
45 | dict(type='NoticeBoardNode',
46 | name='Help Information',
47 | enable_key='h',
48 | content_lines=[
49 | 'Swap your faces! ',
50 | 'Hot-keys:',
51 | '"v": Toggle the pose visualization on/off.',
52 | '"s": Switch between modes: Shuffle, Clone and None',
53 | '"h": Show help information',
54 | '"m": Show diagnostic information',
55 | '"q": Exit',
56 | ],
57 | input_buffer='vis_pose',
58 | output_buffer='vis_notice'),
59 | dict(type='MonitorNode',
60 | name='Monitor',
61 | enable_key='m',
62 | enable=False,
63 | input_buffer='vis_notice',
64 | output_buffer='display'),
65 | dict(type='RecorderNode',
66 | name='Recorder',
67 | out_video_file='faceswap_output.mp4',
68 | input_buffer='display',
69 | output_buffer='_display_')
70 | ])
71 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/aflw.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='aflw',
3 | paper_info=dict(
4 | author='Koestinger, Martin and Wohlhart, Paul and '
5 | 'Roth, Peter M and Bischof, Horst',
6 | title='Annotated facial landmarks in the wild: '
7 | 'A large-scale, real-world database for facial '
8 | 'landmark localization',
9 | container='2011 IEEE international conference on computer '
10 | 'vision workshops (ICCV workshops)',
11 | year='2011',
12 | homepage='https://www.tugraz.at/institute/icg/research/'
13 | 'team-bischof/lrs/downloads/aflw/',
14 | ),
15 | keypoint_info={
16 | 0:
17 | dict(name='kpt-0', id=0, color=[255, 255, 255], type='', swap='kpt-5'),
18 | 1:
19 | dict(name='kpt-1', id=1, color=[255, 255, 255], type='', swap='kpt-4'),
20 | 2:
21 | dict(name='kpt-2', id=2, color=[255, 255, 255], type='', swap='kpt-3'),
22 | 3:
23 | dict(name='kpt-3', id=3, color=[255, 255, 255], type='', swap='kpt-2'),
24 | 4:
25 | dict(name='kpt-4', id=4, color=[255, 255, 255], type='', swap='kpt-1'),
26 | 5:
27 | dict(name='kpt-5', id=5, color=[255, 255, 255], type='', swap='kpt-0'),
28 | 6:
29 | dict(name='kpt-6', id=6, color=[255, 255, 255], type='',
30 | swap='kpt-11'),
31 | 7:
32 | dict(name='kpt-7', id=7, color=[255, 255, 255], type='',
33 | swap='kpt-10'),
34 | 8:
35 | dict(name='kpt-8', id=8, color=[255, 255, 255], type='', swap='kpt-9'),
36 | 9:
37 | dict(name='kpt-9', id=9, color=[255, 255, 255], type='', swap='kpt-8'),
38 | 10:
39 | dict(name='kpt-10',
40 | id=10,
41 | color=[255, 255, 255],
42 | type='',
43 | swap='kpt-7'),
44 | 11:
45 | dict(name='kpt-11',
46 | id=11,
47 | color=[255, 255, 255],
48 | type='',
49 | swap='kpt-6'),
50 | 12:
51 | dict(name='kpt-12',
52 | id=12,
53 | color=[255, 255, 255],
54 | type='',
55 | swap='kpt-14'),
56 | 13:
57 | dict(name='kpt-13', id=13, color=[255, 255, 255], type='', swap=''),
58 | 14:
59 | dict(name='kpt-14',
60 | id=14,
61 | color=[255, 255, 255],
62 | type='',
63 | swap='kpt-12'),
64 | 15:
65 | dict(name='kpt-15',
66 | id=15,
67 | color=[255, 255, 255],
68 | type='',
69 | swap='kpt-17'),
70 | 16:
71 | dict(name='kpt-16', id=16, color=[255, 255, 255], type='', swap=''),
72 | 17:
73 | dict(name='kpt-17',
74 | id=17,
75 | color=[255, 255, 255],
76 | type='',
77 | swap='kpt-15'),
78 | 18:
79 | dict(name='kpt-18', id=18, color=[255, 255, 255], type='', swap='')
80 | },
81 | skeleton_info={},
82 | joint_weights=[1.] * 19,
83 | sigmas=[])
84 |
--------------------------------------------------------------------------------
/configs/examples/valentine_magic/valentine_magic.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | # Basic configurations of the runner
4 | name='Valentine Magic',
5 | camera_id=0,
6 | nodes=[
7 | dict(
8 | type='DetectorNode',
9 | name='detector',
10 | model_config='model_configs/mmdet/'
11 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
12 | model_checkpoint='https://download.openmmlab.com'
13 | '/mmdetection/v2.0/ssd/'
14 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
15 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
16 | bbox_thr=0.7,
17 | input_buffer='_input_', # `_input_` is an executor-reserved buffer
18 | output_buffer='det_result'),
19 | dict(type='TopDownPoseEstimatorNode',
20 | name='human pose estimator',
21 | model_config='model_configs/mmpose/'
22 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
23 | model_checkpoint='https://download.openmmlab.com/mmpose/top_down/'
24 | 'vipnas/vipnas_mbv3_coco_wholebody_256x192_dark'
25 | '-e2158108_20211205.pth',
26 | labels=['person'],
27 | smooth=True,
28 | input_buffer='det_result',
29 | output_buffer='pose_result'),
30 | dict(
31 | type='ObjectAssignerNode',
32 | name='object assigner',
33 | frame_buffer='_frame_', # `_frame_` is a runner-reserved buffer
34 | object_buffer='pose_result',
35 | output_buffer='frame'),
36 | dict(type='ObjectVisualizerNode',
37 | name='object visualizer',
38 | enable_key='v',
39 | enable=False,
40 | input_buffer='frame',
41 | output_buffer='vis'),
42 | dict(
43 | type='ValentineMagicNode',
44 | name='valentine magic',
45 | enable_key='l',
46 | input_buffer='vis',
47 | output_buffer='vis_heart',
48 | ),
49 | dict(
50 | type='NoticeBoardNode',
51 | name='Helper',
52 | enable_key='h',
53 | enable=False,
54 | input_buffer='vis_heart',
55 | output_buffer='vis_notice',
56 | content_lines=[
57 | 'This is a demo for pose visualization and simple image '
58 | 'effects. Have fun!', '', 'Hot-keys:',
59 | '"h": Show help information', '"l": LoveHeart Effect',
60 | '"v": PoseVisualizer', '"m": Show diagnostic information',
61 | '"q": Exit'
62 | ],
63 | ),
64 | dict(type='MonitorNode',
65 | name='monitor',
66 | enable_key='m',
67 | enable=False,
68 | input_buffer='vis_notice',
69 | output_buffer='display'), # `_frame_` is a runner-reserved buffer
70 | dict(type='RecorderNode',
71 | name='recorder',
72 | out_video_file='valentine.mp4',
73 | input_buffer='display',
74 | output_buffer='_display_')
75 | ])
76 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/filters/smoothnet_h36m.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SmoothNet (arXiv'2021)
5 |
6 | ```bibtex
7 | @article{zeng2021smoothnet,
8 | title={SmoothNet: A Plug-and-Play Network for Refining Human Poses in Videos},
9 | author={Zeng, Ailing and Yang, Lei and Ju, Xuan and Li, Jiefeng and Wang, Jianyi and Xu, Qiang},
10 | journal={arXiv preprint arXiv:2112.13715},
11 | year={2021}
12 | }
13 | ```
14 |
15 |
16 |
17 |
18 |
19 |
20 | Human3.6M (TPAMI'2014)
21 |
22 | ```bibtex
23 | @article{h36m_pami,
24 | author = {Ionescu, Catalin and Papava, Dragos and Olaru, Vlad and Sminchisescu, Cristian},
25 | title = {Human3.6M: Large Scale Datasets and Predictive Methods for 3D Human Sensing in Natural Environments},
26 | journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
27 | publisher = {IEEE Computer Society},
28 | volume = {36},
29 | number = {7},
30 | pages = {1325-1339},
31 | month = {jul},
32 | year = {2014}
33 | }
34 | ```
35 |
36 |
37 |
38 | The following SmoothNet model checkpoints are available for pose smoothing. The table shows the the performance of [SimpleBaseline3D](https://arxiv.org/abs/1705.03098) on [Human3.6M](https://ieeexplore.ieee.org/abstract/document/6682899/) dataset without/with the SmoothNet plugin, and compares the SmoothNet models with 4 different window sizes (8, 16, 32 and 64). The metrics are MPJPE(mm), P-MEJPE(mm) and Acceleration Error (mm/frame^2).
39 |
40 | | Arch | Window Size | MPJPEw/o | MPJPEw | P-MPJPEw/o | P-MPJPEw | AC. Errw/o | AC. Errw | ckpt |
41 | | :----------------------------------- | :---------: | :-----------------: | :---------------: | :-------------------: | :-----------------: | :-------------------: | :-----------------: | :-----------------------------------: |
42 | | [smoothnet_ws8](/configs/_base_/filters/smoothnet_t8_h36m.py) | 8 | 54.48 | 53.15 | 42.20 | 41.32 | 19.18 | 1.87 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws8_h36m.pth) |
43 | | [smoothnet_ws16](/configs/_base_/filters/smoothnet_t16_h36m.py) | 16 | 54.48 | 52.74 | 42.20 | 41.20 | 19.18 | 1.22 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws16_h36m.pth) |
44 | | [smoothnet_ws32](/configs/_base_/filters/smoothnet_t32_h36m.py) | 32 | 54.48 | 52.47 | 42.20 | 40.84 | 19.18 | 0.99 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws32_h36m.pth) |
45 | | [smoothnet_ws64](/configs/_base_/filters/smoothnet_t64_h36m.py) | 64 | 54.48 | 53.37 | 42.20 | 40.77 | 19.18 | 0.92 | [ckpt](https://download.openmmlab.com/mmpose/plugin/smoothnet/smoothnet_ws64_h36m.pth) |
46 |
--------------------------------------------------------------------------------
/configs/examples/bing_dwen_dwen/bing_dwen_dwen.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | # Basic configurations of the runner
4 | name='Little fans of 2022 Beijing Winter Olympics',
5 | # Cat image
6 | camera_id='https://user-images.githubusercontent.com/'
7 | '15977946/152932036-b5554cf8-24cf-40d6-a358-35a106013f11.jpeg',
8 | # Dog image
9 | # camera_id='https://user-images.githubusercontent.com/'
10 | # '15977946/152932051-cd280b35-8066-45a0-8f52-657c8631aaba.jpg',
11 | # Camera input
12 | # camera_id=0,
13 | camera_max_fps=20,
14 | nodes=[
15 | dict(
16 | type='DetectorNode',
17 | name='Detector',
18 | model_config='model_configs/mmdet/'
19 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
20 | model_checkpoint='https://download.openmmlab.com'
21 | '/mmdetection/v2.0/ssd/'
22 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
23 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
24 | input_buffer='_input_', # `_input_` is a runner-reserved buffer
25 | output_buffer='det_result'),
26 | dict(type='TopDownPoseEstimatorNode',
27 | name='Animal Pose Estimator',
28 | model_config='configs/animal/2d_kpt_sview_rgb_img/topdown_heatmap'
29 | '/ap10k/hrnet_w32_ap10k_256x256.py',
30 | model_checkpoint='https://download.openmmlab.com/mmpose/animal/'
31 | 'hrnet/hrnet_w32_ap10k_256x256-18aac840_20211029.pth',
32 | labels=['cat', 'dog'],
33 | smooth=True,
34 | input_buffer='det_result',
35 | output_buffer='animal_pose'),
36 | dict(type='TopDownPoseEstimatorNode',
37 | name='TopDown Pose Estimator',
38 | model_config='model_configs/mmpose/'
39 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
40 | model_checkpoint='https://download.openmmlab.com/mmpose/top_down/'
41 | 'vipnas/vipnas_mbv3_coco_wholebody_256x192_dark'
42 | '-e2158108_20211205.pth',
43 | device='cpu',
44 | labels=['person'],
45 | smooth=True,
46 | input_buffer='animal_pose',
47 | output_buffer='human_pose'),
48 | dict(
49 | type='ObjectAssignerNode',
50 | name='ResultBinder',
51 | frame_buffer='_frame_', # `_frame_` is a runner-reserved buffer
52 | object_buffer='human_pose',
53 | output_buffer='frame'),
54 | dict(type='BingDwenDwenNode',
55 | name='XDwenDwen',
56 | mode_key='s',
57 | resource_file='configs/examples/bing_dwen_dwen/'
58 | 'resource-info.json',
59 | out_shape=(480, 480),
60 | input_buffer='frame',
61 | output_buffer='vis'),
62 | dict(
63 | type='NoticeBoardNode',
64 | name='Helper',
65 | enable_key='h',
66 | enable=False,
67 | input_buffer='vis',
68 | output_buffer='vis_notice',
69 | content_lines=[
70 | 'Let your pet put on a costume of Bing-Dwen-Dwen, '
71 | 'the mascot of 2022 Beijing Winter Olympics. Have fun!', '',
72 | 'Hot-keys:', '"s": Change the background',
73 | '"h": Show help information',
74 | '"m": Show diagnostic information', '"q": Exit'
75 | ],
76 | ),
77 | dict(type='MonitorNode',
78 | name='Monitor',
79 | enable_key='m',
80 | enable=False,
81 | input_buffer='vis_notice',
82 | output_buffer='display'),
83 | dict(type='RecorderNode',
84 | name='Recorder',
85 | out_video_file='record.mp4',
86 | input_buffer='display',
87 | output_buffer='_display_'
88 | # `_display_` is a runner-reserved buffer
89 | )
90 | ])
91 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/cofw.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='cofw',
3 | paper_info=dict(
4 | author='Burgos-Artizzu, Xavier P and Perona, '
5 | r'Pietro and Doll{\'a}r, Piotr',
6 | title='Robust face landmark estimation under occlusion',
7 | container='Proceedings of the IEEE international '
8 | 'conference on computer vision',
9 | year='2013',
10 | homepage='http://www.vision.caltech.edu/xpburgos/ICCV13/',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='kpt-0', id=0, color=[255, 255, 255], type='', swap='kpt-1'),
15 | 1:
16 | dict(name='kpt-1', id=1, color=[255, 255, 255], type='', swap='kpt-0'),
17 | 2:
18 | dict(name='kpt-2', id=2, color=[255, 255, 255], type='', swap='kpt-3'),
19 | 3:
20 | dict(name='kpt-3', id=3, color=[255, 255, 255], type='', swap='kpt-2'),
21 | 4:
22 | dict(name='kpt-4', id=4, color=[255, 255, 255], type='', swap='kpt-6'),
23 | 5:
24 | dict(name='kpt-5', id=5, color=[255, 255, 255], type='', swap='kpt-7'),
25 | 6:
26 | dict(name='kpt-6', id=6, color=[255, 255, 255], type='', swap='kpt-4'),
27 | 7:
28 | dict(name='kpt-7', id=7, color=[255, 255, 255], type='', swap='kpt-5'),
29 | 8:
30 | dict(name='kpt-8', id=8, color=[255, 255, 255], type='', swap='kpt-9'),
31 | 9:
32 | dict(name='kpt-9', id=9, color=[255, 255, 255], type='', swap='kpt-8'),
33 | 10:
34 | dict(name='kpt-10',
35 | id=10,
36 | color=[255, 255, 255],
37 | type='',
38 | swap='kpt-11'),
39 | 11:
40 | dict(name='kpt-11',
41 | id=11,
42 | color=[255, 255, 255],
43 | type='',
44 | swap='kpt-10'),
45 | 12:
46 | dict(name='kpt-12',
47 | id=12,
48 | color=[255, 255, 255],
49 | type='',
50 | swap='kpt-14'),
51 | 13:
52 | dict(name='kpt-13',
53 | id=13,
54 | color=[255, 255, 255],
55 | type='',
56 | swap='kpt-15'),
57 | 14:
58 | dict(name='kpt-14',
59 | id=14,
60 | color=[255, 255, 255],
61 | type='',
62 | swap='kpt-12'),
63 | 15:
64 | dict(name='kpt-15',
65 | id=15,
66 | color=[255, 255, 255],
67 | type='',
68 | swap='kpt-13'),
69 | 16:
70 | dict(name='kpt-16',
71 | id=16,
72 | color=[255, 255, 255],
73 | type='',
74 | swap='kpt-17'),
75 | 17:
76 | dict(name='kpt-17',
77 | id=17,
78 | color=[255, 255, 255],
79 | type='',
80 | swap='kpt-16'),
81 | 18:
82 | dict(name='kpt-18',
83 | id=18,
84 | color=[255, 255, 255],
85 | type='',
86 | swap='kpt-19'),
87 | 19:
88 | dict(name='kpt-19',
89 | id=19,
90 | color=[255, 255, 255],
91 | type='',
92 | swap='kpt-18'),
93 | 20:
94 | dict(name='kpt-20', id=20, color=[255, 255, 255], type='', swap=''),
95 | 21:
96 | dict(name='kpt-21', id=21, color=[255, 255, 255], type='', swap=''),
97 | 22:
98 | dict(name='kpt-22',
99 | id=22,
100 | color=[255, 255, 255],
101 | type='',
102 | swap='kpt-23'),
103 | 23:
104 | dict(name='kpt-23',
105 | id=23,
106 | color=[255, 255, 255],
107 | type='',
108 | swap='kpt-22'),
109 | 24:
110 | dict(name='kpt-24', id=24, color=[255, 255, 255], type='', swap=''),
111 | 25:
112 | dict(name='kpt-25', id=25, color=[255, 255, 255], type='', swap=''),
113 | 26:
114 | dict(name='kpt-26', id=26, color=[255, 255, 255], type='', swap=''),
115 | 27:
116 | dict(name='kpt-27', id=27, color=[255, 255, 255], type='', swap=''),
117 | 28:
118 | dict(name='kpt-28', id=28, color=[255, 255, 255], type='', swap='')
119 | },
120 | skeleton_info={},
121 | joint_weights=[1.] * 29,
122 | sigmas=[])
123 |
--------------------------------------------------------------------------------
/configs/examples/pose_estimation/pose_tracking.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | # Basic configurations of the executor
4 | name='Pose Estimation',
5 | camera_id=0,
6 | synchronous=False,
7 | # Define nodes.
8 | # The configuration of a node usually includes:
9 | # 1. 'type': Node class name
10 | # 2. 'name': Node name
11 | # 3. I/O buffers (e.g. 'input_buffer', 'output_buffer'): specify the
12 | # input and output buffer names. This may depend on the node class.
13 | # 4. 'enable_key': assign a hot-key to toggle enable/disable this node.
14 | # This may depend on the node class.
15 | # 5. Other class-specific arguments
16 | nodes=[
17 | # 'PoseTrackerNode':
18 | # This node performs object detection and pose tracking. Object
19 | # detection is performed every several frames. Pose estimation
20 | # is performed for every frame to get the keypoint as well as the
21 | # interval bbox when object detection is not performed.
22 | dict(
23 | type='PoseTrackerNode',
24 | name='pose tracker',
25 | det_model_config='model_configs/mmdet/'
26 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
27 | det_model_checkpoint='https://download.openmmlab.com'
28 | '/mmdetection/v2.0/ssd/'
29 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
30 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
31 | pose_model_config='model_configs/mmpose/'
32 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
33 | pose_model_checkpoint='https://download.openmmlab.com/mmpose/'
34 | 'top_down/vipnas/vipnas_mbv3_coco_wholebody_256x192_dark'
35 | '-e2158108_20211205.pth',
36 | det_interval=10,
37 | labels=['person'],
38 | smooth=True,
39 | device='cuda:0',
40 | input_buffer='_input_', # `_input_` is an executor-reserved buffer
41 | output_buffer='human_pose'),
42 | # 'ObjectAssignerNode':
43 | # This node binds the latest model inference result with the current
44 | # frame. (This means the frame image and inference result may be
45 | # asynchronous).
46 | dict(
47 | type='ObjectAssignerNode',
48 | name='object assigner',
49 | frame_buffer='_frame_', # `_frame_` is an executor-reserved buffer
50 | object_buffer='human_pose',
51 | output_buffer='frame'),
52 | # 'ObjectVisualizerNode':
53 | # This node draw the pose visualization result in the frame image.
54 | # Pose results is needed.
55 | dict(type='ObjectVisualizerNode',
56 | name='object visualizer',
57 | enable_key='v',
58 | input_buffer='frame',
59 | output_buffer='vis'),
60 | # 'NoticeBoardNode':
61 | # This node show a notice board with given content, e.g. help
62 | # information.
63 | dict(
64 | type='NoticeBoardNode',
65 | name='instruction',
66 | enable_key='h',
67 | enable=True,
68 | input_buffer='vis',
69 | output_buffer='vis_notice',
70 | content_lines=[
71 | 'This is a demo for pose visualization and simple image '
72 | 'effects. Have fun!', '', 'Hot-keys:',
73 | '"v": Pose estimation result visualization',
74 | '"s": Sunglasses effect B-)', '"b": Bug-eye effect 0_0',
75 | '"h": Show help information',
76 | '"m": Show diagnostic information', '"q": Exit'
77 | ],
78 | ),
79 | # 'MonitorNode':
80 | # This node show diagnostic information in the frame image. It can
81 | # be used for debugging or monitoring system resource status.
82 | dict(type='MonitorNode',
83 | name='monitor',
84 | enable_key='m',
85 | enable=False,
86 | input_buffer='vis_notice',
87 | output_buffer='display'),
88 | # 'RecorderNode':
89 | # This node save the output video into a file.
90 | dict(type='RecorderNode',
91 | name='recorder',
92 | out_video_file='webcam_demo.mp4',
93 | input_buffer='display',
94 | output_buffer='_display_'
95 | # `_display_` is an executor-reserved buffer
96 | )
97 | ])
98 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/jhmdb.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='jhmdb',
3 | paper_info=dict(
4 | author='H. Jhuang and J. Gall and S. Zuffi and '
5 | 'C. Schmid and M. J. Black',
6 | title='Towards understanding action recognition',
7 | container='International Conf. on Computer Vision (ICCV)',
8 | year='2013',
9 | homepage='http://jhmdb.is.tue.mpg.de/dataset',
10 | ),
11 | keypoint_info={
12 | 0:
13 | dict(name='neck', id=0, color=[255, 128, 0], type='upper', swap=''),
14 | 1:
15 | dict(name='belly', id=1, color=[255, 128, 0], type='upper', swap=''),
16 | 2:
17 | dict(name='head', id=2, color=[255, 128, 0], type='upper', swap=''),
18 | 3:
19 | dict(name='right_shoulder',
20 | id=3,
21 | color=[0, 255, 0],
22 | type='upper',
23 | swap='left_shoulder'),
24 | 4:
25 | dict(name='left_shoulder',
26 | id=4,
27 | color=[0, 255, 0],
28 | type='upper',
29 | swap='right_shoulder'),
30 | 5:
31 | dict(name='right_hip',
32 | id=5,
33 | color=[0, 255, 0],
34 | type='lower',
35 | swap='left_hip'),
36 | 6:
37 | dict(name='left_hip',
38 | id=6,
39 | color=[51, 153, 255],
40 | type='lower',
41 | swap='right_hip'),
42 | 7:
43 | dict(name='right_elbow',
44 | id=7,
45 | color=[51, 153, 255],
46 | type='upper',
47 | swap='left_elbow'),
48 | 8:
49 | dict(name='left_elbow',
50 | id=8,
51 | color=[51, 153, 255],
52 | type='upper',
53 | swap='right_elbow'),
54 | 9:
55 | dict(name='right_knee',
56 | id=9,
57 | color=[51, 153, 255],
58 | type='lower',
59 | swap='left_knee'),
60 | 10:
61 | dict(name='left_knee',
62 | id=10,
63 | color=[255, 128, 0],
64 | type='lower',
65 | swap='right_knee'),
66 | 11:
67 | dict(name='right_wrist',
68 | id=11,
69 | color=[255, 128, 0],
70 | type='upper',
71 | swap='left_wrist'),
72 | 12:
73 | dict(name='left_wrist',
74 | id=12,
75 | color=[255, 128, 0],
76 | type='upper',
77 | swap='right_wrist'),
78 | 13:
79 | dict(name='right_ankle',
80 | id=13,
81 | color=[0, 255, 0],
82 | type='lower',
83 | swap='left_ankle'),
84 | 14:
85 | dict(name='left_ankle',
86 | id=14,
87 | color=[0, 255, 0],
88 | type='lower',
89 | swap='right_ankle')
90 | },
91 | skeleton_info={
92 | 0: dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
93 | 1: dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
94 | 2: dict(link=('right_hip', 'belly'), id=2, color=[255, 128, 0]),
95 | 3: dict(link=('belly', 'left_hip'), id=3, color=[0, 255, 0]),
96 | 4: dict(link=('left_hip', 'left_knee'), id=4, color=[0, 255, 0]),
97 | 5: dict(link=('left_knee', 'left_ankle'), id=5, color=[0, 255, 0]),
98 | 6: dict(link=('belly', 'neck'), id=6, color=[51, 153, 255]),
99 | 7: dict(link=('neck', 'head'), id=7, color=[51, 153, 255]),
100 | 8: dict(link=('neck', 'right_shoulder'), id=8, color=[255, 128, 0]),
101 | 9: dict(link=('right_shoulder', 'right_elbow'),
102 | id=9,
103 | color=[255, 128, 0]),
104 | 10: dict(link=('right_elbow', 'right_wrist'),
105 | id=10,
106 | color=[255, 128, 0]),
107 | 11: dict(link=('neck', 'left_shoulder'), id=11, color=[0, 255, 0]),
108 | 12: dict(link=('left_shoulder', 'left_elbow'),
109 | id=12,
110 | color=[0, 255, 0]),
111 | 13: dict(link=('left_elbow', 'left_wrist'), id=13, color=[0, 255, 0])
112 | },
113 | joint_weights=[
114 | 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.2, 1.2, 1.5, 1.5, 1.5, 1.5
115 | ],
116 | # Adapted from COCO dataset.
117 | sigmas=[
118 | 0.025, 0.107, 0.025, 0.079, 0.079, 0.107, 0.107, 0.072, 0.072, 0.087,
119 | 0.087, 0.062, 0.062, 0.089, 0.089
120 | ])
121 |
--------------------------------------------------------------------------------
/src/nodes/hat_effect_node.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | from itertools import groupby
3 | from typing import List, Optional, Union
4 |
5 | import cv2
6 | import numpy as np
7 | from mmpose.apis.webcam.nodes import NODES, BaseVisualizerNode
8 | from mmpose.apis.webcam.utils import (get_eye_keypoint_ids,
9 | load_image_from_disk_or_url)
10 |
11 |
12 | @NODES.register_module()
13 | class HatEffectNode(BaseVisualizerNode):
14 | def __init__(self,
15 | name: str,
16 | input_buffer: str,
17 | output_buffer: Union[str, List[str]],
18 | enable_key: Optional[Union[str, int]] = None,
19 | src_img_path: Optional[str] = None):
20 |
21 | super().__init__(name, input_buffer, output_buffer, enable_key)
22 |
23 | if src_img_path is None:
24 | # The image attributes to:
25 | # http://616pic.com/sucai/1m9i70p52.html
26 | src_img_path = 'https://user-images.githubusercontent.' \
27 | 'com/28900607/149766271-2f591c19-9b67-4' \
28 | 'd92-8f94-c272396ca141.png'
29 | self.src_img = load_image_from_disk_or_url(src_img_path,
30 | cv2.IMREAD_UNCHANGED)
31 |
32 | @staticmethod
33 | def apply_hat_effect(img,
34 | objects,
35 | hat_img,
36 | left_eye_index,
37 | right_eye_index,
38 | kpt_thr=0.5):
39 | """Apply hat effect.
40 | Args:
41 | img (np.ndarray): Image data.
42 | objects (list[dict]): The list of object information containing:
43 | - "keypoints" ([K,3]): keypoint detection result in
44 | [x, y, score]
45 | hat_img (np.ndarray): Hat image with white alpha channel.
46 | left_eye_index (int): Keypoint index of left eye
47 | right_eye_index (int): Keypoint index of right eye
48 | kpt_thr (float): The score threshold of required keypoints.
49 | """
50 | img_orig = img.copy()
51 |
52 | img = img_orig.copy()
53 | hm, wm = hat_img.shape[:2]
54 | # anchor points in the sunglasses mask
55 | a = 0.3
56 | b = 0.7
57 | pts_src = np.array([[a * wm, a * hm], [a * wm, b * hm],
58 | [b * wm, a * hm], [b * wm, b * hm]],
59 | dtype=np.float32)
60 |
61 | for obj in objects:
62 | kpts = obj['keypoints']
63 |
64 | if kpts[left_eye_index, 2] < kpt_thr or \
65 | kpts[right_eye_index, 2] < kpt_thr:
66 | continue
67 |
68 | kpt_leye = kpts[left_eye_index, :2]
69 | kpt_reye = kpts[right_eye_index, :2]
70 | # orthogonal vector to the left-to-right eyes
71 | vo = 0.5 * (kpt_reye - kpt_leye)[::-1] * [-1, 1]
72 | veye = 0.5 * (kpt_reye - kpt_leye)
73 |
74 | # anchor points in the image by eye positions
75 | pts_tar = np.vstack([
76 | kpt_reye + 1 * veye + 5 * vo, kpt_reye + 1 * veye + 1 * vo,
77 | kpt_leye - 1 * veye + 5 * vo, kpt_leye - 1 * veye + 1 * vo
78 | ])
79 |
80 | h_mat, _ = cv2.findHomography(pts_src, pts_tar)
81 | patch = cv2.warpPerspective(hat_img,
82 | h_mat,
83 | dsize=(img.shape[1], img.shape[0]),
84 | borderValue=(255, 255, 255))
85 | # mask the white background area in the patch with a threshold 200
86 | mask = (patch[:, :, -1] > 128)
87 | patch = patch[:, :, :-1]
88 | mask = mask * (cv2.cvtColor(patch, cv2.COLOR_BGR2GRAY) > 30)
89 | mask = mask.astype(np.uint8)
90 |
91 | img = cv2.copyTo(patch, mask, img)
92 | return img
93 |
94 | def draw(self, input_msg):
95 | canvas = input_msg.get_image()
96 |
97 | objects = input_msg.get_objects(lambda x: 'keypoints' in x)
98 |
99 | for model_cfg, object_group in groupby(objects,
100 | lambda x: x['pose_model_cfg']):
101 | left_eye_idx, right_eye_idx = get_eye_keypoint_ids(model_cfg)
102 |
103 | canvas = self.apply_hat_effect(canvas, object_group, self.src_img,
104 | left_eye_idx, right_eye_idx)
105 | return canvas
106 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/atrw.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='atrw',
3 | paper_info=dict(
4 | author='Li, Shuyuan and Li, Jianguo and Tang, Hanlin '
5 | 'and Qian, Rui and Lin, Weiyao',
6 | title='ATRW: A Benchmark for Amur Tiger '
7 | 'Re-identification in the Wild',
8 | container='Proceedings of the 28th ACM '
9 | 'International Conference on Multimedia',
10 | year='2020',
11 | homepage='https://cvwc2019.github.io/challenge.html',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='left_ear',
16 | id=0,
17 | color=[51, 153, 255],
18 | type='upper',
19 | swap='right_ear'),
20 | 1:
21 | dict(name='right_ear',
22 | id=1,
23 | color=[51, 153, 255],
24 | type='upper',
25 | swap='left_ear'),
26 | 2:
27 | dict(name='nose', id=2, color=[51, 153, 255], type='upper', swap=''),
28 | 3:
29 | dict(name='right_shoulder',
30 | id=3,
31 | color=[255, 128, 0],
32 | type='upper',
33 | swap='left_shoulder'),
34 | 4:
35 | dict(name='right_front_paw',
36 | id=4,
37 | color=[255, 128, 0],
38 | type='upper',
39 | swap='left_front_paw'),
40 | 5:
41 | dict(name='left_shoulder',
42 | id=5,
43 | color=[0, 255, 0],
44 | type='upper',
45 | swap='right_shoulder'),
46 | 6:
47 | dict(name='left_front_paw',
48 | id=6,
49 | color=[0, 255, 0],
50 | type='upper',
51 | swap='right_front_paw'),
52 | 7:
53 | dict(name='right_hip',
54 | id=7,
55 | color=[255, 128, 0],
56 | type='lower',
57 | swap='left_hip'),
58 | 8:
59 | dict(name='right_knee',
60 | id=8,
61 | color=[255, 128, 0],
62 | type='lower',
63 | swap='left_knee'),
64 | 9:
65 | dict(name='right_back_paw',
66 | id=9,
67 | color=[255, 128, 0],
68 | type='lower',
69 | swap='left_back_paw'),
70 | 10:
71 | dict(name='left_hip',
72 | id=10,
73 | color=[0, 255, 0],
74 | type='lower',
75 | swap='right_hip'),
76 | 11:
77 | dict(name='left_knee',
78 | id=11,
79 | color=[0, 255, 0],
80 | type='lower',
81 | swap='right_knee'),
82 | 12:
83 | dict(name='left_back_paw',
84 | id=12,
85 | color=[0, 255, 0],
86 | type='lower',
87 | swap='right_back_paw'),
88 | 13:
89 | dict(name='tail', id=13, color=[51, 153, 255], type='lower', swap=''),
90 | 14:
91 | dict(name='center', id=14, color=[51, 153, 255], type='lower',
92 | swap=''),
93 | },
94 | skeleton_info={
95 | 0:
96 | dict(link=('left_ear', 'nose'), id=0, color=[51, 153, 255]),
97 | 1:
98 | dict(link=('right_ear', 'nose'), id=1, color=[51, 153, 255]),
99 | 2:
100 | dict(link=('nose', 'center'), id=2, color=[51, 153, 255]),
101 | 3:
102 | dict(link=('left_shoulder', 'left_front_paw'), id=3, color=[0, 255,
103 | 0]),
104 | 4:
105 | dict(link=('left_shoulder', 'center'), id=4, color=[0, 255, 0]),
106 | 5:
107 | dict(link=('right_shoulder', 'right_front_paw'),
108 | id=5,
109 | color=[255, 128, 0]),
110 | 6:
111 | dict(link=('right_shoulder', 'center'), id=6, color=[255, 128, 0]),
112 | 7:
113 | dict(link=('tail', 'center'), id=7, color=[51, 153, 255]),
114 | 8:
115 | dict(link=('right_back_paw', 'right_knee'), id=8, color=[255, 128, 0]),
116 | 9:
117 | dict(link=('right_knee', 'right_hip'), id=9, color=[255, 128, 0]),
118 | 10:
119 | dict(link=('right_hip', 'tail'), id=10, color=[255, 128, 0]),
120 | 11:
121 | dict(link=('left_back_paw', 'left_knee'), id=11, color=[0, 255, 0]),
122 | 12:
123 | dict(link=('left_knee', 'left_hip'), id=12, color=[0, 255, 0]),
124 | 13:
125 | dict(link=('left_hip', 'tail'), id=13, color=[0, 255, 0]),
126 | },
127 | joint_weights=[1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
128 | sigmas=[
129 | 0.0277, 0.0823, 0.0831, 0.0202, 0.0716, 0.0263, 0.0646, 0.0302, 0.0440,
130 | 0.0316, 0.0333, 0.0547, 0.0263, 0.0683, 0.0539
131 | ])
132 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/mpi_inf_3dhp.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='mpi_inf_3dhp',
3 | paper_info=dict(
4 | author='ehta, Dushyant and Rhodin, Helge and Casas, Dan and '
5 | 'Fua, Pascal and Sotnychenko, Oleksandr and Xu, Weipeng and '
6 | 'Theobalt, Christian',
7 | title='Monocular 3D Human Pose Estimation In The Wild Using Improved '
8 | 'CNN Supervision',
9 | container='2017 international conference on 3D vision (3DV)',
10 | year='2017',
11 | homepage='http://gvv.mpi-inf.mpg.de/3dhp-dataset',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='head_top',
16 | id=0,
17 | color=[51, 153, 255],
18 | type='upper',
19 | swap=''),
20 | 1:
21 | dict(name='neck', id=1, color=[51, 153, 255], type='upper', swap=''),
22 | 2:
23 | dict(name='right_shoulder',
24 | id=2,
25 | color=[255, 128, 0],
26 | type='upper',
27 | swap='left_shoulder'),
28 | 3:
29 | dict(name='right_elbow',
30 | id=3,
31 | color=[255, 128, 0],
32 | type='upper',
33 | swap='left_elbow'),
34 | 4:
35 | dict(name='right_wrist',
36 | id=4,
37 | color=[255, 128, 0],
38 | type='upper',
39 | swap='left_wrist'),
40 | 5:
41 | dict(name='left_shoulder',
42 | id=5,
43 | color=[0, 255, 0],
44 | type='upper',
45 | swap='right_shoulder'),
46 | 6:
47 | dict(name='left_elbow',
48 | id=6,
49 | color=[0, 255, 0],
50 | type='upper',
51 | swap='right_elbow'),
52 | 7:
53 | dict(name='left_wrist',
54 | id=7,
55 | color=[0, 255, 0],
56 | type='upper',
57 | swap='right_wrist'),
58 | 8:
59 | dict(name='right_hip',
60 | id=8,
61 | color=[255, 128, 0],
62 | type='lower',
63 | swap='left_hip'),
64 | 9:
65 | dict(name='right_knee',
66 | id=9,
67 | color=[255, 128, 0],
68 | type='lower',
69 | swap='left_knee'),
70 | 10:
71 | dict(name='right_ankle',
72 | id=10,
73 | color=[255, 128, 0],
74 | type='lower',
75 | swap='left_ankle'),
76 | 11:
77 | dict(name='left_hip',
78 | id=11,
79 | color=[0, 255, 0],
80 | type='lower',
81 | swap='right_hip'),
82 | 12:
83 | dict(name='left_knee',
84 | id=12,
85 | color=[0, 255, 0],
86 | type='lower',
87 | swap='right_knee'),
88 | 13:
89 | dict(name='left_ankle',
90 | id=13,
91 | color=[0, 255, 0],
92 | type='lower',
93 | swap='right_ankle'),
94 | 14:
95 | dict(name='root', id=14, color=[51, 153, 255], type='lower', swap=''),
96 | 15:
97 | dict(name='spine', id=15, color=[51, 153, 255], type='upper', swap=''),
98 | 16:
99 | dict(name='head', id=16, color=[51, 153, 255], type='upper', swap='')
100 | },
101 | skeleton_info={
102 | 0: dict(link=('neck', 'right_shoulder'), id=0, color=[255, 128, 0]),
103 | 1: dict(link=('right_shoulder', 'right_elbow'),
104 | id=1,
105 | color=[255, 128, 0]),
106 | 2: dict(link=('right_elbow', 'right_wrist'), id=2, color=[255, 128,
107 | 0]),
108 | 3: dict(link=('neck', 'left_shoulder'), id=3, color=[0, 255, 0]),
109 | 4: dict(link=('left_shoulder', 'left_elbow'), id=4, color=[0, 255, 0]),
110 | 5: dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
111 | 6: dict(link=('root', 'right_hip'), id=6, color=[255, 128, 0]),
112 | 7: dict(link=('right_hip', 'right_knee'), id=7, color=[255, 128, 0]),
113 | 8: dict(link=('right_knee', 'right_ankle'), id=8, color=[255, 128, 0]),
114 | 9: dict(link=('root', 'left_hip'), id=9, color=[0, 255, 0]),
115 | 10: dict(link=('left_hip', 'left_knee'), id=10, color=[0, 255, 0]),
116 | 11: dict(link=('left_knee', 'left_ankle'), id=11, color=[0, 255, 0]),
117 | 12: dict(link=('head_top', 'head'), id=12, color=[51, 153, 255]),
118 | 13: dict(link=('head', 'neck'), id=13, color=[51, 153, 255]),
119 | 14: dict(link=('neck', 'spine'), id=14, color=[51, 153, 255]),
120 | 15: dict(link=('spine', 'root'), id=15, color=[51, 153, 255])
121 | },
122 | joint_weights=[1.] * 17,
123 | sigmas=[])
124 |
--------------------------------------------------------------------------------
/configs/examples/new_year/new_year.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | # Basic configurations of the runner
4 | name='New Year',
5 | camera_id=0,
6 | camera_max_fps=20,
7 | synchronous=False,
8 | # Define nodes.
9 | # The configuration of a node usually includes:
10 | # 1. 'type': Node class name
11 | # 2. 'name': Node name
12 | # 3. I/O buffers (e.g. 'input_buffer', 'output_buffer'): specify the
13 | # input and output buffer names. This may depend on the node class.
14 | # 4. 'enable_key': assign a hot-key to toggle enable/disable this node.
15 | # This may depend on the node class.
16 | # 5. Other class-specific arguments
17 | nodes=[
18 | dict(
19 | type='DetectorNode',
20 | name='detector',
21 | model_config='model_configs/mmdet/'
22 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
23 | model_checkpoint='https://download.openmmlab.com'
24 | '/mmdetection/v2.0/ssd/'
25 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
26 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
27 | input_buffer='_input_', # `_input_` is an executor-reserved buffer
28 | output_buffer='det_result'),
29 | dict(type='TopDownPoseEstimatorNode',
30 | name='human pose estimator',
31 | model_config='model_configs/mmpose/'
32 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
33 | model_checkpoint='https://download.openmmlab.com/mmpose/top_down/'
34 | 'vipnas/vipnas_mbv3_coco_wholebody_256x192_dark'
35 | '-e2158108_20211205.pth',
36 | labels=['person'],
37 | smooth=True,
38 | input_buffer='det_result',
39 | output_buffer='human_pose'),
40 | dict(type='TopDownPoseEstimatorNode',
41 | name='animal pose estimator',
42 | model_config='model_configs/'
43 | 'mmpose/hrnet_w32_animalpose_256x256.py',
44 | model_checkpoint='https://download.openmmlab.com/mmpose/animal/'
45 | 'hrnet/hrnet_w32_animalpose_256x256-1aa7f075_20210426.pth',
46 | labels=['cat', 'dog', 'horse', 'sheep', 'cow'],
47 | input_buffer='human_pose',
48 | output_buffer='animal_pose'),
49 | dict(
50 | type='ObjectAssignerNode',
51 | name='object assigner',
52 | frame_buffer='_frame_', # `_frame_` is an executor-reserved buffer
53 | object_buffer='animal_pose',
54 | output_buffer='frame'),
55 | # 'HatNode':
56 | # This node draw the hat effect in the frame image.
57 | # Pose results is needed.
58 | dict(type='HatEffectNode',
59 | name='hat effect',
60 | enable_key='t',
61 | input_buffer='frame',
62 | output_buffer='vis_hat'),
63 | # 'FirecrackerNode':
64 | # This node draw the firecracker effect in the frame image.
65 | # Pose results is needed.
66 | dict(type='FirecrackerEffectNode',
67 | name='firecracker effect',
68 | enable_key='f',
69 | input_buffer='vis_hat',
70 | output_buffer='vis_firecracker'),
71 | # 'NoticeBoardNode':
72 | # This node show a notice board with given content, e.g. help
73 | # information.
74 | dict(
75 | type='NoticeBoardNode',
76 | name='instruction',
77 | enable_key='h',
78 | enable=False,
79 | input_buffer='vis_firecracker',
80 | output_buffer='vis_notice',
81 | content_lines=[
82 | 'This is a demo for pose visualization and simple image '
83 | 'effects. Have fun!', '', 'Hot-keys:', '"t": Hat effect',
84 | '"f": Firecracker effect', '"h": Show help information',
85 | '"m": Show diagnostic information', '"q": Exit'
86 | ],
87 | ),
88 | # 'MonitorNode':
89 | # This node show diagnostic information in the frame image. It can
90 | # be used for debugging or monitoring system resource status.
91 | dict(type='MonitorNode',
92 | name='monitor',
93 | enable_key='m',
94 | enable=False,
95 | input_buffer='vis_notice',
96 | output_buffer='display'),
97 | # 'RecorderNode':
98 | # This node save the output video into a file.
99 | dict(type='RecorderNode',
100 | name='recorder',
101 | out_video_file='new_year.mp4',
102 | input_buffer='display',
103 | output_buffer='_display_'
104 | # `_display_` is a runner-reserved buffer
105 | )
106 | ])
107 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/campus.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='campus',
3 | paper_info=dict(
4 | author='Belagiannis, Vasileios and Amin, Sikandar and Andriluka, '
5 | 'Mykhaylo and Schiele, Bernt and Navab, Nassir and Ilic, Slobodan',
6 | title='3D Pictorial Structures for Multiple Human Pose Estimation',
7 | container='IEEE Computer Society Conference on Computer Vision and '
8 | 'Pattern Recognition (CVPR)',
9 | year='2014',
10 | homepage='http://campar.in.tum.de/Chair/MultiHumanPose',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='right_ankle',
15 | id=0,
16 | color=[255, 128, 0],
17 | type='lower',
18 | swap='left_ankle'),
19 | 1:
20 | dict(name='right_knee',
21 | id=1,
22 | color=[255, 128, 0],
23 | type='lower',
24 | swap='left_knee'),
25 | 2:
26 | dict(name='right_hip',
27 | id=2,
28 | color=[255, 128, 0],
29 | type='lower',
30 | swap='left_hip'),
31 | 3:
32 | dict(name='left_hip',
33 | id=3,
34 | color=[0, 255, 0],
35 | type='lower',
36 | swap='right_hip'),
37 | 4:
38 | dict(name='left_knee',
39 | id=4,
40 | color=[0, 255, 0],
41 | type='lower',
42 | swap='right_knee'),
43 | 5:
44 | dict(name='left_ankle',
45 | id=5,
46 | color=[0, 255, 0],
47 | type='lower',
48 | swap='right_ankle'),
49 | 6:
50 | dict(name='right_wrist',
51 | id=6,
52 | color=[255, 128, 0],
53 | type='upper',
54 | swap='left_wrist'),
55 | 7:
56 | dict(name='right_elbow',
57 | id=7,
58 | color=[255, 128, 0],
59 | type='upper',
60 | swap='left_elbow'),
61 | 8:
62 | dict(name='right_shoulder',
63 | id=8,
64 | color=[255, 128, 0],
65 | type='upper',
66 | swap='left_shoulder'),
67 | 9:
68 | dict(name='left_shoulder',
69 | id=9,
70 | color=[0, 255, 0],
71 | type='upper',
72 | swap='right_shoulder'),
73 | 10:
74 | dict(name='left_elbow',
75 | id=10,
76 | color=[0, 255, 0],
77 | type='upper',
78 | swap='right_elbow'),
79 | 11:
80 | dict(name='left_wrist',
81 | id=11,
82 | color=[0, 255, 0],
83 | type='upper',
84 | swap='right_wrist'),
85 | 12:
86 | dict(name='bottom_head',
87 | id=12,
88 | color=[51, 153, 255],
89 | type='upper',
90 | swap=''),
91 | 13:
92 | dict(name='top_head',
93 | id=13,
94 | color=[51, 153, 255],
95 | type='upper',
96 | swap=''),
97 | },
98 | skeleton_info={
99 | 0:
100 | dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
101 | 1:
102 | dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
103 | 2:
104 | dict(link=('left_hip', 'left_knee'), id=2, color=[0, 255, 0]),
105 | 3:
106 | dict(link=('left_knee', 'left_ankle'), id=3, color=[0, 255, 0]),
107 | 4:
108 | dict(link=('right_hip', 'left_hip'), id=4, color=[51, 153, 255]),
109 | 5:
110 | dict(link=('right_wrist', 'right_elbow'), id=5, color=[255, 128, 0]),
111 | 6:
112 | dict(link=('right_elbow', 'right_shoulder'), id=6, color=[255, 128,
113 | 0]),
114 | 7:
115 | dict(link=('left_shoulder', 'left_elbow'), id=7, color=[0, 255, 0]),
116 | 8:
117 | dict(link=('left_elbow', 'left_wrist'), id=8, color=[0, 255, 0]),
118 | 9:
119 | dict(link=('right_hip', 'right_shoulder'), id=9, color=[255, 128, 0]),
120 | 10:
121 | dict(link=('left_hip', 'left_shoulder'), id=10, color=[0, 255, 0]),
122 | 11:
123 | dict(link=('right_shoulder', 'bottom_head'),
124 | id=11,
125 | color=[255, 128, 0]),
126 | 12:
127 | dict(link=('left_shoulder', 'bottom_head'), id=12, color=[0, 255, 0]),
128 | 13:
129 | dict(link=('bottom_head', 'top_head'), id=13, color=[51, 153, 255]),
130 | },
131 | joint_weights=[
132 | 1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.0, 1.0
133 | ],
134 | sigmas=[
135 | 0.089, 0.087, 0.107, 0.107, 0.087, 0.089, 0.062, 0.072, 0.079, 0.079,
136 | 0.072, 0.062, 0.026, 0.026
137 | ])
138 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/shelf.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='shelf',
3 | paper_info=dict(
4 | author='Belagiannis, Vasileios and Amin, Sikandar and Andriluka, '
5 | 'Mykhaylo and Schiele, Bernt and Navab, Nassir and Ilic, Slobodan',
6 | title='3D Pictorial Structures for Multiple Human Pose Estimation',
7 | container='IEEE Computer Society Conference on Computer Vision and '
8 | 'Pattern Recognition (CVPR)',
9 | year='2014',
10 | homepage='http://campar.in.tum.de/Chair/MultiHumanPose',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='right_ankle',
15 | id=0,
16 | color=[255, 128, 0],
17 | type='lower',
18 | swap='left_ankle'),
19 | 1:
20 | dict(name='right_knee',
21 | id=1,
22 | color=[255, 128, 0],
23 | type='lower',
24 | swap='left_knee'),
25 | 2:
26 | dict(name='right_hip',
27 | id=2,
28 | color=[255, 128, 0],
29 | type='lower',
30 | swap='left_hip'),
31 | 3:
32 | dict(name='left_hip',
33 | id=3,
34 | color=[0, 255, 0],
35 | type='lower',
36 | swap='right_hip'),
37 | 4:
38 | dict(name='left_knee',
39 | id=4,
40 | color=[0, 255, 0],
41 | type='lower',
42 | swap='right_knee'),
43 | 5:
44 | dict(name='left_ankle',
45 | id=5,
46 | color=[0, 255, 0],
47 | type='lower',
48 | swap='right_ankle'),
49 | 6:
50 | dict(name='right_wrist',
51 | id=6,
52 | color=[255, 128, 0],
53 | type='upper',
54 | swap='left_wrist'),
55 | 7:
56 | dict(name='right_elbow',
57 | id=7,
58 | color=[255, 128, 0],
59 | type='upper',
60 | swap='left_elbow'),
61 | 8:
62 | dict(name='right_shoulder',
63 | id=8,
64 | color=[255, 128, 0],
65 | type='upper',
66 | swap='left_shoulder'),
67 | 9:
68 | dict(name='left_shoulder',
69 | id=9,
70 | color=[0, 255, 0],
71 | type='upper',
72 | swap='right_shoulder'),
73 | 10:
74 | dict(name='left_elbow',
75 | id=10,
76 | color=[0, 255, 0],
77 | type='upper',
78 | swap='right_elbow'),
79 | 11:
80 | dict(name='left_wrist',
81 | id=11,
82 | color=[0, 255, 0],
83 | type='upper',
84 | swap='right_wrist'),
85 | 12:
86 | dict(name='bottom_head',
87 | id=12,
88 | color=[51, 153, 255],
89 | type='upper',
90 | swap=''),
91 | 13:
92 | dict(name='top_head',
93 | id=13,
94 | color=[51, 153, 255],
95 | type='upper',
96 | swap=''),
97 | },
98 | skeleton_info={
99 | 0:
100 | dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
101 | 1:
102 | dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
103 | 2:
104 | dict(link=('left_hip', 'left_knee'), id=2, color=[0, 255, 0]),
105 | 3:
106 | dict(link=('left_knee', 'left_ankle'), id=3, color=[0, 255, 0]),
107 | 4:
108 | dict(link=('right_hip', 'left_hip'), id=4, color=[51, 153, 255]),
109 | 5:
110 | dict(link=('right_wrist', 'right_elbow'), id=5, color=[255, 128, 0]),
111 | 6:
112 | dict(link=('right_elbow', 'right_shoulder'), id=6, color=[255, 128,
113 | 0]),
114 | 7:
115 | dict(link=('left_shoulder', 'left_elbow'), id=7, color=[0, 255, 0]),
116 | 8:
117 | dict(link=('left_elbow', 'left_wrist'), id=8, color=[0, 255, 0]),
118 | 9:
119 | dict(link=('right_hip', 'right_shoulder'), id=9, color=[255, 128, 0]),
120 | 10:
121 | dict(link=('left_hip', 'left_shoulder'), id=10, color=[0, 255, 0]),
122 | 11:
123 | dict(link=('right_shoulder', 'bottom_head'),
124 | id=11,
125 | color=[255, 128, 0]),
126 | 12:
127 | dict(link=('left_shoulder', 'bottom_head'), id=12, color=[0, 255, 0]),
128 | 13:
129 | dict(link=('bottom_head', 'top_head'), id=13, color=[51, 153, 255]),
130 | },
131 | joint_weights=[
132 | 1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.5, 1.2, 1.0, 1.0, 1.2, 1.5, 1.0, 1.0
133 | ],
134 | sigmas=[
135 | 0.089, 0.087, 0.107, 0.107, 0.087, 0.089, 0.062, 0.072, 0.079, 0.079,
136 | 0.072, 0.062, 0.026, 0.026
137 | ])
138 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/crowdpose.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='crowdpose',
3 | paper_info=dict(
4 | author='Li, Jiefeng and Wang, Can and Zhu, Hao and '
5 | 'Mao, Yihuan and Fang, Hao-Shu and Lu, Cewu',
6 | title='CrowdPose: Efficient Crowded Scenes Pose Estimation '
7 | 'and A New Benchmark',
8 | container='Proceedings of IEEE Conference on Computer '
9 | 'Vision and Pattern Recognition (CVPR)',
10 | year='2019',
11 | homepage='https://github.com/Jeff-sjtu/CrowdPose',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='left_shoulder',
16 | id=0,
17 | color=[51, 153, 255],
18 | type='upper',
19 | swap='right_shoulder'),
20 | 1:
21 | dict(name='right_shoulder',
22 | id=1,
23 | color=[51, 153, 255],
24 | type='upper',
25 | swap='left_shoulder'),
26 | 2:
27 | dict(name='left_elbow',
28 | id=2,
29 | color=[51, 153, 255],
30 | type='upper',
31 | swap='right_elbow'),
32 | 3:
33 | dict(name='right_elbow',
34 | id=3,
35 | color=[51, 153, 255],
36 | type='upper',
37 | swap='left_elbow'),
38 | 4:
39 | dict(name='left_wrist',
40 | id=4,
41 | color=[51, 153, 255],
42 | type='upper',
43 | swap='right_wrist'),
44 | 5:
45 | dict(name='right_wrist',
46 | id=5,
47 | color=[0, 255, 0],
48 | type='upper',
49 | swap='left_wrist'),
50 | 6:
51 | dict(name='left_hip',
52 | id=6,
53 | color=[255, 128, 0],
54 | type='lower',
55 | swap='right_hip'),
56 | 7:
57 | dict(name='right_hip',
58 | id=7,
59 | color=[0, 255, 0],
60 | type='lower',
61 | swap='left_hip'),
62 | 8:
63 | dict(name='left_knee',
64 | id=8,
65 | color=[255, 128, 0],
66 | type='lower',
67 | swap='right_knee'),
68 | 9:
69 | dict(name='right_knee',
70 | id=9,
71 | color=[0, 255, 0],
72 | type='lower',
73 | swap='left_knee'),
74 | 10:
75 | dict(name='left_ankle',
76 | id=10,
77 | color=[255, 128, 0],
78 | type='lower',
79 | swap='right_ankle'),
80 | 11:
81 | dict(name='right_ankle',
82 | id=11,
83 | color=[0, 255, 0],
84 | type='lower',
85 | swap='left_ankle'),
86 | 12:
87 | dict(name='top_head',
88 | id=12,
89 | color=[255, 128, 0],
90 | type='upper',
91 | swap=''),
92 | 13:
93 | dict(name='neck', id=13, color=[0, 255, 0], type='upper', swap='')
94 | },
95 | skeleton_info={
96 | 0:
97 | dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
98 | 1:
99 | dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
100 | 2:
101 | dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
102 | 3:
103 | dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
104 | 4:
105 | dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
106 | 5:
107 | dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
108 | 6:
109 | dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
110 | 7:
111 | dict(link=('left_shoulder', 'right_shoulder'),
112 | id=7,
113 | color=[51, 153, 255]),
114 | 8:
115 | dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
116 | 9:
117 | dict(link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128,
118 | 0]),
119 | 10:
120 | dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
121 | 11:
122 | dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
123 | 12:
124 | dict(link=('top_head', 'neck'), id=12, color=[51, 153, 255]),
125 | 13:
126 | dict(link=('right_shoulder', 'neck'), id=13, color=[51, 153, 255]),
127 | 14:
128 | dict(link=('left_shoulder', 'neck'), id=14, color=[51, 153, 255])
129 | },
130 | joint_weights=[
131 | 0.2, 0.2, 0.2, 1.3, 1.5, 0.2, 1.3, 1.5, 0.2, 0.2, 0.5, 0.2, 0.2, 0.5
132 | ],
133 | sigmas=[
134 | 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 0.107, 0.107, 0.087, 0.087,
135 | 0.089, 0.089, 0.079, 0.079
136 | ])
137 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/aic.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='aic',
3 | paper_info=dict(
4 | author='Wu, Jiahong and Zheng, He and Zhao, Bo and '
5 | 'Li, Yixin and Yan, Baoming and Liang, Rui and '
6 | 'Wang, Wenjia and Zhou, Shipei and Lin, Guosen and '
7 | 'Fu, Yanwei and others',
8 | title='Ai challenger: A large-scale dataset for going '
9 | 'deeper in image understanding',
10 | container='arXiv',
11 | year='2017',
12 | homepage='https://github.com/AIChallenger/AI_Challenger_2017',
13 | ),
14 | keypoint_info={
15 | 0:
16 | dict(name='right_shoulder',
17 | id=0,
18 | color=[255, 128, 0],
19 | type='upper',
20 | swap='left_shoulder'),
21 | 1:
22 | dict(name='right_elbow',
23 | id=1,
24 | color=[255, 128, 0],
25 | type='upper',
26 | swap='left_elbow'),
27 | 2:
28 | dict(name='right_wrist',
29 | id=2,
30 | color=[255, 128, 0],
31 | type='upper',
32 | swap='left_wrist'),
33 | 3:
34 | dict(name='left_shoulder',
35 | id=3,
36 | color=[0, 255, 0],
37 | type='upper',
38 | swap='right_shoulder'),
39 | 4:
40 | dict(name='left_elbow',
41 | id=4,
42 | color=[0, 255, 0],
43 | type='upper',
44 | swap='right_elbow'),
45 | 5:
46 | dict(name='left_wrist',
47 | id=5,
48 | color=[0, 255, 0],
49 | type='upper',
50 | swap='right_wrist'),
51 | 6:
52 | dict(name='right_hip',
53 | id=6,
54 | color=[255, 128, 0],
55 | type='lower',
56 | swap='left_hip'),
57 | 7:
58 | dict(name='right_knee',
59 | id=7,
60 | color=[255, 128, 0],
61 | type='lower',
62 | swap='left_knee'),
63 | 8:
64 | dict(name='right_ankle',
65 | id=8,
66 | color=[255, 128, 0],
67 | type='lower',
68 | swap='left_ankle'),
69 | 9:
70 | dict(name='left_hip',
71 | id=9,
72 | color=[0, 255, 0],
73 | type='lower',
74 | swap='right_hip'),
75 | 10:
76 | dict(name='left_knee',
77 | id=10,
78 | color=[0, 255, 0],
79 | type='lower',
80 | swap='right_knee'),
81 | 11:
82 | dict(name='left_ankle',
83 | id=11,
84 | color=[0, 255, 0],
85 | type='lower',
86 | swap='right_ankle'),
87 | 12:
88 | dict(name='head_top',
89 | id=12,
90 | color=[51, 153, 255],
91 | type='upper',
92 | swap=''),
93 | 13:
94 | dict(name='neck', id=13, color=[51, 153, 255], type='upper', swap='')
95 | },
96 | skeleton_info={
97 | 0: dict(link=('right_wrist', 'right_elbow'), id=0, color=[255, 128,
98 | 0]),
99 | 1: dict(link=('right_elbow', 'right_shoulder'),
100 | id=1,
101 | color=[255, 128, 0]),
102 | 2: dict(link=('right_shoulder', 'neck'), id=2, color=[51, 153, 255]),
103 | 3: dict(link=('neck', 'left_shoulder'), id=3, color=[51, 153, 255]),
104 | 4: dict(link=('left_shoulder', 'left_elbow'), id=4, color=[0, 255, 0]),
105 | 5: dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
106 | 6: dict(link=('right_ankle', 'right_knee'), id=6, color=[255, 128, 0]),
107 | 7: dict(link=('right_knee', 'right_hip'), id=7, color=[255, 128, 0]),
108 | 8: dict(link=('right_hip', 'left_hip'), id=8, color=[51, 153, 255]),
109 | 9: dict(link=('left_hip', 'left_knee'), id=9, color=[0, 255, 0]),
110 | 10: dict(link=('left_knee', 'left_ankle'), id=10, color=[0, 255, 0]),
111 | 11: dict(link=('head_top', 'neck'), id=11, color=[51, 153, 255]),
112 | 12: dict(link=('right_shoulder', 'right_hip'),
113 | id=12,
114 | color=[51, 153, 255]),
115 | 13: dict(link=('left_shoulder', 'left_hip'),
116 | id=13,
117 | color=[51, 153, 255])
118 | },
119 | joint_weights=[
120 | 1., 1.2, 1.5, 1., 1.2, 1.5, 1., 1.2, 1.5, 1., 1.2, 1.5, 1., 1.
121 | ],
122 |
123 | # 'https://github.com/AIChallenger/AI_Challenger_2017/blob/master/'
124 | # 'Evaluation/keypoint_eval/keypoint_eval.py#L50'
125 | # delta = 2 x sigma
126 | sigmas=[
127 | 0.01388152, 0.01515228, 0.01057665, 0.01417709, 0.01497891, 0.01402144,
128 | 0.03909642, 0.03686941, 0.01981803, 0.03843971, 0.03412318, 0.02415081,
129 | 0.01291456, 0.01236173
130 | ])
131 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/ap10k.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='ap10k',
3 | paper_info=dict(
4 | author='Yu, Hang and Xu, Yufei and Zhang, Jing and '
5 | 'Zhao, Wei and Guan, Ziyu and Tao, Dacheng',
6 | title='AP-10K: A Benchmark for Animal Pose Estimation in the Wild',
7 | container='35th Conference on Neural Information Processing Systems '
8 | '(NeurIPS 2021) Track on Datasets and Bench-marks.',
9 | year='2021',
10 | homepage='https://github.com/AlexTheBad/AP-10K',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='L_Eye', id=0, color=[0, 255, 0], type='upper',
15 | swap='R_Eye'),
16 | 1:
17 | dict(name='R_Eye',
18 | id=1,
19 | color=[255, 128, 0],
20 | type='upper',
21 | swap='L_Eye'),
22 | 2:
23 | dict(name='Nose', id=2, color=[51, 153, 255], type='upper', swap=''),
24 | 3:
25 | dict(name='Neck', id=3, color=[51, 153, 255], type='upper', swap=''),
26 | 4:
27 | dict(name='Root of tail',
28 | id=4,
29 | color=[51, 153, 255],
30 | type='lower',
31 | swap=''),
32 | 5:
33 | dict(name='L_Shoulder',
34 | id=5,
35 | color=[51, 153, 255],
36 | type='upper',
37 | swap='R_Shoulder'),
38 | 6:
39 | dict(name='L_Elbow',
40 | id=6,
41 | color=[51, 153, 255],
42 | type='upper',
43 | swap='R_Elbow'),
44 | 7:
45 | dict(name='L_F_Paw',
46 | id=7,
47 | color=[0, 255, 0],
48 | type='upper',
49 | swap='R_F_Paw'),
50 | 8:
51 | dict(name='R_Shoulder',
52 | id=8,
53 | color=[0, 255, 0],
54 | type='upper',
55 | swap='L_Shoulder'),
56 | 9:
57 | dict(name='R_Elbow',
58 | id=9,
59 | color=[255, 128, 0],
60 | type='upper',
61 | swap='L_Elbow'),
62 | 10:
63 | dict(name='R_F_Paw',
64 | id=10,
65 | color=[0, 255, 0],
66 | type='lower',
67 | swap='L_F_Paw'),
68 | 11:
69 | dict(name='L_Hip',
70 | id=11,
71 | color=[255, 128, 0],
72 | type='lower',
73 | swap='R_Hip'),
74 | 12:
75 | dict(name='L_Knee',
76 | id=12,
77 | color=[255, 128, 0],
78 | type='lower',
79 | swap='R_Knee'),
80 | 13:
81 | dict(name='L_B_Paw',
82 | id=13,
83 | color=[0, 255, 0],
84 | type='lower',
85 | swap='R_B_Paw'),
86 | 14:
87 | dict(name='R_Hip',
88 | id=14,
89 | color=[0, 255, 0],
90 | type='lower',
91 | swap='L_Hip'),
92 | 15:
93 | dict(name='R_Knee',
94 | id=15,
95 | color=[0, 255, 0],
96 | type='lower',
97 | swap='L_Knee'),
98 | 16:
99 | dict(name='R_B_Paw',
100 | id=16,
101 | color=[0, 255, 0],
102 | type='lower',
103 | swap='L_B_Paw'),
104 | },
105 | skeleton_info={
106 | 0: dict(link=('L_Eye', 'R_Eye'), id=0, color=[0, 0, 255]),
107 | 1: dict(link=('L_Eye', 'Nose'), id=1, color=[0, 0, 255]),
108 | 2: dict(link=('R_Eye', 'Nose'), id=2, color=[0, 0, 255]),
109 | 3: dict(link=('Nose', 'Neck'), id=3, color=[0, 255, 0]),
110 | 4: dict(link=('Neck', 'Root of tail'), id=4, color=[0, 255, 0]),
111 | 5: dict(link=('Neck', 'L_Shoulder'), id=5, color=[0, 255, 255]),
112 | 6: dict(link=('L_Shoulder', 'L_Elbow'), id=6, color=[0, 255, 255]),
113 | 7: dict(link=('L_Elbow', 'L_F_Paw'), id=6, color=[0, 255, 255]),
114 | 8: dict(link=('Neck', 'R_Shoulder'), id=7, color=[6, 156, 250]),
115 | 9: dict(link=('R_Shoulder', 'R_Elbow'), id=8, color=[6, 156, 250]),
116 | 10: dict(link=('R_Elbow', 'R_F_Paw'), id=9, color=[6, 156, 250]),
117 | 11: dict(link=('Root of tail', 'L_Hip'), id=10, color=[0, 255, 255]),
118 | 12: dict(link=('L_Hip', 'L_Knee'), id=11, color=[0, 255, 255]),
119 | 13: dict(link=('L_Knee', 'L_B_Paw'), id=12, color=[0, 255, 255]),
120 | 14: dict(link=('Root of tail', 'R_Hip'), id=13, color=[6, 156, 250]),
121 | 15: dict(link=('R_Hip', 'R_Knee'), id=14, color=[6, 156, 250]),
122 | 16: dict(link=('R_Knee', 'R_B_Paw'), id=15, color=[6, 156, 250]),
123 | },
124 | joint_weights=[
125 | 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
126 | 1.5
127 | ],
128 | sigmas=[
129 | 0.025, 0.025, 0.026, 0.035, 0.035, 0.079, 0.072, 0.062, 0.079, 0.072,
130 | 0.062, 0.107, 0.087, 0.089, 0.107, 0.087, 0.089
131 | ])
132 |
--------------------------------------------------------------------------------
/model_configs/mmpose/vipnas_mbv3_coco_wholebody_256x192_dark.py:
--------------------------------------------------------------------------------
1 | _base_ = ['./_base_/default_runtime.py', './_base_/datasets/coco_wholebody.py']
2 | evaluation = dict(interval=10, metric='mAP', save_best='AP')
3 |
4 | optimizer = dict(
5 | type='Adam',
6 | lr=5e-4,
7 | )
8 | optimizer_config = dict(grad_clip=None)
9 | # learning policy
10 | lr_config = dict(policy='step',
11 | warmup='linear',
12 | warmup_iters=500,
13 | warmup_ratio=0.001,
14 | step=[170, 200])
15 | total_epochs = 210
16 | channel_cfg = dict(num_output_channels=133,
17 | dataset_joints=133,
18 | dataset_channel=[
19 | list(range(133)),
20 | ],
21 | inference_channel=list(range(133)))
22 |
23 | # model settings
24 | model = dict(type='TopDown',
25 | pretrained=None,
26 | backbone=dict(type='ViPNAS_MobileNetV3'),
27 | keypoint_head=dict(
28 | type='ViPNASHeatmapSimpleHead',
29 | in_channels=160,
30 | out_channels=channel_cfg['num_output_channels'],
31 | num_deconv_filters=(160, 160, 160),
32 | num_deconv_groups=(160, 160, 160),
33 | loss_keypoint=dict(type='JointsMSELoss',
34 | use_target_weight=True)),
35 | train_cfg=dict(),
36 | test_cfg=dict(flip_test=True,
37 | post_process='unbiased',
38 | shift_heatmap=True,
39 | modulate_kernel=11))
40 |
41 | data_cfg = dict(
42 | image_size=[192, 256],
43 | heatmap_size=[48, 64],
44 | num_output_channels=channel_cfg['num_output_channels'],
45 | num_joints=channel_cfg['dataset_joints'],
46 | dataset_channel=channel_cfg['dataset_channel'],
47 | inference_channel=channel_cfg['inference_channel'],
48 | soft_nms=False,
49 | nms_thr=1.0,
50 | oks_thr=0.9,
51 | vis_thr=0.2,
52 | use_gt_bbox=False,
53 | det_bbox_thr=0.0,
54 | bbox_file='data/coco/person_detection_results/'
55 | 'COCO_val2017_detections_AP_H_56_person.json',
56 | )
57 |
58 | train_pipeline = [
59 | dict(type='LoadImageFromFile'),
60 | dict(type='TopDownGetBboxCenterScale', padding=1.25),
61 | dict(type='TopDownRandomShiftBboxCenter', shift_factor=0.16, prob=0.3),
62 | dict(type='TopDownRandomFlip', flip_prob=0.5),
63 | dict(type='TopDownHalfBodyTransform',
64 | num_joints_half_body=8,
65 | prob_half_body=0.3),
66 | dict(type='TopDownGetRandomScaleRotation',
67 | rot_factor=30,
68 | scale_factor=0.25),
69 | dict(type='TopDownAffine'),
70 | dict(type='ToTensor'),
71 | dict(type='NormalizeTensor',
72 | mean=[0.485, 0.456, 0.406],
73 | std=[0.229, 0.224, 0.225]),
74 | dict(type='TopDownGenerateTarget', sigma=2, unbiased_encoding=True),
75 | dict(type='Collect',
76 | keys=['img', 'target', 'target_weight'],
77 | meta_keys=[
78 | 'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
79 | 'rotation', 'bbox_score', 'flip_pairs'
80 | ]),
81 | ]
82 |
83 | val_pipeline = [
84 | dict(type='LoadImageFromFile'),
85 | dict(type='TopDownGetBboxCenterScale', padding=1.25),
86 | dict(type='TopDownAffine'),
87 | dict(type='ToTensor'),
88 | dict(type='NormalizeTensor',
89 | mean=[0.485, 0.456, 0.406],
90 | std=[0.229, 0.224, 0.225]),
91 | dict(type='Collect',
92 | keys=['img'],
93 | meta_keys=[
94 | 'image_file', 'center', 'scale', 'rotation', 'bbox_score',
95 | 'flip_pairs'
96 | ]),
97 | ]
98 |
99 | test_pipeline = val_pipeline
100 |
101 | data_root = 'data/coco'
102 | data = dict(
103 | samples_per_gpu=64,
104 | workers_per_gpu=2,
105 | val_dataloader=dict(samples_per_gpu=32),
106 | test_dataloader=dict(samples_per_gpu=32),
107 | train=dict(
108 | type='TopDownCocoWholeBodyDataset',
109 | ann_file=f'{data_root}/annotations/coco_wholebody_train_v1.0.json',
110 | img_prefix=f'{data_root}/train2017/',
111 | data_cfg=data_cfg,
112 | pipeline=train_pipeline,
113 | dataset_info={{_base_.dataset_info}}),
114 | val=dict(type='TopDownCocoWholeBodyDataset',
115 | ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
116 | img_prefix=f'{data_root}/val2017/',
117 | data_cfg=data_cfg,
118 | pipeline=val_pipeline,
119 | dataset_info={{_base_.dataset_info}}),
120 | test=dict(type='TopDownCocoWholeBodyDataset',
121 | ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
122 | img_prefix=f'{data_root}/val2017/',
123 | data_cfg=data_cfg,
124 | pipeline=test_pipeline,
125 | dataset_info={{_base_.dataset_info}}),
126 | )
127 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/h36m.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='h36m',
3 | paper_info=dict(
4 | author='Ionescu, Catalin and Papava, Dragos and '
5 | 'Olaru, Vlad and Sminchisescu, Cristian',
6 | title='Human3.6M: Large Scale Datasets and Predictive '
7 | 'Methods for 3D Human Sensing in Natural Environments',
8 | container='IEEE Transactions on Pattern Analysis and '
9 | 'Machine Intelligence',
10 | year='2014',
11 | homepage='http://vision.imar.ro/human3.6m/description.php',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='root', id=0, color=[51, 153, 255], type='lower', swap=''),
16 | 1:
17 | dict(name='right_hip',
18 | id=1,
19 | color=[255, 128, 0],
20 | type='lower',
21 | swap='left_hip'),
22 | 2:
23 | dict(name='right_knee',
24 | id=2,
25 | color=[255, 128, 0],
26 | type='lower',
27 | swap='left_knee'),
28 | 3:
29 | dict(name='right_foot',
30 | id=3,
31 | color=[255, 128, 0],
32 | type='lower',
33 | swap='left_foot'),
34 | 4:
35 | dict(name='left_hip',
36 | id=4,
37 | color=[0, 255, 0],
38 | type='lower',
39 | swap='right_hip'),
40 | 5:
41 | dict(name='left_knee',
42 | id=5,
43 | color=[0, 255, 0],
44 | type='lower',
45 | swap='right_knee'),
46 | 6:
47 | dict(name='left_foot',
48 | id=6,
49 | color=[0, 255, 0],
50 | type='lower',
51 | swap='right_foot'),
52 | 7:
53 | dict(name='spine', id=7, color=[51, 153, 255], type='upper', swap=''),
54 | 8:
55 | dict(name='thorax', id=8, color=[51, 153, 255], type='upper', swap=''),
56 | 9:
57 | dict(name='neck_base',
58 | id=9,
59 | color=[51, 153, 255],
60 | type='upper',
61 | swap=''),
62 | 10:
63 | dict(name='head', id=10, color=[51, 153, 255], type='upper', swap=''),
64 | 11:
65 | dict(name='left_shoulder',
66 | id=11,
67 | color=[0, 255, 0],
68 | type='upper',
69 | swap='right_shoulder'),
70 | 12:
71 | dict(name='left_elbow',
72 | id=12,
73 | color=[0, 255, 0],
74 | type='upper',
75 | swap='right_elbow'),
76 | 13:
77 | dict(name='left_wrist',
78 | id=13,
79 | color=[0, 255, 0],
80 | type='upper',
81 | swap='right_wrist'),
82 | 14:
83 | dict(name='right_shoulder',
84 | id=14,
85 | color=[255, 128, 0],
86 | type='upper',
87 | swap='left_shoulder'),
88 | 15:
89 | dict(name='right_elbow',
90 | id=15,
91 | color=[255, 128, 0],
92 | type='upper',
93 | swap='left_elbow'),
94 | 16:
95 | dict(name='right_wrist',
96 | id=16,
97 | color=[255, 128, 0],
98 | type='upper',
99 | swap='left_wrist')
100 | },
101 | skeleton_info={
102 | 0:
103 | dict(link=('root', 'left_hip'), id=0, color=[0, 255, 0]),
104 | 1:
105 | dict(link=('left_hip', 'left_knee'), id=1, color=[0, 255, 0]),
106 | 2:
107 | dict(link=('left_knee', 'left_foot'), id=2, color=[0, 255, 0]),
108 | 3:
109 | dict(link=('root', 'right_hip'), id=3, color=[255, 128, 0]),
110 | 4:
111 | dict(link=('right_hip', 'right_knee'), id=4, color=[255, 128, 0]),
112 | 5:
113 | dict(link=('right_knee', 'right_foot'), id=5, color=[255, 128, 0]),
114 | 6:
115 | dict(link=('root', 'spine'), id=6, color=[51, 153, 255]),
116 | 7:
117 | dict(link=('spine', 'thorax'), id=7, color=[51, 153, 255]),
118 | 8:
119 | dict(link=('thorax', 'neck_base'), id=8, color=[51, 153, 255]),
120 | 9:
121 | dict(link=('neck_base', 'head'), id=9, color=[51, 153, 255]),
122 | 10:
123 | dict(link=('thorax', 'left_shoulder'), id=10, color=[0, 255, 0]),
124 | 11:
125 | dict(link=('left_shoulder', 'left_elbow'), id=11, color=[0, 255, 0]),
126 | 12:
127 | dict(link=('left_elbow', 'left_wrist'), id=12, color=[0, 255, 0]),
128 | 13:
129 | dict(link=('thorax', 'right_shoulder'), id=13, color=[255, 128, 0]),
130 | 14:
131 | dict(link=('right_shoulder', 'right_elbow'),
132 | id=14,
133 | color=[255, 128, 0]),
134 | 15:
135 | dict(link=('right_elbow', 'right_wrist'), id=15, color=[255, 128, 0])
136 | },
137 | joint_weights=[1.] * 17,
138 | sigmas=[],
139 | stats_info=dict(bbox_center=(528., 427.), bbox_scale=400.))
140 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/mpii.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='mpii',
3 | paper_info=dict(
4 | author='Mykhaylo Andriluka and Leonid Pishchulin and '
5 | 'Peter Gehler and Schiele, Bernt',
6 | title='2D Human Pose Estimation: New Benchmark and '
7 | 'State of the Art Analysis',
8 | container='IEEE Conference on Computer Vision and '
9 | 'Pattern Recognition (CVPR)',
10 | year='2014',
11 | homepage='http://human-pose.mpi-inf.mpg.de/',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='right_ankle',
16 | id=0,
17 | color=[255, 128, 0],
18 | type='lower',
19 | swap='left_ankle'),
20 | 1:
21 | dict(name='right_knee',
22 | id=1,
23 | color=[255, 128, 0],
24 | type='lower',
25 | swap='left_knee'),
26 | 2:
27 | dict(name='right_hip',
28 | id=2,
29 | color=[255, 128, 0],
30 | type='lower',
31 | swap='left_hip'),
32 | 3:
33 | dict(name='left_hip',
34 | id=3,
35 | color=[0, 255, 0],
36 | type='lower',
37 | swap='right_hip'),
38 | 4:
39 | dict(name='left_knee',
40 | id=4,
41 | color=[0, 255, 0],
42 | type='lower',
43 | swap='right_knee'),
44 | 5:
45 | dict(name='left_ankle',
46 | id=5,
47 | color=[0, 255, 0],
48 | type='lower',
49 | swap='right_ankle'),
50 | 6:
51 | dict(name='pelvis', id=6, color=[51, 153, 255], type='lower', swap=''),
52 | 7:
53 | dict(name='thorax', id=7, color=[51, 153, 255], type='upper', swap=''),
54 | 8:
55 | dict(name='upper_neck',
56 | id=8,
57 | color=[51, 153, 255],
58 | type='upper',
59 | swap=''),
60 | 9:
61 | dict(name='head_top',
62 | id=9,
63 | color=[51, 153, 255],
64 | type='upper',
65 | swap=''),
66 | 10:
67 | dict(name='right_wrist',
68 | id=10,
69 | color=[255, 128, 0],
70 | type='upper',
71 | swap='left_wrist'),
72 | 11:
73 | dict(name='right_elbow',
74 | id=11,
75 | color=[255, 128, 0],
76 | type='upper',
77 | swap='left_elbow'),
78 | 12:
79 | dict(name='right_shoulder',
80 | id=12,
81 | color=[255, 128, 0],
82 | type='upper',
83 | swap='left_shoulder'),
84 | 13:
85 | dict(name='left_shoulder',
86 | id=13,
87 | color=[0, 255, 0],
88 | type='upper',
89 | swap='right_shoulder'),
90 | 14:
91 | dict(name='left_elbow',
92 | id=14,
93 | color=[0, 255, 0],
94 | type='upper',
95 | swap='right_elbow'),
96 | 15:
97 | dict(name='left_wrist',
98 | id=15,
99 | color=[0, 255, 0],
100 | type='upper',
101 | swap='right_wrist')
102 | },
103 | skeleton_info={
104 | 0:
105 | dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
106 | 1:
107 | dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
108 | 2:
109 | dict(link=('right_hip', 'pelvis'), id=2, color=[255, 128, 0]),
110 | 3:
111 | dict(link=('pelvis', 'left_hip'), id=3, color=[0, 255, 0]),
112 | 4:
113 | dict(link=('left_hip', 'left_knee'), id=4, color=[0, 255, 0]),
114 | 5:
115 | dict(link=('left_knee', 'left_ankle'), id=5, color=[0, 255, 0]),
116 | 6:
117 | dict(link=('pelvis', 'thorax'), id=6, color=[51, 153, 255]),
118 | 7:
119 | dict(link=('thorax', 'upper_neck'), id=7, color=[51, 153, 255]),
120 | 8:
121 | dict(link=('upper_neck', 'head_top'), id=8, color=[51, 153, 255]),
122 | 9:
123 | dict(link=('upper_neck', 'right_shoulder'), id=9, color=[255, 128, 0]),
124 | 10:
125 | dict(link=('right_shoulder', 'right_elbow'),
126 | id=10,
127 | color=[255, 128, 0]),
128 | 11:
129 | dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
130 | 12:
131 | dict(link=('upper_neck', 'left_shoulder'), id=12, color=[0, 255, 0]),
132 | 13:
133 | dict(link=('left_shoulder', 'left_elbow'), id=13, color=[0, 255, 0]),
134 | 14:
135 | dict(link=('left_elbow', 'left_wrist'), id=14, color=[0, 255, 0])
136 | },
137 | joint_weights=[
138 | 1.5, 1.2, 1., 1., 1.2, 1.5, 1., 1., 1., 1., 1.5, 1.2, 1., 1., 1.2, 1.5
139 | ],
140 | # Adapted from COCO dataset.
141 | sigmas=[
142 | 0.089, 0.083, 0.107, 0.107, 0.083, 0.089, 0.026, 0.026, 0.026, 0.026,
143 | 0.062, 0.072, 0.179, 0.179, 0.072, 0.062
144 | ])
145 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/mhp.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='mhp',
3 | paper_info=dict(
4 | author='Zhao, Jian and Li, Jianshu and Cheng, Yu and '
5 | 'Sim, Terence and Yan, Shuicheng and Feng, Jiashi',
6 | title='Understanding humans in crowded scenes: '
7 | 'Deep nested adversarial learning and a '
8 | 'new benchmark for multi-human parsing',
9 | container='Proceedings of the 26th ACM '
10 | 'international conference on Multimedia',
11 | year='2018',
12 | homepage='https://lv-mhp.github.io/dataset',
13 | ),
14 | keypoint_info={
15 | 0:
16 | dict(name='right_ankle',
17 | id=0,
18 | color=[255, 128, 0],
19 | type='lower',
20 | swap='left_ankle'),
21 | 1:
22 | dict(name='right_knee',
23 | id=1,
24 | color=[255, 128, 0],
25 | type='lower',
26 | swap='left_knee'),
27 | 2:
28 | dict(name='right_hip',
29 | id=2,
30 | color=[255, 128, 0],
31 | type='lower',
32 | swap='left_hip'),
33 | 3:
34 | dict(name='left_hip',
35 | id=3,
36 | color=[0, 255, 0],
37 | type='lower',
38 | swap='right_hip'),
39 | 4:
40 | dict(name='left_knee',
41 | id=4,
42 | color=[0, 255, 0],
43 | type='lower',
44 | swap='right_knee'),
45 | 5:
46 | dict(name='left_ankle',
47 | id=5,
48 | color=[0, 255, 0],
49 | type='lower',
50 | swap='right_ankle'),
51 | 6:
52 | dict(name='pelvis', id=6, color=[51, 153, 255], type='lower', swap=''),
53 | 7:
54 | dict(name='thorax', id=7, color=[51, 153, 255], type='upper', swap=''),
55 | 8:
56 | dict(name='upper_neck',
57 | id=8,
58 | color=[51, 153, 255],
59 | type='upper',
60 | swap=''),
61 | 9:
62 | dict(name='head_top',
63 | id=9,
64 | color=[51, 153, 255],
65 | type='upper',
66 | swap=''),
67 | 10:
68 | dict(name='right_wrist',
69 | id=10,
70 | color=[255, 128, 0],
71 | type='upper',
72 | swap='left_wrist'),
73 | 11:
74 | dict(name='right_elbow',
75 | id=11,
76 | color=[255, 128, 0],
77 | type='upper',
78 | swap='left_elbow'),
79 | 12:
80 | dict(name='right_shoulder',
81 | id=12,
82 | color=[255, 128, 0],
83 | type='upper',
84 | swap='left_shoulder'),
85 | 13:
86 | dict(name='left_shoulder',
87 | id=13,
88 | color=[0, 255, 0],
89 | type='upper',
90 | swap='right_shoulder'),
91 | 14:
92 | dict(name='left_elbow',
93 | id=14,
94 | color=[0, 255, 0],
95 | type='upper',
96 | swap='right_elbow'),
97 | 15:
98 | dict(name='left_wrist',
99 | id=15,
100 | color=[0, 255, 0],
101 | type='upper',
102 | swap='right_wrist')
103 | },
104 | skeleton_info={
105 | 0:
106 | dict(link=('right_ankle', 'right_knee'), id=0, color=[255, 128, 0]),
107 | 1:
108 | dict(link=('right_knee', 'right_hip'), id=1, color=[255, 128, 0]),
109 | 2:
110 | dict(link=('right_hip', 'pelvis'), id=2, color=[255, 128, 0]),
111 | 3:
112 | dict(link=('pelvis', 'left_hip'), id=3, color=[0, 255, 0]),
113 | 4:
114 | dict(link=('left_hip', 'left_knee'), id=4, color=[0, 255, 0]),
115 | 5:
116 | dict(link=('left_knee', 'left_ankle'), id=5, color=[0, 255, 0]),
117 | 6:
118 | dict(link=('pelvis', 'thorax'), id=6, color=[51, 153, 255]),
119 | 7:
120 | dict(link=('thorax', 'upper_neck'), id=7, color=[51, 153, 255]),
121 | 8:
122 | dict(link=('upper_neck', 'head_top'), id=8, color=[51, 153, 255]),
123 | 9:
124 | dict(link=('upper_neck', 'right_shoulder'), id=9, color=[255, 128, 0]),
125 | 10:
126 | dict(link=('right_shoulder', 'right_elbow'),
127 | id=10,
128 | color=[255, 128, 0]),
129 | 11:
130 | dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
131 | 12:
132 | dict(link=('upper_neck', 'left_shoulder'), id=12, color=[0, 255, 0]),
133 | 13:
134 | dict(link=('left_shoulder', 'left_elbow'), id=13, color=[0, 255, 0]),
135 | 14:
136 | dict(link=('left_elbow', 'left_wrist'), id=14, color=[0, 255, 0])
137 | },
138 | joint_weights=[
139 | 1.5, 1.2, 1., 1., 1.2, 1.5, 1., 1., 1., 1., 1.5, 1.2, 1., 1., 1.2, 1.5
140 | ],
141 | # Adapted from COCO dataset.
142 | sigmas=[
143 | 0.089, 0.083, 0.107, 0.107, 0.083, 0.089, 0.026, 0.026, 0.026, 0.026,
144 | 0.062, 0.072, 0.179, 0.179, 0.072, 0.062
145 | ])
146 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/interhand2d.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='interhand2d',
3 | paper_info=dict(
4 | author='Moon, Gyeongsik and Yu, Shoou-I and Wen, He and '
5 | 'Shiratori, Takaaki and Lee, Kyoung Mu',
6 | title='InterHand2.6M: A dataset and baseline for 3D '
7 | 'interacting hand pose estimation from a single RGB image',
8 | container='arXiv',
9 | year='2020',
10 | homepage='https://mks0601.github.io/InterHand2.6M/',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='thumb4', id=0, color=[255, 128, 0], type='', swap=''),
15 | 1:
16 | dict(name='thumb3', id=1, color=[255, 128, 0], type='', swap=''),
17 | 2:
18 | dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
19 | 3:
20 | dict(name='thumb1', id=3, color=[255, 128, 0], type='', swap=''),
21 | 4:
22 | dict(name='forefinger4', id=4, color=[255, 153, 255], type='',
23 | swap=''),
24 | 5:
25 | dict(name='forefinger3', id=5, color=[255, 153, 255], type='',
26 | swap=''),
27 | 6:
28 | dict(name='forefinger2', id=6, color=[255, 153, 255], type='',
29 | swap=''),
30 | 7:
31 | dict(name='forefinger1', id=7, color=[255, 153, 255], type='',
32 | swap=''),
33 | 8:
34 | dict(name='middle_finger4',
35 | id=8,
36 | color=[102, 178, 255],
37 | type='',
38 | swap=''),
39 | 9:
40 | dict(name='middle_finger3',
41 | id=9,
42 | color=[102, 178, 255],
43 | type='',
44 | swap=''),
45 | 10:
46 | dict(name='middle_finger2',
47 | id=10,
48 | color=[102, 178, 255],
49 | type='',
50 | swap=''),
51 | 11:
52 | dict(name='middle_finger1',
53 | id=11,
54 | color=[102, 178, 255],
55 | type='',
56 | swap=''),
57 | 12:
58 | dict(name='ring_finger4', id=12, color=[255, 51, 51], type='',
59 | swap=''),
60 | 13:
61 | dict(name='ring_finger3', id=13, color=[255, 51, 51], type='',
62 | swap=''),
63 | 14:
64 | dict(name='ring_finger2', id=14, color=[255, 51, 51], type='',
65 | swap=''),
66 | 15:
67 | dict(name='ring_finger1', id=15, color=[255, 51, 51], type='',
68 | swap=''),
69 | 16:
70 | dict(name='pinky_finger4', id=16, color=[0, 255, 0], type='', swap=''),
71 | 17:
72 | dict(name='pinky_finger3', id=17, color=[0, 255, 0], type='', swap=''),
73 | 18:
74 | dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
75 | 19:
76 | dict(name='pinky_finger1', id=19, color=[0, 255, 0], type='', swap=''),
77 | 20:
78 | dict(name='wrist', id=20, color=[255, 255, 255], type='', swap='')
79 | },
80 | skeleton_info={
81 | 0:
82 | dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
83 | 1:
84 | dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
85 | 2:
86 | dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
87 | 3:
88 | dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
89 | 4:
90 | dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
91 | 5:
92 | dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
93 | 6:
94 | dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
95 | 7:
96 | dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
97 | 8:
98 | dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
99 | 9:
100 | dict(link=('middle_finger1', 'middle_finger2'),
101 | id=9,
102 | color=[102, 178, 255]),
103 | 10:
104 | dict(link=('middle_finger2', 'middle_finger3'),
105 | id=10,
106 | color=[102, 178, 255]),
107 | 11:
108 | dict(link=('middle_finger3', 'middle_finger4'),
109 | id=11,
110 | color=[102, 178, 255]),
111 | 12:
112 | dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
113 | 13:
114 | dict(link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51,
115 | 51]),
116 | 14:
117 | dict(link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51,
118 | 51]),
119 | 15:
120 | dict(link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51,
121 | 51]),
122 | 16:
123 | dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
124 | 17:
125 | dict(link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255,
126 | 0]),
127 | 18:
128 | dict(link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255,
129 | 0]),
130 | 19:
131 | dict(link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
132 | },
133 | joint_weights=[1.] * 21,
134 | sigmas=[])
135 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/onehand10k.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='onehand10k',
3 | paper_info=dict(
4 | author='Wang, Yangang and Peng, Cong and Liu, Yebin',
5 | title='Mask-pose cascaded cnn for 2d hand pose estimation '
6 | 'from single color image',
7 | container='IEEE Transactions on Circuits and Systems '
8 | 'for Video Technology',
9 | year='2018',
10 | homepage='https://www.yangangwang.com/papers/WANG-MCC-2018-10.html',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
15 | 1:
16 | dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
17 | 2:
18 | dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
19 | 3:
20 | dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
21 | 4:
22 | dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
23 | 5:
24 | dict(name='forefinger1', id=5, color=[255, 153, 255], type='',
25 | swap=''),
26 | 6:
27 | dict(name='forefinger2', id=6, color=[255, 153, 255], type='',
28 | swap=''),
29 | 7:
30 | dict(name='forefinger3', id=7, color=[255, 153, 255], type='',
31 | swap=''),
32 | 8:
33 | dict(name='forefinger4', id=8, color=[255, 153, 255], type='',
34 | swap=''),
35 | 9:
36 | dict(name='middle_finger1',
37 | id=9,
38 | color=[102, 178, 255],
39 | type='',
40 | swap=''),
41 | 10:
42 | dict(name='middle_finger2',
43 | id=10,
44 | color=[102, 178, 255],
45 | type='',
46 | swap=''),
47 | 11:
48 | dict(name='middle_finger3',
49 | id=11,
50 | color=[102, 178, 255],
51 | type='',
52 | swap=''),
53 | 12:
54 | dict(name='middle_finger4',
55 | id=12,
56 | color=[102, 178, 255],
57 | type='',
58 | swap=''),
59 | 13:
60 | dict(name='ring_finger1', id=13, color=[255, 51, 51], type='',
61 | swap=''),
62 | 14:
63 | dict(name='ring_finger2', id=14, color=[255, 51, 51], type='',
64 | swap=''),
65 | 15:
66 | dict(name='ring_finger3', id=15, color=[255, 51, 51], type='',
67 | swap=''),
68 | 16:
69 | dict(name='ring_finger4', id=16, color=[255, 51, 51], type='',
70 | swap=''),
71 | 17:
72 | dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
73 | 18:
74 | dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
75 | 19:
76 | dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
77 | 20:
78 | dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
79 | },
80 | skeleton_info={
81 | 0:
82 | dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
83 | 1:
84 | dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
85 | 2:
86 | dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
87 | 3:
88 | dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
89 | 4:
90 | dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
91 | 5:
92 | dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
93 | 6:
94 | dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
95 | 7:
96 | dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
97 | 8:
98 | dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
99 | 9:
100 | dict(link=('middle_finger1', 'middle_finger2'),
101 | id=9,
102 | color=[102, 178, 255]),
103 | 10:
104 | dict(link=('middle_finger2', 'middle_finger3'),
105 | id=10,
106 | color=[102, 178, 255]),
107 | 11:
108 | dict(link=('middle_finger3', 'middle_finger4'),
109 | id=11,
110 | color=[102, 178, 255]),
111 | 12:
112 | dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
113 | 13:
114 | dict(link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51,
115 | 51]),
116 | 14:
117 | dict(link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51,
118 | 51]),
119 | 15:
120 | dict(link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51,
121 | 51]),
122 | 16:
123 | dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
124 | 17:
125 | dict(link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255,
126 | 0]),
127 | 18:
128 | dict(link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255,
129 | 0]),
130 | 19:
131 | dict(link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
132 | },
133 | joint_weights=[1.] * 21,
134 | sigmas=[])
135 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/panoptic_body3d.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='panoptic_pose_3d',
3 | paper_info=dict(
4 | author='Joo, Hanbyul and Simon, Tomas and Li, Xulong'
5 | 'and Liu, Hao and Tan, Lei and Gui, Lin and Banerjee, Sean'
6 | 'and Godisart, Timothy and Nabbe, Bart and Matthews, Iain'
7 | 'and Kanade, Takeo and Nobuhara, Shohei and Sheikh, Yaser',
8 | title='Panoptic Studio: A Massively Multiview System '
9 | 'for Interaction Motion Capture',
10 | container='IEEE Transactions on Pattern Analysis'
11 | ' and Machine Intelligence',
12 | year='2017',
13 | homepage='http://domedb.perception.cs.cmu.edu',
14 | ),
15 | keypoint_info={
16 | 0:
17 | dict(name='neck', id=0, color=[51, 153, 255], type='upper', swap=''),
18 | 1:
19 | dict(name='nose', id=1, color=[51, 153, 255], type='upper', swap=''),
20 | 2:
21 | dict(name='mid_hip', id=2, color=[0, 255, 0], type='lower', swap=''),
22 | 3:
23 | dict(name='left_shoulder',
24 | id=3,
25 | color=[0, 255, 0],
26 | type='upper',
27 | swap='right_shoulder'),
28 | 4:
29 | dict(name='left_elbow',
30 | id=4,
31 | color=[0, 255, 0],
32 | type='upper',
33 | swap='right_elbow'),
34 | 5:
35 | dict(name='left_wrist',
36 | id=5,
37 | color=[0, 255, 0],
38 | type='upper',
39 | swap='right_wrist'),
40 | 6:
41 | dict(name='left_hip',
42 | id=6,
43 | color=[0, 255, 0],
44 | type='lower',
45 | swap='right_hip'),
46 | 7:
47 | dict(name='left_knee',
48 | id=7,
49 | color=[0, 255, 0],
50 | type='lower',
51 | swap='right_knee'),
52 | 8:
53 | dict(name='left_ankle',
54 | id=8,
55 | color=[0, 255, 0],
56 | type='lower',
57 | swap='right_ankle'),
58 | 9:
59 | dict(name='right_shoulder',
60 | id=9,
61 | color=[255, 128, 0],
62 | type='upper',
63 | swap='left_shoulder'),
64 | 10:
65 | dict(name='right_elbow',
66 | id=10,
67 | color=[255, 128, 0],
68 | type='upper',
69 | swap='left_elbow'),
70 | 11:
71 | dict(name='right_wrist',
72 | id=11,
73 | color=[255, 128, 0],
74 | type='upper',
75 | swap='left_wrist'),
76 | 12:
77 | dict(name='right_hip',
78 | id=12,
79 | color=[255, 128, 0],
80 | type='lower',
81 | swap='left_hip'),
82 | 13:
83 | dict(name='right_knee',
84 | id=13,
85 | color=[255, 128, 0],
86 | type='lower',
87 | swap='left_knee'),
88 | 14:
89 | dict(name='right_ankle',
90 | id=14,
91 | color=[255, 128, 0],
92 | type='lower',
93 | swap='left_ankle'),
94 | 15:
95 | dict(name='left_eye',
96 | id=15,
97 | color=[51, 153, 255],
98 | type='upper',
99 | swap='right_eye'),
100 | 16:
101 | dict(name='left_ear',
102 | id=16,
103 | color=[51, 153, 255],
104 | type='upper',
105 | swap='right_ear'),
106 | 17:
107 | dict(name='right_eye',
108 | id=17,
109 | color=[51, 153, 255],
110 | type='upper',
111 | swap='left_eye'),
112 | 18:
113 | dict(name='right_ear',
114 | id=18,
115 | color=[51, 153, 255],
116 | type='upper',
117 | swap='left_ear')
118 | },
119 | skeleton_info={
120 | 0: dict(link=('nose', 'neck'), id=0, color=[51, 153, 255]),
121 | 1: dict(link=('neck', 'left_shoulder'), id=1, color=[0, 255, 0]),
122 | 2: dict(link=('neck', 'right_shoulder'), id=2, color=[255, 128, 0]),
123 | 3: dict(link=('left_shoulder', 'left_elbow'), id=3, color=[0, 255, 0]),
124 | 4: dict(link=('right_shoulder', 'right_elbow'),
125 | id=4,
126 | color=[255, 128, 0]),
127 | 5: dict(link=('left_elbow', 'left_wrist'), id=5, color=[0, 255, 0]),
128 | 6: dict(link=('right_elbow', 'right_wrist'), id=6, color=[255, 128,
129 | 0]),
130 | 7: dict(link=('left_ankle', 'left_knee'), id=7, color=[0, 255, 0]),
131 | 8: dict(link=('left_knee', 'left_hip'), id=8, color=[0, 255, 0]),
132 | 9: dict(link=('right_ankle', 'right_knee'), id=9, color=[255, 128, 0]),
133 | 10: dict(link=('right_knee', 'right_hip'), id=10, color=[255, 128, 0]),
134 | 11: dict(link=('mid_hip', 'left_hip'), id=11, color=[0, 255, 0]),
135 | 12: dict(link=('mid_hip', 'right_hip'), id=12, color=[255, 128, 0]),
136 | 13: dict(link=('mid_hip', 'neck'), id=13, color=[51, 153, 255]),
137 | },
138 | joint_weights=[
139 | 1.0, 1.0, 1.0, 1.0, 1.2, 1.5, 1.0, 1.2, 1.5, 1.0, 1.2, 1.5, 1.0, 1.2,
140 | 1.5, 1.0, 1.0, 1.0, 1.0
141 | ],
142 | sigmas=[
143 | 0.026, 0.026, 0.107, 0.079, 0.072, 0.062, 0.107, 0.087, 0.089, 0.079,
144 | 0.072, 0.062, 0.107, 0.087, 0.089, 0.025, 0.035, 0.025, 0.035
145 | ])
146 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/panoptic_hand2d.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='panoptic_hand2d',
3 | paper_info=dict(
4 | author='Simon, Tomas and Joo, Hanbyul and '
5 | 'Matthews, Iain and Sheikh, Yaser',
6 | title='Hand keypoint detection in single images using '
7 | 'multiview bootstrapping',
8 | container='Proceedings of the IEEE conference on '
9 | 'Computer Vision and Pattern Recognition',
10 | year='2017',
11 | homepage='http://domedb.perception.cs.cmu.edu/handdb.html',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
16 | 1:
17 | dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
18 | 2:
19 | dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
20 | 3:
21 | dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
22 | 4:
23 | dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
24 | 5:
25 | dict(name='forefinger1', id=5, color=[255, 153, 255], type='',
26 | swap=''),
27 | 6:
28 | dict(name='forefinger2', id=6, color=[255, 153, 255], type='',
29 | swap=''),
30 | 7:
31 | dict(name='forefinger3', id=7, color=[255, 153, 255], type='',
32 | swap=''),
33 | 8:
34 | dict(name='forefinger4', id=8, color=[255, 153, 255], type='',
35 | swap=''),
36 | 9:
37 | dict(name='middle_finger1',
38 | id=9,
39 | color=[102, 178, 255],
40 | type='',
41 | swap=''),
42 | 10:
43 | dict(name='middle_finger2',
44 | id=10,
45 | color=[102, 178, 255],
46 | type='',
47 | swap=''),
48 | 11:
49 | dict(name='middle_finger3',
50 | id=11,
51 | color=[102, 178, 255],
52 | type='',
53 | swap=''),
54 | 12:
55 | dict(name='middle_finger4',
56 | id=12,
57 | color=[102, 178, 255],
58 | type='',
59 | swap=''),
60 | 13:
61 | dict(name='ring_finger1', id=13, color=[255, 51, 51], type='',
62 | swap=''),
63 | 14:
64 | dict(name='ring_finger2', id=14, color=[255, 51, 51], type='',
65 | swap=''),
66 | 15:
67 | dict(name='ring_finger3', id=15, color=[255, 51, 51], type='',
68 | swap=''),
69 | 16:
70 | dict(name='ring_finger4', id=16, color=[255, 51, 51], type='',
71 | swap=''),
72 | 17:
73 | dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
74 | 18:
75 | dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
76 | 19:
77 | dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
78 | 20:
79 | dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
80 | },
81 | skeleton_info={
82 | 0:
83 | dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
84 | 1:
85 | dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
86 | 2:
87 | dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
88 | 3:
89 | dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
90 | 4:
91 | dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
92 | 5:
93 | dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
94 | 6:
95 | dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
96 | 7:
97 | dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
98 | 8:
99 | dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
100 | 9:
101 | dict(link=('middle_finger1', 'middle_finger2'),
102 | id=9,
103 | color=[102, 178, 255]),
104 | 10:
105 | dict(link=('middle_finger2', 'middle_finger3'),
106 | id=10,
107 | color=[102, 178, 255]),
108 | 11:
109 | dict(link=('middle_finger3', 'middle_finger4'),
110 | id=11,
111 | color=[102, 178, 255]),
112 | 12:
113 | dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
114 | 13:
115 | dict(link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51,
116 | 51]),
117 | 14:
118 | dict(link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51,
119 | 51]),
120 | 15:
121 | dict(link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51,
122 | 51]),
123 | 16:
124 | dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
125 | 17:
126 | dict(link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255,
127 | 0]),
128 | 18:
129 | dict(link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255,
130 | 0]),
131 | 19:
132 | dict(link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
133 | },
134 | joint_weights=[1.] * 21,
135 | sigmas=[])
136 |
--------------------------------------------------------------------------------
/configs/examples/pose_estimation/webcam_demo.md:
--------------------------------------------------------------------------------
1 | ## Webcam Demo
2 |
3 | This is a webcam demo which integrartes detection and 2D pose estimation for humans and animals. It can also apply fun effects like putting on sunglasses or enlarging the eyes, based on the pose estimation results.
4 |
5 |
6 |

7 |
8 |
9 | ### Get started
10 |
11 | Launch the demo:
12 |
13 | ```shell
14 | python run.py --config configs/examples/pose_estimation/pose_estimation.py
15 | ```
16 |
17 | The command above will use the config file `configs/examples/pose_estimation/pose_estimation.py`. You can also specify the config file in the command:
18 |
19 | ```shell
20 | # Use the config "pose_tracking.py" for higher infererence speed
21 | python run.py --config configs/examples/pose_estimation/pose_tracking.py
22 | ```
23 |
24 | ### Hotkeys
25 |
26 | | Hotkey | Function |
27 | | ------ | ---------------------------------------------------------------- |
28 | | v | Toggle the pose visualization on/off. |
29 | | s | Toggle the sunglasses effect on/off. (NA for `pose_trakcing.py`) |
30 | | b | Toggle the bug-eye effect on/off. (NA for `pose_trakcing.py`) |
31 | | h | Show help information. |
32 | | m | Show the monitoring information. |
33 | | q | Exit. |
34 |
35 | Note that the demo will automatically save the output video into a file `webcam_demo.mp4`.
36 |
37 | ### Usage and configuarations
38 |
39 | Detailed configurations can be found in the config file.
40 |
41 | - **Configure detection models**
42 | Users can choose detection models from the [MMDetection Model Zoo](https://mmdetection.readthedocs.io/en/v2.20.0/model_zoo.html). Just set the `model_config` and `model_checkpoint` in the detector node accordingly, and the model will be automatically downloaded and loaded.
43 |
44 | ```python
45 | # 'DetectorNode':
46 | # This node performs object detection from the frame image using an
47 | # MMDetection model.
48 | dict(
49 | type='DetectorNode',
50 | name='detector',
51 | model_config='model_configs/mmdet/'
52 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
53 | model_checkpoint='https://download.openmmlab.com'
54 | '/mmdetection/v2.0/ssd/'
55 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
56 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
57 | input_buffer='_input_',
58 | output_buffer='det_result')
59 | ```
60 |
61 | - **Configure pose estimation models**
62 | In this demo we use two [top-down](https://github.com/open-mmlab/mmpose/tree/master/configs/body/2d_kpt_sview_rgb_img/topdown_heatmap) pose estimation models for humans and animals respectively. Users can choose models from the [MMPose Model Zoo](https://mmpose.readthedocs.io/en/latest/modelzoo.html). To apply different pose models on different instance types, you can add multiple pose estimator nodes with `cls_names` set accordingly.
63 |
64 | ```python
65 | # 'TopDownPoseEstimatorNode':
66 | # This node performs keypoint detection from the frame image using an
67 | # MMPose top-down model. Detection results is needed.
68 | dict(
69 | type='TopDownPoseEstimatorNode',
70 | name='human pose estimator',
71 | model_config='configs/wholebody/2d_kpt_sview_rgb_img/'
72 | 'topdown_heatmap/coco-wholebody/'
73 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
74 | model_checkpoint='model_configs/mmpose/vipnas_mbv3_co'
75 | 'co_wholebody_256x192_dark-e2158108_20211205.pth',
76 | labels=['person'],
77 | input_buffer='det_result',
78 | output_buffer='human_pose'),
79 | dict(
80 | type='TopDownPoseEstimatorNode',
81 | name='animal pose estimator',
82 | model_config='model_configs/mmdet/hrnet_w32_animalpose_256x256.py',
83 | model_checkpoint='https://download.openmmlab.com/mmpose/animal/'
84 | 'hrnet/hrnet_w32_animalpose_256x256-1aa7f075_20210426.pth',
85 | labels=['cat', 'dog', 'horse', 'sheep', 'cow'],
86 | input_buffer='human_pose',
87 | output_buffer='animal_pose')
88 | ```
89 |
90 | - **Run the demo without GPU**
91 | If you don't have GPU and CUDA in your device, the demo can run with only CPU by setting `device='cpu'` in all model nodes. For example:
92 |
93 | ```python
94 | dict(
95 | type='DetectorNode',
96 | name='detector',
97 | model_config='model_configs/mmdet/'
98 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
99 | model_checkpoint='https://download.openmmlab.com'
100 | '/mmdetection/v2.0/ssd/'
101 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
102 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
103 | device='cpu',
104 | input_buffer='_input_',
105 | output_buffer='det_result')
106 | ```
107 |
108 | - **Run the demo on a local video file**
109 | You can use local video files as the demo input by set `camera_id` to the file path.
110 |
111 | - **The computer doesn't have a camera?**
112 | A smart phone can serve as a webcam via apps like [Camo](https://reincubate.com/camo/) or [DroidCam](https://www.dev47apps.com/).
113 |
114 | - **Test the camera and display**
115 | Run follow command for a quick test of video capturing and displaying.
116 |
117 | ```shell
118 | python run.py --config configs/examples/pose_estimation/test_camera.py
119 | ```
120 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/freihand2d.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='freihand',
3 | paper_info=dict(
4 | author='Zimmermann, Christian and Ceylan, Duygu and '
5 | 'Yang, Jimei and Russell, Bryan and '
6 | 'Argus, Max and Brox, Thomas',
7 | title='Freihand: A dataset for markerless capture of hand pose '
8 | 'and shape from single rgb images',
9 | container='Proceedings of the IEEE International '
10 | 'Conference on Computer Vision',
11 | year='2019',
12 | homepage='https://lmb.informatik.uni-freiburg.de/projects/freihand/',
13 | ),
14 | keypoint_info={
15 | 0:
16 | dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
17 | 1:
18 | dict(name='thumb1', id=1, color=[255, 128, 0], type='', swap=''),
19 | 2:
20 | dict(name='thumb2', id=2, color=[255, 128, 0], type='', swap=''),
21 | 3:
22 | dict(name='thumb3', id=3, color=[255, 128, 0], type='', swap=''),
23 | 4:
24 | dict(name='thumb4', id=4, color=[255, 128, 0], type='', swap=''),
25 | 5:
26 | dict(name='forefinger1', id=5, color=[255, 153, 255], type='',
27 | swap=''),
28 | 6:
29 | dict(name='forefinger2', id=6, color=[255, 153, 255], type='',
30 | swap=''),
31 | 7:
32 | dict(name='forefinger3', id=7, color=[255, 153, 255], type='',
33 | swap=''),
34 | 8:
35 | dict(name='forefinger4', id=8, color=[255, 153, 255], type='',
36 | swap=''),
37 | 9:
38 | dict(name='middle_finger1',
39 | id=9,
40 | color=[102, 178, 255],
41 | type='',
42 | swap=''),
43 | 10:
44 | dict(name='middle_finger2',
45 | id=10,
46 | color=[102, 178, 255],
47 | type='',
48 | swap=''),
49 | 11:
50 | dict(name='middle_finger3',
51 | id=11,
52 | color=[102, 178, 255],
53 | type='',
54 | swap=''),
55 | 12:
56 | dict(name='middle_finger4',
57 | id=12,
58 | color=[102, 178, 255],
59 | type='',
60 | swap=''),
61 | 13:
62 | dict(name='ring_finger1', id=13, color=[255, 51, 51], type='',
63 | swap=''),
64 | 14:
65 | dict(name='ring_finger2', id=14, color=[255, 51, 51], type='',
66 | swap=''),
67 | 15:
68 | dict(name='ring_finger3', id=15, color=[255, 51, 51], type='',
69 | swap=''),
70 | 16:
71 | dict(name='ring_finger4', id=16, color=[255, 51, 51], type='',
72 | swap=''),
73 | 17:
74 | dict(name='pinky_finger1', id=17, color=[0, 255, 0], type='', swap=''),
75 | 18:
76 | dict(name='pinky_finger2', id=18, color=[0, 255, 0], type='', swap=''),
77 | 19:
78 | dict(name='pinky_finger3', id=19, color=[0, 255, 0], type='', swap=''),
79 | 20:
80 | dict(name='pinky_finger4', id=20, color=[0, 255, 0], type='', swap='')
81 | },
82 | skeleton_info={
83 | 0:
84 | dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
85 | 1:
86 | dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
87 | 2:
88 | dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
89 | 3:
90 | dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
91 | 4:
92 | dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
93 | 5:
94 | dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
95 | 6:
96 | dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
97 | 7:
98 | dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
99 | 8:
100 | dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
101 | 9:
102 | dict(link=('middle_finger1', 'middle_finger2'),
103 | id=9,
104 | color=[102, 178, 255]),
105 | 10:
106 | dict(link=('middle_finger2', 'middle_finger3'),
107 | id=10,
108 | color=[102, 178, 255]),
109 | 11:
110 | dict(link=('middle_finger3', 'middle_finger4'),
111 | id=11,
112 | color=[102, 178, 255]),
113 | 12:
114 | dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
115 | 13:
116 | dict(link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51,
117 | 51]),
118 | 14:
119 | dict(link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51,
120 | 51]),
121 | 15:
122 | dict(link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51,
123 | 51]),
124 | 16:
125 | dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
126 | 17:
127 | dict(link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255,
128 | 0]),
129 | 18:
130 | dict(link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255,
131 | 0]),
132 | 19:
133 | dict(link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
134 | },
135 | joint_weights=[1.] * 21,
136 | sigmas=[])
137 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/posetrack18.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='posetrack18',
3 | paper_info=dict(
4 | author='Andriluka, Mykhaylo and Iqbal, Umar and '
5 | 'Insafutdinov, Eldar and Pishchulin, Leonid and '
6 | 'Milan, Anton and Gall, Juergen and Schiele, Bernt',
7 | title='Posetrack: A benchmark for human pose estimation and tracking',
8 | container='Proceedings of the IEEE Conference on '
9 | 'Computer Vision and Pattern Recognition',
10 | year='2018',
11 | homepage='https://posetrack.net/users/download.php',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
16 | 1:
17 | dict(name='head_bottom',
18 | id=1,
19 | color=[51, 153, 255],
20 | type='upper',
21 | swap=''),
22 | 2:
23 | dict(name='head_top',
24 | id=2,
25 | color=[51, 153, 255],
26 | type='upper',
27 | swap=''),
28 | 3:
29 | dict(name='left_ear',
30 | id=3,
31 | color=[51, 153, 255],
32 | type='upper',
33 | swap='right_ear'),
34 | 4:
35 | dict(name='right_ear',
36 | id=4,
37 | color=[51, 153, 255],
38 | type='upper',
39 | swap='left_ear'),
40 | 5:
41 | dict(name='left_shoulder',
42 | id=5,
43 | color=[0, 255, 0],
44 | type='upper',
45 | swap='right_shoulder'),
46 | 6:
47 | dict(name='right_shoulder',
48 | id=6,
49 | color=[255, 128, 0],
50 | type='upper',
51 | swap='left_shoulder'),
52 | 7:
53 | dict(name='left_elbow',
54 | id=7,
55 | color=[0, 255, 0],
56 | type='upper',
57 | swap='right_elbow'),
58 | 8:
59 | dict(name='right_elbow',
60 | id=8,
61 | color=[255, 128, 0],
62 | type='upper',
63 | swap='left_elbow'),
64 | 9:
65 | dict(name='left_wrist',
66 | id=9,
67 | color=[0, 255, 0],
68 | type='upper',
69 | swap='right_wrist'),
70 | 10:
71 | dict(name='right_wrist',
72 | id=10,
73 | color=[255, 128, 0],
74 | type='upper',
75 | swap='left_wrist'),
76 | 11:
77 | dict(name='left_hip',
78 | id=11,
79 | color=[0, 255, 0],
80 | type='lower',
81 | swap='right_hip'),
82 | 12:
83 | dict(name='right_hip',
84 | id=12,
85 | color=[255, 128, 0],
86 | type='lower',
87 | swap='left_hip'),
88 | 13:
89 | dict(name='left_knee',
90 | id=13,
91 | color=[0, 255, 0],
92 | type='lower',
93 | swap='right_knee'),
94 | 14:
95 | dict(name='right_knee',
96 | id=14,
97 | color=[255, 128, 0],
98 | type='lower',
99 | swap='left_knee'),
100 | 15:
101 | dict(name='left_ankle',
102 | id=15,
103 | color=[0, 255, 0],
104 | type='lower',
105 | swap='right_ankle'),
106 | 16:
107 | dict(name='right_ankle',
108 | id=16,
109 | color=[255, 128, 0],
110 | type='lower',
111 | swap='left_ankle')
112 | },
113 | skeleton_info={
114 | 0:
115 | dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
116 | 1:
117 | dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
118 | 2:
119 | dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
120 | 3:
121 | dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
122 | 4:
123 | dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
124 | 5:
125 | dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
126 | 6:
127 | dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
128 | 7:
129 | dict(link=('left_shoulder', 'right_shoulder'),
130 | id=7,
131 | color=[51, 153, 255]),
132 | 8:
133 | dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
134 | 9:
135 | dict(link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128,
136 | 0]),
137 | 10:
138 | dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
139 | 11:
140 | dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
141 | 12:
142 | dict(link=('nose', 'head_bottom'), id=12, color=[51, 153, 255]),
143 | 13:
144 | dict(link=('nose', 'head_top'), id=13, color=[51, 153, 255]),
145 | 14:
146 | dict(link=('head_bottom', 'left_shoulder'),
147 | id=14,
148 | color=[51, 153, 255]),
149 | 15:
150 | dict(link=('head_bottom', 'right_shoulder'),
151 | id=15,
152 | color=[51, 153, 255])
153 | },
154 | joint_weights=[
155 | 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
156 | 1.5
157 | ],
158 | sigmas=[
159 | 0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
160 | 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
161 | ])
162 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/ochuman.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='ochuman',
3 | paper_info=dict(
4 | author='Zhang, Song-Hai and Li, Ruilong and Dong, Xin and '
5 | 'Rosin, Paul and Cai, Zixi and Han, Xi and '
6 | 'Yang, Dingcheng and Huang, Haozhi and Hu, Shi-Min',
7 | title='Pose2seg: Detection free human instance segmentation',
8 | container='Proceedings of the IEEE conference on computer '
9 | 'vision and pattern recognition',
10 | year='2019',
11 | homepage='https://github.com/liruilong940607/OCHumanApi',
12 | ),
13 | keypoint_info={
14 | 0:
15 | dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
16 | 1:
17 | dict(name='left_eye',
18 | id=1,
19 | color=[51, 153, 255],
20 | type='upper',
21 | swap='right_eye'),
22 | 2:
23 | dict(name='right_eye',
24 | id=2,
25 | color=[51, 153, 255],
26 | type='upper',
27 | swap='left_eye'),
28 | 3:
29 | dict(name='left_ear',
30 | id=3,
31 | color=[51, 153, 255],
32 | type='upper',
33 | swap='right_ear'),
34 | 4:
35 | dict(name='right_ear',
36 | id=4,
37 | color=[51, 153, 255],
38 | type='upper',
39 | swap='left_ear'),
40 | 5:
41 | dict(name='left_shoulder',
42 | id=5,
43 | color=[0, 255, 0],
44 | type='upper',
45 | swap='right_shoulder'),
46 | 6:
47 | dict(name='right_shoulder',
48 | id=6,
49 | color=[255, 128, 0],
50 | type='upper',
51 | swap='left_shoulder'),
52 | 7:
53 | dict(name='left_elbow',
54 | id=7,
55 | color=[0, 255, 0],
56 | type='upper',
57 | swap='right_elbow'),
58 | 8:
59 | dict(name='right_elbow',
60 | id=8,
61 | color=[255, 128, 0],
62 | type='upper',
63 | swap='left_elbow'),
64 | 9:
65 | dict(name='left_wrist',
66 | id=9,
67 | color=[0, 255, 0],
68 | type='upper',
69 | swap='right_wrist'),
70 | 10:
71 | dict(name='right_wrist',
72 | id=10,
73 | color=[255, 128, 0],
74 | type='upper',
75 | swap='left_wrist'),
76 | 11:
77 | dict(name='left_hip',
78 | id=11,
79 | color=[0, 255, 0],
80 | type='lower',
81 | swap='right_hip'),
82 | 12:
83 | dict(name='right_hip',
84 | id=12,
85 | color=[255, 128, 0],
86 | type='lower',
87 | swap='left_hip'),
88 | 13:
89 | dict(name='left_knee',
90 | id=13,
91 | color=[0, 255, 0],
92 | type='lower',
93 | swap='right_knee'),
94 | 14:
95 | dict(name='right_knee',
96 | id=14,
97 | color=[255, 128, 0],
98 | type='lower',
99 | swap='left_knee'),
100 | 15:
101 | dict(name='left_ankle',
102 | id=15,
103 | color=[0, 255, 0],
104 | type='lower',
105 | swap='right_ankle'),
106 | 16:
107 | dict(name='right_ankle',
108 | id=16,
109 | color=[255, 128, 0],
110 | type='lower',
111 | swap='left_ankle')
112 | },
113 | skeleton_info={
114 | 0:
115 | dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
116 | 1:
117 | dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
118 | 2:
119 | dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
120 | 3:
121 | dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
122 | 4:
123 | dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
124 | 5:
125 | dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
126 | 6:
127 | dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
128 | 7:
129 | dict(link=('left_shoulder', 'right_shoulder'),
130 | id=7,
131 | color=[51, 153, 255]),
132 | 8:
133 | dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
134 | 9:
135 | dict(link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128,
136 | 0]),
137 | 10:
138 | dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
139 | 11:
140 | dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
141 | 12:
142 | dict(link=('left_eye', 'right_eye'), id=12, color=[51, 153, 255]),
143 | 13:
144 | dict(link=('nose', 'left_eye'), id=13, color=[51, 153, 255]),
145 | 14:
146 | dict(link=('nose', 'right_eye'), id=14, color=[51, 153, 255]),
147 | 15:
148 | dict(link=('left_eye', 'left_ear'), id=15, color=[51, 153, 255]),
149 | 16:
150 | dict(link=('right_eye', 'right_ear'), id=16, color=[51, 153, 255]),
151 | 17:
152 | dict(link=('left_ear', 'left_shoulder'), id=17, color=[51, 153, 255]),
153 | 18:
154 | dict(link=('right_ear', 'right_shoulder'), id=18, color=[51, 153, 255])
155 | },
156 | joint_weights=[
157 | 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
158 | 1.5
159 | ],
160 | sigmas=[
161 | 0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
162 | 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
163 | ])
164 |
--------------------------------------------------------------------------------
/src/nodes/firecracker_effect_node.py:
--------------------------------------------------------------------------------
1 | from itertools import groupby
2 | from typing import List, Optional, Union
3 |
4 | import cv2
5 | import numpy as np
6 | from mmpose.apis.webcam.nodes import NODES, BaseVisualizerNode
7 | from mmpose.apis.webcam.utils import get_wrist_keypoint_ids
8 |
9 |
10 | @NODES.register_module()
11 | class FirecrackerEffectNode(BaseVisualizerNode):
12 | def __init__(self,
13 | name: str,
14 | input_buffer: str,
15 | output_buffer: Union[str, List[str]],
16 | enable_key: Optional[Union[str, int]] = None,
17 | src_img_path: Optional[str] = None):
18 |
19 | super().__init__(name, input_buffer, output_buffer, enable_key)
20 |
21 | if src_img_path is None:
22 | self.src_img_path = 'https://user-images.githubusercontent' \
23 | '.com/28900607/149766281-6376055c-ed8b' \
24 | '-472b-991f-60e6ae6ee1da.gif'
25 | src_img = cv2.VideoCapture(self.src_img_path)
26 |
27 | self.frame_list = []
28 | ret, frame = src_img.read()
29 | while ret:
30 | self.frame_list.append(frame)
31 | ret, frame = src_img.read()
32 | self.num_frames = len(self.frame_list)
33 | self.frame_idx = 0
34 | self.frame_period = 4 # each frame in gif lasts for 4 frames in video
35 |
36 | @staticmethod
37 | def apply_firecracker_effect(img,
38 | objects,
39 | firecracker_img,
40 | left_wrist_idx,
41 | right_wrist_idx,
42 | kpt_thr=0.5):
43 | """Apply firecracker effect.
44 | Args:
45 | img (np.ndarray): Image data.
46 | objects (list[dict]): The objects with the following information:
47 | - "keypoints" (np.ndarray[K,3]): keypoint detection result in
48 | [x, y, score]
49 | firecracker_img (np.ndarray): Firecracker image with white
50 | background.
51 | left_wrist_idx (int): Keypoint index of left wrist
52 | right_wrist_idx (int): Keypoint index of right wrist
53 | kpt_thr (float): The score threshold of required keypoints.
54 | """
55 |
56 | hm, wm = firecracker_img.shape[:2]
57 | # anchor points in the firecracker mask
58 | pts_src = np.array([[0. * wm, 0. * hm], [0. * wm, 1. * hm],
59 | [1. * wm, 0. * hm], [1. * wm, 1. * hm]],
60 | dtype=np.float32)
61 |
62 | h, w = img.shape[:2]
63 | h_tar = h / 3
64 | w_tar = h_tar / hm * wm
65 |
66 | for obj in objects:
67 | kpts = obj['keypoints']
68 |
69 | if kpts[left_wrist_idx, 2] > kpt_thr:
70 | kpt_lwrist = kpts[left_wrist_idx, :2]
71 | # anchor points in the image by eye positions
72 | pts_tar = np.vstack([
73 | kpt_lwrist - [w_tar / 2, 0],
74 | kpt_lwrist - [w_tar / 2, -h_tar],
75 | kpt_lwrist + [w_tar / 2, 0],
76 | kpt_lwrist + [w_tar / 2, h_tar]
77 | ])
78 |
79 | h_mat, _ = cv2.findHomography(pts_src, pts_tar)
80 | patch = cv2.warpPerspective(firecracker_img,
81 | h_mat,
82 | dsize=(img.shape[1], img.shape[0]),
83 | borderValue=(255, 255, 255))
84 | # mask the white background area in the patch with
85 | # a threshold 200
86 | mask = cv2.cvtColor(patch, cv2.COLOR_BGR2GRAY)
87 | mask = (mask < 240).astype(np.uint8)
88 | img = cv2.copyTo(patch, mask, img)
89 |
90 | if kpts[right_wrist_idx, 2] > kpt_thr:
91 | kpt_rwrist = kpts[right_wrist_idx, :2]
92 |
93 | # anchor points in the image by eye positions
94 | pts_tar = np.vstack([
95 | kpt_rwrist - [w_tar / 2, 0],
96 | kpt_rwrist - [w_tar / 2, -h_tar],
97 | kpt_rwrist + [w_tar / 2, 0],
98 | kpt_rwrist + [w_tar / 2, h_tar]
99 | ])
100 |
101 | h_mat, _ = cv2.findHomography(pts_src, pts_tar)
102 | patch = cv2.warpPerspective(firecracker_img,
103 | h_mat,
104 | dsize=(img.shape[1], img.shape[0]),
105 | borderValue=(255, 255, 255))
106 | # mask the white background area in the patch with
107 | # a threshold 200
108 | mask = cv2.cvtColor(patch, cv2.COLOR_BGR2GRAY)
109 | mask = (mask < 240).astype(np.uint8)
110 | img = cv2.copyTo(patch, mask, img)
111 |
112 | return img
113 |
114 | def draw(self, input_msg):
115 | canvas = input_msg.get_image()
116 |
117 | objects = input_msg.get_objects(lambda x: 'keypoints' in x)
118 | frame = self.frame_list[self.frame_idx // self.frame_period]
119 |
120 | for model_cfg, object_group in groupby(objects,
121 | lambda x: x['pose_model_cfg']):
122 |
123 | left_wrist_idx, right_wrist_idx = get_wrist_keypoint_ids(model_cfg)
124 |
125 | canvas = self.apply_firecracker_effect(canvas, object_group, frame,
126 | left_wrist_idx,
127 | right_wrist_idx)
128 |
129 | self.frame_idx = (self.frame_idx + 1) % (self.num_frames *
130 | self.frame_period)
131 |
132 | return canvas
133 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/animalpose.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='animalpose',
3 | paper_info=dict(
4 | author='Cao, Jinkun and Tang, Hongyang and Fang, Hao-Shu and '
5 | 'Shen, Xiaoyong and Lu, Cewu and Tai, Yu-Wing',
6 | title='Cross-Domain Adaptation for Animal Pose Estimation',
7 | container='The IEEE International Conference on '
8 | 'Computer Vision (ICCV)',
9 | year='2019',
10 | homepage='https://sites.google.com/view/animal-pose/',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='L_Eye', id=0, color=[0, 255, 0], type='upper',
15 | swap='R_Eye'),
16 | 1:
17 | dict(name='R_Eye',
18 | id=1,
19 | color=[255, 128, 0],
20 | type='upper',
21 | swap='L_Eye'),
22 | 2:
23 | dict(name='L_EarBase',
24 | id=2,
25 | color=[0, 255, 0],
26 | type='upper',
27 | swap='R_EarBase'),
28 | 3:
29 | dict(name='R_EarBase',
30 | id=3,
31 | color=[255, 128, 0],
32 | type='upper',
33 | swap='L_EarBase'),
34 | 4:
35 | dict(name='Nose', id=4, color=[51, 153, 255], type='upper', swap=''),
36 | 5:
37 | dict(name='Throat', id=5, color=[51, 153, 255], type='upper', swap=''),
38 | 6:
39 | dict(name='TailBase',
40 | id=6,
41 | color=[51, 153, 255],
42 | type='lower',
43 | swap=''),
44 | 7:
45 | dict(name='Withers', id=7, color=[51, 153, 255], type='upper',
46 | swap=''),
47 | 8:
48 | dict(name='L_F_Elbow',
49 | id=8,
50 | color=[0, 255, 0],
51 | type='upper',
52 | swap='R_F_Elbow'),
53 | 9:
54 | dict(name='R_F_Elbow',
55 | id=9,
56 | color=[255, 128, 0],
57 | type='upper',
58 | swap='L_F_Elbow'),
59 | 10:
60 | dict(name='L_B_Elbow',
61 | id=10,
62 | color=[0, 255, 0],
63 | type='lower',
64 | swap='R_B_Elbow'),
65 | 11:
66 | dict(name='R_B_Elbow',
67 | id=11,
68 | color=[255, 128, 0],
69 | type='lower',
70 | swap='L_B_Elbow'),
71 | 12:
72 | dict(name='L_F_Knee',
73 | id=12,
74 | color=[0, 255, 0],
75 | type='upper',
76 | swap='R_F_Knee'),
77 | 13:
78 | dict(name='R_F_Knee',
79 | id=13,
80 | color=[255, 128, 0],
81 | type='upper',
82 | swap='L_F_Knee'),
83 | 14:
84 | dict(name='L_B_Knee',
85 | id=14,
86 | color=[0, 255, 0],
87 | type='lower',
88 | swap='R_B_Knee'),
89 | 15:
90 | dict(name='R_B_Knee',
91 | id=15,
92 | color=[255, 128, 0],
93 | type='lower',
94 | swap='L_B_Knee'),
95 | 16:
96 | dict(name='L_F_Paw',
97 | id=16,
98 | color=[0, 255, 0],
99 | type='upper',
100 | swap='R_F_Paw'),
101 | 17:
102 | dict(name='R_F_Paw',
103 | id=17,
104 | color=[255, 128, 0],
105 | type='upper',
106 | swap='L_F_Paw'),
107 | 18:
108 | dict(name='L_B_Paw',
109 | id=18,
110 | color=[0, 255, 0],
111 | type='lower',
112 | swap='R_B_Paw'),
113 | 19:
114 | dict(name='R_B_Paw',
115 | id=19,
116 | color=[255, 128, 0],
117 | type='lower',
118 | swap='L_B_Paw')
119 | },
120 | skeleton_info={
121 | 0: dict(link=('L_Eye', 'R_Eye'), id=0, color=[51, 153, 255]),
122 | 1: dict(link=('L_Eye', 'L_EarBase'), id=1, color=[0, 255, 0]),
123 | 2: dict(link=('R_Eye', 'R_EarBase'), id=2, color=[255, 128, 0]),
124 | 3: dict(link=('L_Eye', 'Nose'), id=3, color=[0, 255, 0]),
125 | 4: dict(link=('R_Eye', 'Nose'), id=4, color=[255, 128, 0]),
126 | 5: dict(link=('Nose', 'Throat'), id=5, color=[51, 153, 255]),
127 | 6: dict(link=('Throat', 'Withers'), id=6, color=[51, 153, 255]),
128 | 7: dict(link=('TailBase', 'Withers'), id=7, color=[51, 153, 255]),
129 | 8: dict(link=('Throat', 'L_F_Elbow'), id=8, color=[0, 255, 0]),
130 | 9: dict(link=('L_F_Elbow', 'L_F_Knee'), id=9, color=[0, 255, 0]),
131 | 10: dict(link=('L_F_Knee', 'L_F_Paw'), id=10, color=[0, 255, 0]),
132 | 11: dict(link=('Throat', 'R_F_Elbow'), id=11, color=[255, 128, 0]),
133 | 12: dict(link=('R_F_Elbow', 'R_F_Knee'), id=12, color=[255, 128, 0]),
134 | 13: dict(link=('R_F_Knee', 'R_F_Paw'), id=13, color=[255, 128, 0]),
135 | 14: dict(link=('TailBase', 'L_B_Elbow'), id=14, color=[0, 255, 0]),
136 | 15: dict(link=('L_B_Elbow', 'L_B_Knee'), id=15, color=[0, 255, 0]),
137 | 16: dict(link=('L_B_Knee', 'L_B_Paw'), id=16, color=[0, 255, 0]),
138 | 17: dict(link=('TailBase', 'R_B_Elbow'), id=17, color=[255, 128, 0]),
139 | 18: dict(link=('R_B_Elbow', 'R_B_Knee'), id=18, color=[255, 128, 0]),
140 | 19: dict(link=('R_B_Knee', 'R_B_Paw'), id=19, color=[255, 128, 0])
141 | },
142 | joint_weights=[
143 | 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.2, 1.2,
144 | 1.5, 1.5, 1.5, 1.5
145 | ],
146 |
147 | # Note: The original paper did not provide enough information about
148 | # the sigmas. We modified from 'https://github.com/cocodataset/'
149 | # 'cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L523'
150 | sigmas=[
151 | 0.025, 0.025, 0.026, 0.035, 0.035, 0.10, 0.10, 0.10, 0.107, 0.107,
152 | 0.107, 0.107, 0.087, 0.087, 0.087, 0.087, 0.089, 0.089, 0.089, 0.089
153 | ])
154 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/macaque.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='macaque',
3 | paper_info=dict(
4 | author='Labuguen, Rollyn and Matsumoto, Jumpei and '
5 | 'Negrete, Salvador and Nishimaru, Hiroshi and '
6 | 'Nishijo, Hisao and Takada, Masahiko and '
7 | 'Go, Yasuhiro and Inoue, Ken-ichi and Shibata, Tomohiro',
8 | title='MacaquePose: A novel "in the wild" macaque monkey pose dataset '
9 | 'for markerless motion capture',
10 | container='bioRxiv',
11 | year='2020',
12 | homepage='http://www.pri.kyoto-u.ac.jp/datasets/'
13 | 'macaquepose/index.html',
14 | ),
15 | keypoint_info={
16 | 0:
17 | dict(name='nose', id=0, color=[51, 153, 255], type='upper', swap=''),
18 | 1:
19 | dict(name='left_eye',
20 | id=1,
21 | color=[51, 153, 255],
22 | type='upper',
23 | swap='right_eye'),
24 | 2:
25 | dict(name='right_eye',
26 | id=2,
27 | color=[51, 153, 255],
28 | type='upper',
29 | swap='left_eye'),
30 | 3:
31 | dict(name='left_ear',
32 | id=3,
33 | color=[51, 153, 255],
34 | type='upper',
35 | swap='right_ear'),
36 | 4:
37 | dict(name='right_ear',
38 | id=4,
39 | color=[51, 153, 255],
40 | type='upper',
41 | swap='left_ear'),
42 | 5:
43 | dict(name='left_shoulder',
44 | id=5,
45 | color=[0, 255, 0],
46 | type='upper',
47 | swap='right_shoulder'),
48 | 6:
49 | dict(name='right_shoulder',
50 | id=6,
51 | color=[255, 128, 0],
52 | type='upper',
53 | swap='left_shoulder'),
54 | 7:
55 | dict(name='left_elbow',
56 | id=7,
57 | color=[0, 255, 0],
58 | type='upper',
59 | swap='right_elbow'),
60 | 8:
61 | dict(name='right_elbow',
62 | id=8,
63 | color=[255, 128, 0],
64 | type='upper',
65 | swap='left_elbow'),
66 | 9:
67 | dict(name='left_wrist',
68 | id=9,
69 | color=[0, 255, 0],
70 | type='upper',
71 | swap='right_wrist'),
72 | 10:
73 | dict(name='right_wrist',
74 | id=10,
75 | color=[255, 128, 0],
76 | type='upper',
77 | swap='left_wrist'),
78 | 11:
79 | dict(name='left_hip',
80 | id=11,
81 | color=[0, 255, 0],
82 | type='lower',
83 | swap='right_hip'),
84 | 12:
85 | dict(name='right_hip',
86 | id=12,
87 | color=[255, 128, 0],
88 | type='lower',
89 | swap='left_hip'),
90 | 13:
91 | dict(name='left_knee',
92 | id=13,
93 | color=[0, 255, 0],
94 | type='lower',
95 | swap='right_knee'),
96 | 14:
97 | dict(name='right_knee',
98 | id=14,
99 | color=[255, 128, 0],
100 | type='lower',
101 | swap='left_knee'),
102 | 15:
103 | dict(name='left_ankle',
104 | id=15,
105 | color=[0, 255, 0],
106 | type='lower',
107 | swap='right_ankle'),
108 | 16:
109 | dict(name='right_ankle',
110 | id=16,
111 | color=[255, 128, 0],
112 | type='lower',
113 | swap='left_ankle')
114 | },
115 | skeleton_info={
116 | 0:
117 | dict(link=('left_ankle', 'left_knee'), id=0, color=[0, 255, 0]),
118 | 1:
119 | dict(link=('left_knee', 'left_hip'), id=1, color=[0, 255, 0]),
120 | 2:
121 | dict(link=('right_ankle', 'right_knee'), id=2, color=[255, 128, 0]),
122 | 3:
123 | dict(link=('right_knee', 'right_hip'), id=3, color=[255, 128, 0]),
124 | 4:
125 | dict(link=('left_hip', 'right_hip'), id=4, color=[51, 153, 255]),
126 | 5:
127 | dict(link=('left_shoulder', 'left_hip'), id=5, color=[51, 153, 255]),
128 | 6:
129 | dict(link=('right_shoulder', 'right_hip'), id=6, color=[51, 153, 255]),
130 | 7:
131 | dict(link=('left_shoulder', 'right_shoulder'),
132 | id=7,
133 | color=[51, 153, 255]),
134 | 8:
135 | dict(link=('left_shoulder', 'left_elbow'), id=8, color=[0, 255, 0]),
136 | 9:
137 | dict(link=('right_shoulder', 'right_elbow'), id=9, color=[255, 128,
138 | 0]),
139 | 10:
140 | dict(link=('left_elbow', 'left_wrist'), id=10, color=[0, 255, 0]),
141 | 11:
142 | dict(link=('right_elbow', 'right_wrist'), id=11, color=[255, 128, 0]),
143 | 12:
144 | dict(link=('left_eye', 'right_eye'), id=12, color=[51, 153, 255]),
145 | 13:
146 | dict(link=('nose', 'left_eye'), id=13, color=[51, 153, 255]),
147 | 14:
148 | dict(link=('nose', 'right_eye'), id=14, color=[51, 153, 255]),
149 | 15:
150 | dict(link=('left_eye', 'left_ear'), id=15, color=[51, 153, 255]),
151 | 16:
152 | dict(link=('right_eye', 'right_ear'), id=16, color=[51, 153, 255]),
153 | 17:
154 | dict(link=('left_ear', 'left_shoulder'), id=17, color=[51, 153, 255]),
155 | 18:
156 | dict(link=('right_ear', 'right_shoulder'), id=18, color=[51, 153, 255])
157 | },
158 | joint_weights=[
159 | 1., 1., 1., 1., 1., 1., 1., 1.2, 1.2, 1.5, 1.5, 1., 1., 1.2, 1.2, 1.5,
160 | 1.5
161 | ],
162 | sigmas=[
163 | 0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062,
164 | 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089
165 | ])
166 |
--------------------------------------------------------------------------------
/configs/examples/pose_estimation/pose_estimation.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) OpenMMLab. All rights reserved.
2 | executor_cfg = dict(
3 | # Basic configurations of the executor
4 | name='Pose Estimation',
5 | camera_id=0,
6 | # Define nodes.
7 | # The configuration of a node usually includes:
8 | # 1. 'type': Node class name
9 | # 2. 'name': Node name
10 | # 3. I/O buffers (e.g. 'input_buffer', 'output_buffer'): specify the
11 | # input and output buffer names. This may depend on the node class.
12 | # 4. 'enable_key': assign a hot-key to toggle enable/disable this node.
13 | # This may depend on the node class.
14 | # 5. Other class-specific arguments
15 | nodes=[
16 | # 'DetectorNode':
17 | # This node performs object detection from the frame image using an
18 | # MMDetection model.
19 | dict(
20 | type='DetectorNode',
21 | name='detector',
22 | model_config='model_configs/mmdet/'
23 | 'ssdlite_mobilenetv2_scratch_600e_coco.py',
24 | model_checkpoint='https://download.openmmlab.com'
25 | '/mmdetection/v2.0/ssd/'
26 | 'ssdlite_mobilenetv2_scratch_600e_coco/ssdlite_mobilenetv2_'
27 | 'scratch_600e_coco_20210629_110627-974d9307.pth',
28 | input_buffer='_input_', # `_input_` is an executor-reserved buffer
29 | output_buffer='det_result'),
30 | # 'TopDownPoseEstimatorNode':
31 | # This node performs keypoint detection from the frame image using an
32 | # MMPose top-down model. Detection results is needed.
33 | dict(type='TopDownPoseEstimatorNode',
34 | name='human pose estimator',
35 | model_config='model_configs/mmpose/'
36 | 'vipnas_mbv3_coco_wholebody_256x192_dark.py',
37 | model_checkpoint='https://download.openmmlab.com/mmpose/top_down/'
38 | 'vipnas/vipnas_mbv3_coco_wholebody_256x192_dark'
39 | '-e2158108_20211205.pth',
40 | labels=['person'],
41 | smooth=True,
42 | input_buffer='det_result',
43 | output_buffer='human_pose'),
44 | dict(type='TopDownPoseEstimatorNode',
45 | name='animal pose estimator',
46 | model_config='model_configs/'
47 | 'mmpose/hrnet_w32_animalpose_256x256.py',
48 | model_checkpoint='https://download.openmmlab.com/mmpose/animal/'
49 | 'hrnet/hrnet_w32_animalpose_256x256-1aa7f075_20210426.pth',
50 | labels=['cat', 'dog', 'horse', 'sheep', 'cow'],
51 | input_buffer='human_pose',
52 | output_buffer='animal_pose'),
53 | # 'ObjectAssignerNode':
54 | # This node binds the latest model inference result with the current
55 | # frame. (This means the frame image and inference result may be
56 | # asynchronous).
57 | dict(
58 | type='ObjectAssignerNode',
59 | name='object assigner',
60 | frame_buffer='_frame_', # `_frame_` is an executor-reserved buffer
61 | object_buffer='animal_pose',
62 | output_buffer='frame'),
63 | # 'ObjectVisualizerNode':
64 | # This node draw the pose visualization result in the frame image.
65 | # Pose results is needed.
66 | dict(type='ObjectVisualizerNode',
67 | name='object visualizer',
68 | enable_key='v',
69 | enable=True,
70 | show_bbox=True,
71 | must_have_keypoint=False,
72 | show_keypoint=True,
73 | input_buffer='frame',
74 | output_buffer='vis'),
75 | # 'SunglassesNode':
76 | # This node draw the sunglasses effect in the frame image.
77 | # Pose results is needed.
78 | dict(type='SunglassesEffectNode',
79 | name='sunglasses',
80 | enable_key='s',
81 | enable=False,
82 | input_buffer='vis',
83 | output_buffer='vis_sunglasses'),
84 | # 'BigeyeEffectNode':
85 | # This node draw the big-eye effetc in the frame image.
86 | # Pose results is needed.
87 | dict(type='BigeyeEffectNode',
88 | name='big-eye',
89 | enable_key='b',
90 | enable=False,
91 | input_buffer='vis_sunglasses',
92 | output_buffer='vis_bigeye'),
93 | # 'NoticeBoardNode':
94 | # This node show a notice board with given content, e.g. help
95 | # information.
96 | dict(
97 | type='NoticeBoardNode',
98 | name='instruction',
99 | enable_key='h',
100 | enable=True,
101 | input_buffer='vis_bigeye',
102 | output_buffer='vis_notice',
103 | content_lines=[
104 | 'This is a demo for pose visualization and simple image '
105 | 'effects. Have fun!', '', 'Hot-keys:',
106 | '"v": Pose estimation result visualization',
107 | '"s": Sunglasses effect B-)', '"b": Bug-eye effect 0_0',
108 | '"h": Show help information',
109 | '"m": Show diagnostic information', '"q": Exit'
110 | ],
111 | ),
112 | # 'MonitorNode':
113 | # This node show diagnostic information in the frame image. It can
114 | # be used for debugging or monitoring system resource status.
115 | dict(type='MonitorNode',
116 | name='monitor',
117 | enable_key='m',
118 | enable=False,
119 | input_buffer='vis_notice',
120 | output_buffer='display'),
121 | # 'RecorderNode':
122 | # This node save the output video into a file.
123 | dict(type='RecorderNode',
124 | name='recorder',
125 | out_video_file='webcam_demo.mp4',
126 | input_buffer='display',
127 | output_buffer='_display_'
128 | # `_display_` is an executor-reserved buffer
129 | )
130 | ])
131 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/rhd2d.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='rhd2d',
3 | paper_info=dict(
4 | author='Christian Zimmermann and Thomas Brox',
5 | title='Learning to Estimate 3D Hand Pose from Single RGB Images',
6 | container='arXiv',
7 | year='2017',
8 | homepage='https://lmb.informatik.uni-freiburg.de/resources/'
9 | 'datasets/RenderedHandposeDataset.en.html',
10 | ),
11 | # In RHD, 1-4: left thumb [tip to palm], which means the finger is from
12 | # tip to palm, so as other fingers. Please refer to
13 | # `https://lmb.informatik.uni-freiburg.de/resources/datasets/
14 | # RenderedHandpose/README` for details of keypoint definition.
15 | # But in COCO-WholeBody-Hand, FreiHand, CMU Panoptic HandDB, it is in
16 | # inverse order. Pay attention to this if you want to combine RHD with
17 | # other hand datasets to train a single model.
18 | # Also, note that 'keypoint_info' will not directly affect the order of
19 | # the keypoint in the dataset. It is mostly for visualization & storing
20 | # information about flip_pairs.
21 | keypoint_info={
22 | 0:
23 | dict(name='wrist', id=0, color=[255, 255, 255], type='', swap=''),
24 | 1:
25 | dict(name='thumb4', id=1, color=[255, 128, 0], type='', swap=''),
26 | 2:
27 | dict(name='thumb3', id=2, color=[255, 128, 0], type='', swap=''),
28 | 3:
29 | dict(name='thumb2', id=3, color=[255, 128, 0], type='', swap=''),
30 | 4:
31 | dict(name='thumb1', id=4, color=[255, 128, 0], type='', swap=''),
32 | 5:
33 | dict(name='forefinger4', id=5, color=[255, 153, 255], type='',
34 | swap=''),
35 | 6:
36 | dict(name='forefinger3', id=6, color=[255, 153, 255], type='',
37 | swap=''),
38 | 7:
39 | dict(name='forefinger2', id=7, color=[255, 153, 255], type='',
40 | swap=''),
41 | 8:
42 | dict(name='forefinger1', id=8, color=[255, 153, 255], type='',
43 | swap=''),
44 | 9:
45 | dict(name='middle_finger4',
46 | id=9,
47 | color=[102, 178, 255],
48 | type='',
49 | swap=''),
50 | 10:
51 | dict(name='middle_finger3',
52 | id=10,
53 | color=[102, 178, 255],
54 | type='',
55 | swap=''),
56 | 11:
57 | dict(name='middle_finger2',
58 | id=11,
59 | color=[102, 178, 255],
60 | type='',
61 | swap=''),
62 | 12:
63 | dict(name='middle_finger1',
64 | id=12,
65 | color=[102, 178, 255],
66 | type='',
67 | swap=''),
68 | 13:
69 | dict(name='ring_finger4', id=13, color=[255, 51, 51], type='',
70 | swap=''),
71 | 14:
72 | dict(name='ring_finger3', id=14, color=[255, 51, 51], type='',
73 | swap=''),
74 | 15:
75 | dict(name='ring_finger2', id=15, color=[255, 51, 51], type='',
76 | swap=''),
77 | 16:
78 | dict(name='ring_finger1', id=16, color=[255, 51, 51], type='',
79 | swap=''),
80 | 17:
81 | dict(name='pinky_finger4', id=17, color=[0, 255, 0], type='', swap=''),
82 | 18:
83 | dict(name='pinky_finger3', id=18, color=[0, 255, 0], type='', swap=''),
84 | 19:
85 | dict(name='pinky_finger2', id=19, color=[0, 255, 0], type='', swap=''),
86 | 20:
87 | dict(name='pinky_finger1', id=20, color=[0, 255, 0], type='', swap='')
88 | },
89 | skeleton_info={
90 | 0:
91 | dict(link=('wrist', 'thumb1'), id=0, color=[255, 128, 0]),
92 | 1:
93 | dict(link=('thumb1', 'thumb2'), id=1, color=[255, 128, 0]),
94 | 2:
95 | dict(link=('thumb2', 'thumb3'), id=2, color=[255, 128, 0]),
96 | 3:
97 | dict(link=('thumb3', 'thumb4'), id=3, color=[255, 128, 0]),
98 | 4:
99 | dict(link=('wrist', 'forefinger1'), id=4, color=[255, 153, 255]),
100 | 5:
101 | dict(link=('forefinger1', 'forefinger2'), id=5, color=[255, 153, 255]),
102 | 6:
103 | dict(link=('forefinger2', 'forefinger3'), id=6, color=[255, 153, 255]),
104 | 7:
105 | dict(link=('forefinger3', 'forefinger4'), id=7, color=[255, 153, 255]),
106 | 8:
107 | dict(link=('wrist', 'middle_finger1'), id=8, color=[102, 178, 255]),
108 | 9:
109 | dict(link=('middle_finger1', 'middle_finger2'),
110 | id=9,
111 | color=[102, 178, 255]),
112 | 10:
113 | dict(link=('middle_finger2', 'middle_finger3'),
114 | id=10,
115 | color=[102, 178, 255]),
116 | 11:
117 | dict(link=('middle_finger3', 'middle_finger4'),
118 | id=11,
119 | color=[102, 178, 255]),
120 | 12:
121 | dict(link=('wrist', 'ring_finger1'), id=12, color=[255, 51, 51]),
122 | 13:
123 | dict(link=('ring_finger1', 'ring_finger2'), id=13, color=[255, 51,
124 | 51]),
125 | 14:
126 | dict(link=('ring_finger2', 'ring_finger3'), id=14, color=[255, 51,
127 | 51]),
128 | 15:
129 | dict(link=('ring_finger3', 'ring_finger4'), id=15, color=[255, 51,
130 | 51]),
131 | 16:
132 | dict(link=('wrist', 'pinky_finger1'), id=16, color=[0, 255, 0]),
133 | 17:
134 | dict(link=('pinky_finger1', 'pinky_finger2'), id=17, color=[0, 255,
135 | 0]),
136 | 18:
137 | dict(link=('pinky_finger2', 'pinky_finger3'), id=18, color=[0, 255,
138 | 0]),
139 | 19:
140 | dict(link=('pinky_finger3', 'pinky_finger4'), id=19, color=[0, 255, 0])
141 | },
142 | joint_weights=[1.] * 21,
143 | sigmas=[])
144 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/horse10.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='horse10',
3 | paper_info=dict(
4 | author='Mathis, Alexander and Biasi, Thomas and '
5 | 'Schneider, Steffen and '
6 | 'Yuksekgonul, Mert and Rogers, Byron and '
7 | 'Bethge, Matthias and '
8 | 'Mathis, Mackenzie W',
9 | title='Pretraining boosts out-of-domain robustness '
10 | 'for pose estimation',
11 | container='Proceedings of the IEEE/CVF Winter Conference on '
12 | 'Applications of Computer Vision',
13 | year='2021',
14 | homepage='http://www.mackenziemathislab.org/horse10',
15 | ),
16 | keypoint_info={
17 | 0:
18 | dict(name='Nose', id=0, color=[255, 153, 255], type='upper', swap=''),
19 | 1:
20 | dict(name='Eye', id=1, color=[255, 153, 255], type='upper', swap=''),
21 | 2:
22 | dict(name='Nearknee',
23 | id=2,
24 | color=[255, 102, 255],
25 | type='upper',
26 | swap=''),
27 | 3:
28 | dict(name='Nearfrontfetlock',
29 | id=3,
30 | color=[255, 102, 255],
31 | type='upper',
32 | swap=''),
33 | 4:
34 | dict(name='Nearfrontfoot',
35 | id=4,
36 | color=[255, 102, 255],
37 | type='upper',
38 | swap=''),
39 | 5:
40 | dict(name='Offknee',
41 | id=5,
42 | color=[255, 102, 255],
43 | type='upper',
44 | swap=''),
45 | 6:
46 | dict(name='Offfrontfetlock',
47 | id=6,
48 | color=[255, 102, 255],
49 | type='upper',
50 | swap=''),
51 | 7:
52 | dict(name='Offfrontfoot',
53 | id=7,
54 | color=[255, 102, 255],
55 | type='upper',
56 | swap=''),
57 | 8:
58 | dict(name='Shoulder',
59 | id=8,
60 | color=[255, 153, 255],
61 | type='upper',
62 | swap=''),
63 | 9:
64 | dict(name='Midshoulder',
65 | id=9,
66 | color=[255, 153, 255],
67 | type='upper',
68 | swap=''),
69 | 10:
70 | dict(name='Elbow', id=10, color=[255, 153, 255], type='upper',
71 | swap=''),
72 | 11:
73 | dict(name='Girth', id=11, color=[255, 153, 255], type='upper',
74 | swap=''),
75 | 12:
76 | dict(name='Wither',
77 | id=12,
78 | color=[255, 153, 255],
79 | type='upper',
80 | swap=''),
81 | 13:
82 | dict(name='Nearhindhock',
83 | id=13,
84 | color=[255, 51, 255],
85 | type='lower',
86 | swap=''),
87 | 14:
88 | dict(name='Nearhindfetlock',
89 | id=14,
90 | color=[255, 51, 255],
91 | type='lower',
92 | swap=''),
93 | 15:
94 | dict(name='Nearhindfoot',
95 | id=15,
96 | color=[255, 51, 255],
97 | type='lower',
98 | swap=''),
99 | 16:
100 | dict(name='Hip', id=16, color=[255, 153, 255], type='lower', swap=''),
101 | 17:
102 | dict(name='Stifle',
103 | id=17,
104 | color=[255, 153, 255],
105 | type='lower',
106 | swap=''),
107 | 18:
108 | dict(name='Offhindhock',
109 | id=18,
110 | color=[255, 51, 255],
111 | type='lower',
112 | swap=''),
113 | 19:
114 | dict(name='Offhindfetlock',
115 | id=19,
116 | color=[255, 51, 255],
117 | type='lower',
118 | swap=''),
119 | 20:
120 | dict(name='Offhindfoot',
121 | id=20,
122 | color=[255, 51, 255],
123 | type='lower',
124 | swap=''),
125 | 21:
126 | dict(name='Ischium',
127 | id=21,
128 | color=[255, 153, 255],
129 | type='lower',
130 | swap='')
131 | },
132 | skeleton_info={
133 | 0:
134 | dict(link=('Nose', 'Eye'), id=0, color=[255, 153, 255]),
135 | 1:
136 | dict(link=('Eye', 'Wither'), id=1, color=[255, 153, 255]),
137 | 2:
138 | dict(link=('Wither', 'Hip'), id=2, color=[255, 153, 255]),
139 | 3:
140 | dict(link=('Hip', 'Ischium'), id=3, color=[255, 153, 255]),
141 | 4:
142 | dict(link=('Ischium', 'Stifle'), id=4, color=[255, 153, 255]),
143 | 5:
144 | dict(link=('Stifle', 'Girth'), id=5, color=[255, 153, 255]),
145 | 6:
146 | dict(link=('Girth', 'Elbow'), id=6, color=[255, 153, 255]),
147 | 7:
148 | dict(link=('Elbow', 'Shoulder'), id=7, color=[255, 153, 255]),
149 | 8:
150 | dict(link=('Shoulder', 'Midshoulder'), id=8, color=[255, 153, 255]),
151 | 9:
152 | dict(link=('Midshoulder', 'Wither'), id=9, color=[255, 153, 255]),
153 | 10:
154 | dict(link=('Nearknee', 'Nearfrontfetlock'),
155 | id=10,
156 | color=[255, 102, 255]),
157 | 11:
158 | dict(link=('Nearfrontfetlock', 'Nearfrontfoot'),
159 | id=11,
160 | color=[255, 102, 255]),
161 | 12:
162 | dict(link=('Offknee', 'Offfrontfetlock'), id=12, color=[255, 102,
163 | 255]),
164 | 13:
165 | dict(link=('Offfrontfetlock', 'Offfrontfoot'),
166 | id=13,
167 | color=[255, 102, 255]),
168 | 14:
169 | dict(link=('Nearhindhock', 'Nearhindfetlock'),
170 | id=14,
171 | color=[255, 51, 255]),
172 | 15:
173 | dict(link=('Nearhindfetlock', 'Nearhindfoot'),
174 | id=15,
175 | color=[255, 51, 255]),
176 | 16:
177 | dict(link=('Offhindhock', 'Offhindfetlock'),
178 | id=16,
179 | color=[255, 51, 255]),
180 | 17:
181 | dict(link=('Offhindfetlock', 'Offhindfoot'),
182 | id=17,
183 | color=[255, 51, 255])
184 | },
185 | joint_weights=[1.] * 22,
186 | sigmas=[])
187 |
--------------------------------------------------------------------------------
/model_configs/mmpose/hrnet_w32_animalpose_256x256.py:
--------------------------------------------------------------------------------
1 | _base_ = ['./_base_/default_runtime.py', './_base_/datasets/animalpose.py']
2 | evaluation = dict(interval=10, metric='mAP', save_best='AP')
3 |
4 | optimizer = dict(
5 | type='Adam',
6 | lr=5e-4,
7 | )
8 | optimizer_config = dict(grad_clip=None)
9 | # learning policy
10 | lr_config = dict(policy='step',
11 | warmup='linear',
12 | warmup_iters=500,
13 | warmup_ratio=0.001,
14 | step=[170, 200])
15 | total_epochs = 210
16 | log_config = dict(
17 | interval=1,
18 | hooks=[
19 | dict(type='TextLoggerHook'),
20 | # dict(type='TensorboardLoggerHook')
21 | ])
22 |
23 | channel_cfg = dict(
24 | num_output_channels=20,
25 | dataset_joints=20,
26 | dataset_channel=[
27 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
28 | ],
29 | inference_channel=[
30 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
31 | ])
32 |
33 | # model settings
34 | model = dict(type='TopDown',
35 | pretrained='https://download.openmmlab.com/mmpose/'
36 | 'pretrain_models/hrnet_w32-36af842e.pth',
37 | backbone=dict(
38 | type='HRNet',
39 | in_channels=3,
40 | extra=dict(stage1=dict(num_modules=1,
41 | num_branches=1,
42 | block='BOTTLENECK',
43 | num_blocks=(4, ),
44 | num_channels=(64, )),
45 | stage2=dict(num_modules=1,
46 | num_branches=2,
47 | block='BASIC',
48 | num_blocks=(4, 4),
49 | num_channels=(32, 64)),
50 | stage3=dict(num_modules=4,
51 | num_branches=3,
52 | block='BASIC',
53 | num_blocks=(4, 4, 4),
54 | num_channels=(32, 64, 128)),
55 | stage4=dict(num_modules=3,
56 | num_branches=4,
57 | block='BASIC',
58 | num_blocks=(4, 4, 4, 4),
59 | num_channels=(32, 64, 128, 256))),
60 | ),
61 | keypoint_head=dict(
62 | type='TopdownHeatmapSimpleHead',
63 | in_channels=32,
64 | out_channels=channel_cfg['num_output_channels'],
65 | num_deconv_layers=0,
66 | extra=dict(final_conv_kernel=1, ),
67 | loss_keypoint=dict(type='JointsMSELoss',
68 | use_target_weight=True)),
69 | train_cfg=dict(),
70 | test_cfg=dict(flip_test=True,
71 | post_process='default',
72 | shift_heatmap=True,
73 | modulate_kernel=11))
74 |
75 | data_cfg = dict(
76 | image_size=[256, 256],
77 | heatmap_size=[64, 64],
78 | num_output_channels=channel_cfg['num_output_channels'],
79 | num_joints=channel_cfg['dataset_joints'],
80 | dataset_channel=channel_cfg['dataset_channel'],
81 | inference_channel=channel_cfg['inference_channel'],
82 | soft_nms=False,
83 | nms_thr=1.0,
84 | oks_thr=0.9,
85 | vis_thr=0.2,
86 | use_gt_bbox=True,
87 | det_bbox_thr=0.0,
88 | bbox_file='',
89 | )
90 |
91 | train_pipeline = [
92 | dict(type='LoadImageFromFile'),
93 | dict(type='TopDownGetBboxCenterScale', padding=1.25),
94 | dict(type='TopDownRandomShiftBboxCenter', shift_factor=0.16, prob=0.3),
95 | dict(type='TopDownRandomFlip', flip_prob=0.5),
96 | dict(type='TopDownHalfBodyTransform',
97 | num_joints_half_body=8,
98 | prob_half_body=0.3),
99 | dict(type='TopDownGetRandomScaleRotation', rot_factor=40,
100 | scale_factor=0.5),
101 | dict(type='TopDownAffine'),
102 | dict(type='ToTensor'),
103 | dict(type='NormalizeTensor',
104 | mean=[0.485, 0.456, 0.406],
105 | std=[0.229, 0.224, 0.225]),
106 | dict(type='TopDownGenerateTarget', sigma=2),
107 | dict(type='Collect',
108 | keys=['img', 'target', 'target_weight'],
109 | meta_keys=[
110 | 'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
111 | 'rotation', 'bbox_score', 'flip_pairs'
112 | ]),
113 | ]
114 |
115 | val_pipeline = [
116 | dict(type='LoadImageFromFile'),
117 | dict(type='TopDownGetBboxCenterScale', padding=1.25),
118 | dict(type='TopDownAffine'),
119 | dict(type='ToTensor'),
120 | dict(type='NormalizeTensor',
121 | mean=[0.485, 0.456, 0.406],
122 | std=[0.229, 0.224, 0.225]),
123 | dict(type='Collect',
124 | keys=['img'],
125 | meta_keys=[
126 | 'image_file', 'center', 'scale', 'rotation', 'bbox_score',
127 | 'flip_pairs'
128 | ]),
129 | ]
130 |
131 | test_pipeline = val_pipeline
132 |
133 | data_root = 'data/animalpose'
134 | data = dict(
135 | samples_per_gpu=64,
136 | workers_per_gpu=2,
137 | val_dataloader=dict(samples_per_gpu=32),
138 | test_dataloader=dict(samples_per_gpu=32),
139 | train=dict(type='AnimalPoseDataset',
140 | ann_file=f'{data_root}/annotations/animalpose_train.json',
141 | img_prefix=f'{data_root}/',
142 | data_cfg=data_cfg,
143 | pipeline=train_pipeline,
144 | dataset_info={{_base_.dataset_info}}),
145 | val=dict(type='AnimalPoseDataset',
146 | ann_file=f'{data_root}/annotations/animalpose_val.json',
147 | img_prefix=f'{data_root}/',
148 | data_cfg=data_cfg,
149 | pipeline=val_pipeline,
150 | dataset_info={{_base_.dataset_info}}),
151 | test=dict(type='AnimalPoseDataset',
152 | ann_file=f'{data_root}/annotations/animalpose_val.json',
153 | img_prefix=f'{data_root}/',
154 | data_cfg=data_cfg,
155 | pipeline=test_pipeline,
156 | dataset_info={{_base_.dataset_info}}),
157 | )
158 |
--------------------------------------------------------------------------------
/configs/examples/bing_dwen_dwen/resource-info.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "result": "{\"width\":690,\"height\":713,\"valid\":true,\"rotate\":0,\"step_1\":{\"toolName\":\"pointTool\",\"result\":[{\"x\":374.86387434554973,\"y\":262.8020942408377,\"attribute\":\"\",\"valid\":true,\"id\":\"8SK9cVyu\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":2},{\"x\":492.8261780104712,\"y\":285.2,\"attribute\":\"\",\"valid\":true,\"id\":\"qDk54WsI\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":1},{\"x\":430.11204188481673,\"y\":318.0502617801047,\"attribute\":\"\",\"valid\":true,\"id\":\"4H80L7lL\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":3}]},\"step_2\":{\"dataSourceStep\":0,\"toolName\":\"polygonTool\",\"result\":[{\"id\":\"pwUsrf9u\",\"sourceID\":\"\",\"valid\":true,\"textAttribute\":\"\",\"pointList\":[{\"x\":423.3926701570681,\"y\":191.87539267015708},{\"x\":488.3465968586388,\"y\":209.04712041884818},{\"x\":535.3821989528797,\"y\":248.6167539267016},{\"x\":549.5675392670157,\"y\":306.8513089005236},{\"x\":537.6219895287959,\"y\":349.407329842932},{\"x\":510.74450261780106,\"y\":381.51099476439794},{\"x\":480.1340314136126,\"y\":394.9497382198953},{\"x\":411.4471204188482,\"y\":390.47015706806286},{\"x\":355.45235602094243,\"y\":373.29842931937173},{\"x\":306.17696335078534,\"y\":327.00942408376966},{\"x\":294.97801047120424,\"y\":284.45340314136126},{\"x\":306.9235602094241,\"y\":245.6303664921466},{\"x\":333.8010471204189,\"y\":217.25968586387435},{\"x\":370.3842931937173,\"y\":196.35497382198955}],\"attribute\":\"\",\"order\":1}]}}",
5 | "url": "https://user-images.githubusercontent.com/15977946/152742677-35fe8a01-bd06-4a12-a02e-949e7d71f28a.jpg",
6 | "fileName": "bing_dwen_dwen1.jpg"
7 | },
8 | {
9 | "id": 2,
10 | "result": "{\"width\":690,\"height\":659,\"valid\":true,\"rotate\":0,\"step_1\":{\"dataSourceStep\":0,\"toolName\":\"pointTool\",\"result\":[{\"x\":293.2460732984293,\"y\":242.89842931937173,\"attribute\":\"\",\"valid\":true,\"id\":\"KgPs39bY\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":1},{\"x\":170.41675392670155,\"y\":270.50052356020944,\"attribute\":\"\",\"valid\":true,\"id\":\"XwHyoBFU\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":2},{\"x\":224.24083769633506,\"y\":308.45340314136126,\"attribute\":\"\",\"valid\":true,\"id\":\"Qfs4YfuB\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":3}]},\"step_2\":{\"dataSourceStep\":0,\"toolName\":\"polygonTool\",\"result\":[{\"id\":\"ts5jlJxb\",\"sourceID\":\"\",\"valid\":true,\"textAttribute\":\"\",\"pointList\":[{\"x\":178.69738219895285,\"y\":184.93403141361256},{\"x\":204.91937172774865,\"y\":172.5130890052356},{\"x\":252.5329842931937,\"y\":169.0628272251309},{\"x\":295.3162303664921,\"y\":175.27329842931937},{\"x\":333.95916230366487,\"y\":195.2848167539267},{\"x\":360.18115183246067,\"y\":220.1267015706806},{\"x\":376.0523560209424,\"y\":262.909947643979},{\"x\":373.98219895287957,\"y\":296.0324607329843},{\"x\":344.99999999999994,\"y\":335.365445026178},{\"x\":322.22827225130885,\"y\":355.37696335078533},{\"x\":272.544502617801,\"y\":378.1486910994764},{\"x\":221.48062827225127,\"y\":386.42931937172773},{\"x\":187.6680628272251,\"y\":385.7392670157068},{\"x\":158.68586387434553,\"y\":369.1780104712042},{\"x\":137.98429319371724,\"y\":337.43560209424083},{\"x\":127.63350785340312,\"y\":295.34240837696336},{\"x\":131.0837696335078,\"y\":242.89842931937173},{\"x\":147.64502617801045,\"y\":208.3958115183246}],\"attribute\":\"\",\"order\":1}]}}",
11 | "url": "https://user-images.githubusercontent.com/15977946/152742707-c0c51844-e1d0-42d0-9a12-e369002e082f.jpg",
12 | "fileName": "bing_dwen_dwen2.jpg"
13 | },
14 | {
15 | "id": 3,
16 | "result": "{\"width\":690,\"height\":811,\"valid\":true,\"rotate\":0,\"step_1\":{\"dataSourceStep\":0,\"toolName\":\"pointTool\",\"result\":[{\"x\":361.13507853403144,\"y\":300.62198952879584,\"attribute\":\"\",\"valid\":true,\"id\":\"uAtbXtf2\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":1},{\"x\":242.24502617801048,\"y\":317.60628272251313,\"attribute\":\"\",\"valid\":true,\"id\":\"iLtceHMA\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":2},{\"x\":302.5392670157068,\"y\":356.67015706806285,\"attribute\":\"\",\"valid\":true,\"id\":\"n9MTlJ6A\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":3}]},\"step_2\":{\"dataSourceStep\":0,\"toolName\":\"polygonTool\",\"result\":[{\"id\":\"5sTLU5wF\",\"sourceID\":\"\",\"valid\":true,\"textAttribute\":\"\",\"pointList\":[{\"x\":227.80837696335078,\"y\":247.12146596858642},{\"x\":248.18952879581153,\"y\":235.23246073298432},{\"x\":291.4994764397906,\"y\":225.04188481675394},{\"x\":351.7937172774869,\"y\":229.28795811518327},{\"x\":393.40523560209425,\"y\":245.42303664921468},{\"x\":424.8261780104712,\"y\":272.59790575916236},{\"x\":443.5089005235602,\"y\":298.07434554973827},{\"x\":436.7151832460733,\"y\":345.6303664921466},{\"x\":406.1434554973822,\"y\":382.9958115183247},{\"x\":355.1905759162304,\"y\":408.4722513089006},{\"x\":313.57905759162304,\"y\":419.5120418848168},{\"x\":262.6261780104712,\"y\":417.81361256544506},{\"x\":224.41151832460733,\"y\":399.9801047120419},{\"x\":201.48272251308902,\"y\":364.3130890052356},{\"x\":194.68900523560208,\"y\":315.0586387434555},{\"x\":202.33193717277487,\"y\":272.59790575916236}],\"attribute\":\"\",\"order\":1}]}}",
17 | "url": "https://user-images.githubusercontent.com/15977946/152742728-99392ecf-8f5c-46cf-b5c4-fe7fb6b39976.jpg",
18 | "fileName": "bing_dwen_dwen3.jpg"
19 | },
20 | {
21 | "id": 4,
22 | "result": "{\"width\":690,\"height\":690,\"valid\":true,\"rotate\":0,\"step_1\":{\"dataSourceStep\":0,\"toolName\":\"pointTool\",\"result\":[{\"x\":365.9528795811519,\"y\":464.5759162303665,\"attribute\":\"\",\"valid\":true,\"id\":\"IKprTuHS\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":1},{\"x\":470.71727748691103,\"y\":445.06806282722516,\"attribute\":\"\",\"valid\":true,\"id\":\"Z90CWkEI\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":2},{\"x\":410.74869109947645,\"y\":395.2146596858639,\"attribute\":\"\",\"valid\":true,\"id\":\"UWRstKZk\",\"sourceID\":\"\",\"textAttribute\":\"\",\"order\":3}]},\"step_2\":{\"dataSourceStep\":0,\"toolName\":\"polygonTool\",\"result\":[{\"id\":\"C30Pc9Ww\",\"sourceID\":\"\",\"valid\":true,\"textAttribute\":\"\",\"pointList\":[{\"x\":412.91623036649213,\"y\":325.85340314136124},{\"x\":468.5497382198953,\"y\":335.9685863874345},{\"x\":501.78534031413614,\"y\":369.2041884816754},{\"x\":514.0680628272252,\"y\":415.44502617801044},{\"x\":504.67539267015707,\"y\":472.5235602094241},{\"x\":484.44502617801044,\"y\":497.0890052356021},{\"x\":443.26178010471205,\"y\":512.9842931937172},{\"x\":389.7958115183246,\"y\":518.7643979057591},{\"x\":336.32984293193715,\"y\":504.31413612565444},{\"x\":302.3717277486911,\"y\":462.40837696335075},{\"x\":298.0366492146597,\"y\":416.89005235602093},{\"x\":318.26701570680626,\"y\":372.0942408376963},{\"x\":363.0628272251309,\"y\":341.0261780104712}],\"attribute\":\"\",\"order\":1}]}}",
23 | "url": "https://user-images.githubusercontent.com/15977946/152742755-9dc75f89-4156-4103-9c6d-f35f1f409d11.jpg",
24 | "fileName": "bing_dwen_dwen4.jpg"
25 | }
26 | ]
27 |
--------------------------------------------------------------------------------
/model_configs/mmpose/_base_/datasets/fly.py:
--------------------------------------------------------------------------------
1 | dataset_info = dict(
2 | dataset_name='fly',
3 | paper_info=dict(
4 | author='Pereira, Talmo D and Aldarondo, Diego E and '
5 | 'Willmore, Lindsay and Kislin, Mikhail and '
6 | 'Wang, Samuel S-H and Murthy, Mala and Shaevitz, Joshua W',
7 | title='Fast animal pose estimation using deep neural networks',
8 | container='Nature methods',
9 | year='2019',
10 | homepage='https://github.com/jgraving/DeepPoseKit-Data',
11 | ),
12 | keypoint_info={
13 | 0:
14 | dict(name='head', id=0, color=[255, 255, 255], type='', swap=''),
15 | 1:
16 | dict(name='eyeL', id=1, color=[255, 255, 255], type='', swap='eyeR'),
17 | 2:
18 | dict(name='eyeR', id=2, color=[255, 255, 255], type='', swap='eyeL'),
19 | 3:
20 | dict(name='neck', id=3, color=[255, 255, 255], type='', swap=''),
21 | 4:
22 | dict(name='thorax', id=4, color=[255, 255, 255], type='', swap=''),
23 | 5:
24 | dict(name='abdomen', id=5, color=[255, 255, 255], type='', swap=''),
25 | 6:
26 | dict(name='forelegR1',
27 | id=6,
28 | color=[255, 255, 255],
29 | type='',
30 | swap='forelegL1'),
31 | 7:
32 | dict(name='forelegR2',
33 | id=7,
34 | color=[255, 255, 255],
35 | type='',
36 | swap='forelegL2'),
37 | 8:
38 | dict(name='forelegR3',
39 | id=8,
40 | color=[255, 255, 255],
41 | type='',
42 | swap='forelegL3'),
43 | 9:
44 | dict(name='forelegR4',
45 | id=9,
46 | color=[255, 255, 255],
47 | type='',
48 | swap='forelegL4'),
49 | 10:
50 | dict(name='midlegR1',
51 | id=10,
52 | color=[255, 255, 255],
53 | type='',
54 | swap='midlegL1'),
55 | 11:
56 | dict(name='midlegR2',
57 | id=11,
58 | color=[255, 255, 255],
59 | type='',
60 | swap='midlegL2'),
61 | 12:
62 | dict(name='midlegR3',
63 | id=12,
64 | color=[255, 255, 255],
65 | type='',
66 | swap='midlegL3'),
67 | 13:
68 | dict(name='midlegR4',
69 | id=13,
70 | color=[255, 255, 255],
71 | type='',
72 | swap='midlegL4'),
73 | 14:
74 | dict(name='hindlegR1',
75 | id=14,
76 | color=[255, 255, 255],
77 | type='',
78 | swap='hindlegL1'),
79 | 15:
80 | dict(name='hindlegR2',
81 | id=15,
82 | color=[255, 255, 255],
83 | type='',
84 | swap='hindlegL2'),
85 | 16:
86 | dict(name='hindlegR3',
87 | id=16,
88 | color=[255, 255, 255],
89 | type='',
90 | swap='hindlegL3'),
91 | 17:
92 | dict(name='hindlegR4',
93 | id=17,
94 | color=[255, 255, 255],
95 | type='',
96 | swap='hindlegL4'),
97 | 18:
98 | dict(name='forelegL1',
99 | id=18,
100 | color=[255, 255, 255],
101 | type='',
102 | swap='forelegR1'),
103 | 19:
104 | dict(name='forelegL2',
105 | id=19,
106 | color=[255, 255, 255],
107 | type='',
108 | swap='forelegR2'),
109 | 20:
110 | dict(name='forelegL3',
111 | id=20,
112 | color=[255, 255, 255],
113 | type='',
114 | swap='forelegR3'),
115 | 21:
116 | dict(name='forelegL4',
117 | id=21,
118 | color=[255, 255, 255],
119 | type='',
120 | swap='forelegR4'),
121 | 22:
122 | dict(name='midlegL1',
123 | id=22,
124 | color=[255, 255, 255],
125 | type='',
126 | swap='midlegR1'),
127 | 23:
128 | dict(name='midlegL2',
129 | id=23,
130 | color=[255, 255, 255],
131 | type='',
132 | swap='midlegR2'),
133 | 24:
134 | dict(name='midlegL3',
135 | id=24,
136 | color=[255, 255, 255],
137 | type='',
138 | swap='midlegR3'),
139 | 25:
140 | dict(name='midlegL4',
141 | id=25,
142 | color=[255, 255, 255],
143 | type='',
144 | swap='midlegR4'),
145 | 26:
146 | dict(name='hindlegL1',
147 | id=26,
148 | color=[255, 255, 255],
149 | type='',
150 | swap='hindlegR1'),
151 | 27:
152 | dict(name='hindlegL2',
153 | id=27,
154 | color=[255, 255, 255],
155 | type='',
156 | swap='hindlegR2'),
157 | 28:
158 | dict(name='hindlegL3',
159 | id=28,
160 | color=[255, 255, 255],
161 | type='',
162 | swap='hindlegR3'),
163 | 29:
164 | dict(name='hindlegL4',
165 | id=29,
166 | color=[255, 255, 255],
167 | type='',
168 | swap='hindlegR4'),
169 | 30:
170 | dict(name='wingL', id=30, color=[255, 255, 255], type='',
171 | swap='wingR'),
172 | 31:
173 | dict(name='wingR', id=31, color=[255, 255, 255], type='',
174 | swap='wingL'),
175 | },
176 | skeleton_info={
177 | 0: dict(link=('eyeL', 'head'), id=0, color=[255, 255, 255]),
178 | 1: dict(link=('eyeR', 'head'), id=1, color=[255, 255, 255]),
179 | 2: dict(link=('neck', 'head'), id=2, color=[255, 255, 255]),
180 | 3: dict(link=('thorax', 'neck'), id=3, color=[255, 255, 255]),
181 | 4: dict(link=('abdomen', 'thorax'), id=4, color=[255, 255, 255]),
182 | 5: dict(link=('forelegR2', 'forelegR1'), id=5, color=[255, 255, 255]),
183 | 6: dict(link=('forelegR3', 'forelegR2'), id=6, color=[255, 255, 255]),
184 | 7: dict(link=('forelegR4', 'forelegR3'), id=7, color=[255, 255, 255]),
185 | 8: dict(link=('midlegR2', 'midlegR1'), id=8, color=[255, 255, 255]),
186 | 9: dict(link=('midlegR3', 'midlegR2'), id=9, color=[255, 255, 255]),
187 | 10: dict(link=('midlegR4', 'midlegR3'), id=10, color=[255, 255, 255]),
188 | 11: dict(link=('hindlegR2', 'hindlegR1'), id=11, color=[255, 255,
189 | 255]),
190 | 12: dict(link=('hindlegR3', 'hindlegR2'), id=12, color=[255, 255,
191 | 255]),
192 | 13: dict(link=('hindlegR4', 'hindlegR3'), id=13, color=[255, 255,
193 | 255]),
194 | 14: dict(link=('forelegL2', 'forelegL1'), id=14, color=[255, 255,
195 | 255]),
196 | 15: dict(link=('forelegL3', 'forelegL2'), id=15, color=[255, 255,
197 | 255]),
198 | 16: dict(link=('forelegL4', 'forelegL3'), id=16, color=[255, 255,
199 | 255]),
200 | 17: dict(link=('midlegL2', 'midlegL1'), id=17, color=[255, 255, 255]),
201 | 18: dict(link=('midlegL3', 'midlegL2'), id=18, color=[255, 255, 255]),
202 | 19: dict(link=('midlegL4', 'midlegL3'), id=19, color=[255, 255, 255]),
203 | 20: dict(link=('hindlegL2', 'hindlegL1'), id=20, color=[255, 255,
204 | 255]),
205 | 21: dict(link=('hindlegL3', 'hindlegL2'), id=21, color=[255, 255,
206 | 255]),
207 | 22: dict(link=('hindlegL4', 'hindlegL3'), id=22, color=[255, 255,
208 | 255]),
209 | 23: dict(link=('wingL', 'neck'), id=23, color=[255, 255, 255]),
210 | 24: dict(link=('wingR', 'neck'), id=24, color=[255, 255, 255])
211 | },
212 | joint_weights=[1.] * 32,
213 | sigmas=[])
214 |
--------------------------------------------------------------------------------