Skip to content

Commit

Permalink
add animal demos in readme (open-mmlab#561)
Browse files Browse the repository at this point in the history
* add demos in readme

* update readme

* cat-id to det-cat-id

* add demo in README

* rename demo name
  • Loading branch information
jin-s13 authored Apr 9, 2021
1 parent de34de7 commit 75ff4cd
Show file tree
Hide file tree
Showing 22 changed files with 860 additions and 21 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ The master branch works with **PyTorch 1.3+**.
COCO 17-keypoint pose estimation
</div>
<div align="center">
<img src="https://user-images.githubusercontent.com/9464825/95552839-00a61080-0a40-11eb-818c-b8dad7307217.gif" width="600px" alt><br>
<img src="https://user-images.githubusercontent.com/9464825/95552839-00a61080-0a40-11eb-818c-b8dad7307217.gif" width="600px" alt><br>

133-keypoint whole-body pose estimation ([full HD version](https://www.youtube.com/watch?v=pIJpQg8mXUU))

</div>
<div align="center">
<img src="https://user-images.githubusercontent.com/11788150/114201893-4446ec00-9989-11eb-808b-5718c47c7b23.gif" width="600px" alt><br>
2D animal_pose estimation
</div>

### Major Features

- **Support diverse tasks**

We support a wide spectrum of mainstream human pose analysis tasks in current research community, including 2d multi-person human pose estimation, 2d hand pose estimation, 2d face landmark detection, 133 keypoint whole-body human pose estimation, fashion landmark detection and 3d human mesh recovery.
We support a wide spectrum of mainstream pose analysis tasks in current research community, including 2d multi-person human pose estimation, 2d hand pose estimation, 2d face landmark detection, 133 keypoint whole-body human pose estimation, 3d human mesh recovery, fashion landmark detection and animal pose estimation.
See [demo.md](demo/README.md) for more information.

- **Higher efficiency and higher accuracy**

Expand Down
10 changes: 8 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/open-mmlab/mmpose.svg)](https://github.com/open-mmlab/mmpose/issues)
[![Percentage of issues still open](https://isitmaintained.com/badge/open/open-mmlab/mmpose.svg)](https://github.com/open-mmlab/mmpose/issues)

MMPose 是一款基于 PyTorch 的人体姿态分析的开源工具箱,是 [OpenMMLab](http://openmmlab.org/) 项目的成员之一。
MMPose 是一款基于 PyTorch 的姿态分析的开源工具箱,是 [OpenMMLab](http://openmmlab.org/) 项目的成员之一。

主分支代码目前支持 **PyTorch 1.3 以上**的版本

Expand All @@ -28,12 +28,18 @@ MMPose 是一款基于 PyTorch 的人体姿态分析的开源工具箱,是 [Op
133关键点-多人全身姿态估计 ([高清完整版](https://www.youtube.com/watch?v=pIJpQg8mXUU))

</div>
</div>
<div align="center">
<img src="https://user-images.githubusercontent.com/11788150/114201893-4446ec00-9989-11eb-808b-5718c47c7b23.gif" width="600px" alt><br>
2D 动物姿态估计
</div>

### 主要特性

- **支持多种人体姿态分析相关任务**

MMPose 支持当前学界广泛关注的主流人体姿态分析任务:主要包括 2D多人姿态估计、2D手部姿态估计、2D人脸关键点检测、133关键点的全身人体姿态估计、服饰关键点检测,3D人体形状恢复等。
MMPose 支持当前学界广泛关注的主流姿态分析任务:主要包括 2D多人姿态估计、2D手部姿态估计、2D人脸关键点检测、133关键点的全身人体姿态估计、3D人体形状恢复、服饰关键点检测、动物关键点检测等。
具体请参考 [功能演示](demo/README.md)

- **更高的精度和更快的速度**

Expand Down
10 changes: 10 additions & 0 deletions configs/animal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ dogs, macaques, and cheetah. It provides detailed behavioral analysis for neuros
## Data preparation

Please follow [DATA Preparation](/docs/tasks/2d_animal_keypoint.md) to prepare data.

## Demo

Please follow [DEMO](/demo/2d_animal_demo.md) to generate fancy demos.

<img src="https://user-images.githubusercontent.com/11788150/114201893-4446ec00-9989-11eb-808b-5718c47c7b23.gif" height="140px" alt><br>

<img src="https://user-images.githubusercontent.com/11788150/114205282-b5d46980-998c-11eb-9d6b-85ba47f81252.gif" height="140px" alt><br>

<img src="https://user-images.githubusercontent.com/11788150/114023530-944c8280-98a5-11eb-86b0-5f6d3e232af0.gif" height="140px" alt><br>
2 changes: 2 additions & 0 deletions configs/bottom_up/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Please follow [DATA Preparation](/docs/tasks/2d_body_keypoint.md) to prepare dat
## Demo

Please follow [Demo](/demo/2d_human_pose_demo.md#2d-human-pose-demo) to run demos.

<img src="demo/demo_coco.gif" width="600px" alt>
6 changes: 6 additions & 0 deletions configs/face/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ or the rough location (or the bounding box) of the hand is provided.
## Data preparation

Please follow [DATA Preparation](/docs/tasks/2d_face_keypoint.md) to prepare data.

## Demo

Please follow [Demo](/demo/2d_face_demo.md) to run demos.

<img src="https://user-images.githubusercontent.com/11788150/109144943-ccd44900-779c-11eb-9e9d-8682e7629654.gif" width="600px" alt><br>
6 changes: 6 additions & 0 deletions configs/hand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ or the rough location (or the bounding box) of the hand is provided.
## Data preparation

Please follow [DATA Preparation](/docs/tasks/2d_hand_keypoint.md) to prepare data.

## Demo

Please follow [Demo](/demo/2d_hand_demo.md) to run demos.

<img src="https://user-images.githubusercontent.com/11788150/109098558-8c54db00-775c-11eb-8966-85df96b23dc5.gif" width="600px" alt><br>
2 changes: 2 additions & 0 deletions configs/top_down/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Please follow [DATA Preparation](/docs/tasks/2d_body_keypoint.md) to prepare dat
## Demo

Please follow [Demo](/demo/2d_human_pose_demo.md#2d-human-pose-demo) to run demos.

<img src="demo/demo_coco.gif" width="600px" alt>
6 changes: 6 additions & 0 deletions configs/wholebody/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ They perform human detection first, followed by single-person whole-body pose es
## Data preparation

Please follow [DATA Preparation](/docs/tasks/2d_wholebody_keypoint.md) to prepare data.

## Demo

Please follow [Demo](/demo/2d_wholebody_pose_demo.md) to run demos.

<img src="https://user-images.githubusercontent.com/9464825/95552839-00a61080-0a40-11eb-818c-b8dad7307217.gif" width="600px" alt><br>
148 changes: 148 additions & 0 deletions demo/2d_animal_demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
## 2D Animal Pose Demo

### 2D Animal Pose Image Demo

#### Using gt hand bounding boxes as input

We provide a demo script to test a single image, given gt json file.

*Pose Model Preparation:*
The pre-trained pose estimation model can be downloaded from [model zoo](https://mmpose.readthedocs.io/en/latest/animal_models.html#).
Take [macaque model](https://download.openmmlab.com/mmpose/animal/resnet/res50_macaque_256x192-98f1dd3a_20210407.pth) as an example:

```shell
python demo/top_down_img_demo.py \
${MMPOSE_CONFIG_FILE} ${MMPOSE_CHECKPOINT_FILE} \
--img-root ${IMG_ROOT} --json-file ${JSON_FILE} \
--out-img-root ${OUTPUT_DIR} \
[--show --device ${GPU_ID or CPU}] \
[--kpt-thr ${KPT_SCORE_THR}]
```

Examples:

```shell
python demo/top_down_img_demo.py \
configs/animal/resnet/macaque/res50_macaque_256x192.py \
https://download.openmmlab.com/mmpose/animal/resnet/res50_macaque_256x192-98f1dd3a_20210407.pth \
--img-root tests/data/macaque/ --json-file tests/data/macaque/test_macaque.json \
--out-img-root vis_results
```

To run demos on CPU:

```shell
python demo/top_down_img_demo.py \
configs/animal/resnet/macaque/res50_macaque_256x192.py \
https://download.openmmlab.com/mmpose/animal/resnet/res50_macaque_256x192-98f1dd3a_20210407.pth \
--img-root tests/data/macaque/ --json-file tests/data/macaque/test_macaque.json \
--out-img-root vis_results
--device=cpu
```

### 2D Animal Pose Video Demo

We also provide video demos to illustrate the results.

#### Using the full image as input

If the video is cropped with the object centered in the screen, we can simply use the full image as the model input (without object detection).

```shell
python demo/top_down_video_demo_full_frame_without_det.py \
${MMPOSE_CONFIG_FILE} ${MMPOSE_CHECKPOINT_FILE} \
--video-path ${VIDEO_FILE} \
--out-video-root ${OUTPUT_VIDEO_ROOT} \
[--show --device ${GPU_ID or CPU}] \
[--kpt-thr ${KPT_SCORE_THR}]
```

Examples:

```shell
python demo/top_down_video_demo_full_frame_without_det.py \
configs/animal/resnet/fly/res152_fly_192x192.py \
https://download.openmmlab.com/mmpose/animal/resnet/res152_fly_192x192-fcafbd5a_20210407.pth \
--video-path demo_fly_video.avi \
--out-video-root vis_results
```

<img src="https://user-images.githubusercontent.com/11788150/114023530-944c8280-98a5-11eb-86b0-5f6d3e232af0.gif" height="140px" alt><br>

#### Using MMDetection to detect animals

Assume that you have already installed [mmdet](https://github.com/open-mmlab/mmdetection).

**COCO-animals**

In COCO dataset, there are 80 object categories, including 10 common `animal` categories (16: 'bird', 17: 'cat', 18: 'dog', 19: 'horse', 20: 'sheep', 21: 'cow', 22: 'elephant', 23: 'bear', 24: 'zebra', 25: 'giraffe')
For these COCO-animals, please download the COCO pre-trained detection model from [MMDetection Model Zoo](https://mmdetection.readthedocs.io/en/latest/model_zoo.html).

```shell
python demo/top_down_video_demo_with_mmdet.py \
${MMDET_CONFIG_FILE} ${MMDET_CHECKPOINT_FILE} \
${MMPOSE_CONFIG_FILE} ${MMPOSE_CHECKPOINT_FILE} \
--video-path ${VIDEO_FILE} \
--out-video-root ${OUTPUT_VIDEO_ROOT} \
--det-cat-id ${CATEGORY_ID}
[--show --device ${GPU_ID or CPU}] \
[--bbox-thr ${BBOX_SCORE_THR} --kpt-thr ${KPT_SCORE_THR}]
```

Examples:

```shell
python demo/top_down_video_demo_with_mmdet.py \
demo/mmdetection_cfg/faster_rcnn_r50_fpn_coco.py \
http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_2x_coco/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth \
configs/animal/resnet/horse10/res50_horse10_256x256-split1.py \
https://download.openmmlab.com/mmpose/animal/resnet/res50_horse10_256x256_split1-3a3dc37e_20210405.pth \
--video-path demo_horse.mp4 \
--out-video-root vis_results \
--bbox-thr 0.1 \
--kpt-thr 0.4 \
--det-cat-id 19
```

<img src="https://user-images.githubusercontent.com/11788150/114201893-4446ec00-9989-11eb-808b-5718c47c7b23.gif" height="140px" alt><br>

**Other Animals**

For other animals, we have also provided some pre-trained animal detection models (1-class models). Supported models can be found in [det model zoo](/demo/mmdet_modelzoo.md).
The pre-trained animal pose estimation model can be found in [pose model zoo](https://mmpose.readthedocs.io/en/latest/animal_models.html#).

```shell
python demo/top_down_video_demo_with_mmdet.py \
${MMDET_CONFIG_FILE} ${MMDET_CHECKPOINT_FILE} \
${MMPOSE_CONFIG_FILE} ${MMPOSE_CHECKPOINT_FILE} \
--video-path ${VIDEO_FILE} \
--out-video-root ${OUTPUT_VIDEO_ROOT} \
[--det-cat-id ${CATEGORY_ID}]
[--show --device ${GPU_ID or CPU}] \
[--bbox-thr ${BBOX_SCORE_THR} --kpt-thr ${KPT_SCORE_THR}]
```

Examples:

```shell
python demo/top_down_video_demo_with_mmdet.py \
demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_1class.py \
https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_macaque-e45e36f5_20210409.pth \
configs/animal/resnet/macaque/res152_macaque_256x192.py \
https://download.openmmlab.com/mmpose/animal/resnet/res152_macaque_256x192-c42abc02_20210407.pth \
--video-path demo_macaque.mp4 \
--out-video-root vis_results \
--bbox-thr 0.5 \
--kpt-thr 0.3 \
```

<img src="https://user-images.githubusercontent.com/11788150/114205282-b5d46980-998c-11eb-9d6b-85ba47f81252.gif" height="140px" alt><br>

### Speed Up Inference

Some tips to speed up MMPose inference:

For 2D animal pose estimation models, try to edit the config file. For example,

1. set `flip_test=False` in [macaque-res50](/configs/animal/resnet/macaque/res50_macaque_256x192.py#L51).
1. set `post_process='default'` in [macaque-res50](/configs/animal/resnet/macaque/res50_macaque_256x192.py#L52).
6 changes: 3 additions & 3 deletions demo/2d_hand_demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ python demo/top_down_img_demo_with_mmdet.py \
```

```shell
python demo/top_down_img_demo_with_mmdet.py demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k.py \
python demo/top_down_img_demo_with_mmdet.py demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_1class.py \
https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth \
configs/hand/resnet/onehand10k/res50_onehand10k_256x256.py \
https://download.openmmlab.com/mmpose/top_down/resnet/res50_onehand10k_256x256-e67998f6_20200813.pth \
Expand All @@ -80,7 +80,7 @@ Assume that you have already installed [mmdet](https://github.com/open-mmlab/mmd

*Hand Box Model Preparation:* The pre-trained hand box estimation model can be found in [det model zoo](/demo/mmdet_modelzoo.md).

*Hand Pose Model Preparation:* The pre-trained hand pose estimation model can be downloaded from [pose model zoo](https://mmpose.readthedocs.io/en/latest/hand_models.html#).
*Hand Pose Model Preparation:* The pre-trained hand pose estimation model can be found in [pose model zoo](https://mmpose.readthedocs.io/en/latest/hand_models.html#).

```shell
python demo/top_down_video_demo_with_mmdet.py \
Expand All @@ -95,7 +95,7 @@ python demo/top_down_video_demo_with_mmdet.py \
Examples:

```shell
python demo/top_down_video_demo_with_mmdet.py demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k.py \
python demo/top_down_video_demo_with_mmdet.py demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_1class.py \
https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth \
configs/hand/resnet/onehand10k/res50_onehand10k_256x256.py \
https://download.openmmlab.com/mmpose/top_down/resnet/res50_onehand10k_256x256-e67998f6_20200813.pth \
Expand Down
6 changes: 6 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ This page provides tutorials about running demos. Please click the caption for m

[2D pose tracking demo](2d_pose_tracking_demo.md)
</div>

<div align="center">
<img src="https://user-images.githubusercontent.com/11788150/114201893-4446ec00-9989-11eb-808b-5718c47c7b23.gif" width="600px" alt><br>

[2D animal_pose demo](2d_animal_demo.md)
</div>
16 changes: 15 additions & 1 deletion demo/mmdet_modelzoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@ For hand bounding box detection, we simply train our hand box models on onehand1

| Arch | Box AP | ckpt | log |
| :-------------- | :-----------: | :------: | :------: |
| [Cascade_R-CNN X-101-64x4d-FPN](/demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k.py) | 0.817 | [ckpt](https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth) | [log](https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k_20201030.log.json) |
| [Cascade_R-CNN X-101-64x4d-FPN-1class](/demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_1class.py) | 0.817 | [ckpt](https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k-dac19597_20201030.pth) | [log](https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_onehand10k_20201030.log.json) |

### Animal Bounding Box Detection Models

#### COCO animals

In COCO dataset, there are 80 object categories, including 10 common `animal` categories (16: 'bird', 17: 'cat', 18: 'dog', 19: 'horse', 20: 'sheep', 21: 'cow', 22: 'elephant', 23: 'bear', 24: 'zebra', 25: 'giraffe')
For animals in the categories, please download from [MMDetection Model Zoo](https://mmdetection.readthedocs.io/en/latest/model_zoo.html).

#### Macaque detection results on MacaquePose test set

| Arch | Box AP | ckpt | log |
| :-------------- | :-----------: | :------: | :------: |
| [Faster_R-CNN_Res50-FPN-1class](/demo/mmdetection_cfg/faster_rcnn_r50_fpn_1class.py) | 0.840 | [ckpt](https://download.openmmlab.com/mmpose/mmdet_pretrained/faster_rcnn_r50_fpn_1x_macaque-f64f2812_20210409.pth) | [log](https://download.openmmlab.com/mmpose/mmdet_pretrained/faster_rcnn_r50_fpn_1x_macaque_20210409.log.json) |
| [Cascade_R-CNN X-101-64x4d-FPN-1class](/demo/mmdetection_cfg/cascade_rcnn_x101_64x4d_fpn_1class.py) | 0.879 | [ckpt](https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_macaque-e45e36f5_20210409.pth) | [log](https://download.openmmlab.com/mmpose/mmdet_pretrained/cascade_rcnn_x101_64x4d_fpn_20e_macaque_20210409.log.json) |
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
max_per_img=100))

dataset_type = 'CocoDataset'
data_root = 'data/onehand10k/'
data_root = 'data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
Expand Down Expand Up @@ -244,17 +244,17 @@
workers_per_gpu=2,
train=dict(
type=dataset_type,
ann_file=data_root + 'annotations/onehand10k_train.json',
img_prefix=data_root + '/',
ann_file=data_root + 'annotations/instances_train2017.json',
img_prefix=data_root + 'train2017/',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
ann_file=data_root + 'annotations/onehand10k_test.json',
img_prefix=data_root + '/',
ann_file=data_root + 'annotations/instances_val2017.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
ann_file=data_root + 'annotations/onehand10k_test.json',
img_prefix=data_root + '/',
ann_file=data_root + 'annotations/instances_val2017.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline))
evaluation = dict(interval=1, metric='bbox')
Loading

0 comments on commit 75ff4cd

Please sign in to comment.