Skip to content

Commit

Permalink
update animal pose (open-mmlab#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-s13 authored Apr 27, 2021
1 parent f7e3e8d commit 84289b6
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion configs/animal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Please follow [DATA Preparation](/docs/tasks/2d_animal_keypoint.md) to prepare d

## Demo

Please follow [DEMO](/demo/2d_animal_demo.md) to generate fancy demos.
Please follow [DEMO](/demo/docs/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>

Expand Down
2 changes: 1 addition & 1 deletion configs/bottom_up/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ 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.
Please follow [Demo](/demo/docs/2d_human_pose_demo.md#2d-human-pose-demo) to run demos.

<img src="demo/resources/demo_coco.gif" width="600px" alt>
2 changes: 1 addition & 1 deletion configs/face/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Please follow [DATA Preparation](/docs/tasks/2d_face_keypoint.md) to prepare dat

## Demo

Please follow [Demo](/demo/2d_face_demo.md) to run demos.
Please follow [Demo](/demo/docs/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>
2 changes: 1 addition & 1 deletion configs/hand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Please follow [DATA Preparation](/docs/tasks/2d_hand_keypoint.md) to prepare dat

## Demo

Please follow [Demo](/demo/2d_hand_demo.md) to run demos.
Please follow [Demo](/demo/docs/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: 1 addition & 1 deletion configs/top_down/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ 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.
Please follow [Demo](/demo/docs/2d_human_pose_demo.md#2d-human-pose-demo) to run demos.

<img src="demo/resources/demo_coco.gif" width="600px" alt>
2 changes: 1 addition & 1 deletion configs/wholebody/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Please follow [DATA Preparation](/docs/tasks/2d_wholebody_keypoint.md) to prepar

## Demo

Please follow [Demo](/demo/2d_wholebody_pose_demo.md) to run demos.
Please follow [Demo](/demo/docs/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>
4 changes: 2 additions & 2 deletions demo/docs/2d_animal_demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Assume that you have already installed [mmdet](https://github.com/open-mmlab/mmd

**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')
In COCO dataset, there are 80 object categories, including 10 common `animal` categories (15: 'bird', 16: 'cat', 17: 'dog', 18: 'horse', 19: 'sheep', 20: 'cow', 21: 'elephant', 22: 'bear', 23: 'zebra', 24: '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
Expand All @@ -101,7 +101,7 @@ python demo/top_down_video_demo_with_mmdet.py \
--out-video-root vis_results \
--bbox-thr 0.1 \
--kpt-thr 0.4 \
--det-cat-id 19
--det-cat-id 18
```

<img src="https://user-images.githubusercontent.com/11788150/114201893-4446ec00-9989-11eb-808b-5718c47c7b23.gif" height="140px" alt><br>
Expand Down
8 changes: 4 additions & 4 deletions demo/top_down_img_demo_with_mmdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
has_mmdet = False


def process_mmdet_results(mmdet_results, cat_id=0):
def process_mmdet_results(mmdet_results, cat_id=1):
"""Process mmdet results, and return a list of bboxes.
:param mmdet_results:
:param cat_id: category id (default: 0 for human)
:param cat_id: category id (default: 1 for human)
:return: a list of detected bounding boxes
"""
if isinstance(mmdet_results, tuple):
det_results = mmdet_results[0]
else:
det_results = mmdet_results

bboxes = det_results[cat_id]
bboxes = det_results[cat_id - 1]

person_results = []
for bbox in bboxes:
Expand Down Expand Up @@ -69,7 +69,7 @@ def main():
parser.add_argument(
'--det-cat-id',
type=int,
default=0,
default=1,
help='Category id for bounding box detection model')

assert has_mmdet, 'Please install mmdet to run the demo.'
Expand Down
8 changes: 4 additions & 4 deletions demo/top_down_pose_tracking_demo_with_mmdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
has_mmdet = False


def process_mmdet_results(mmdet_results, cat_id=0):
def process_mmdet_results(mmdet_results, cat_id=1):
"""Process mmdet results, and return a list of bboxes.
:param mmdet_results:
:param cat_id: category id (default: 0 for human)
:param cat_id: category id (default: 1 for human)
:return: a list of detected bounding boxes
"""
if isinstance(mmdet_results, tuple):
det_results = mmdet_results[0]
else:
det_results = mmdet_results

bboxes = det_results[cat_id]
bboxes = det_results[cat_id - 1]

person_results = []
for bbox in bboxes:
Expand Down Expand Up @@ -71,7 +71,7 @@ def main():
parser.add_argument(
'--det-cat-id',
type=int,
default=0,
default=1,
help='Category id for bounding box detection model')

assert has_mmdet, 'Please install mmdet to run the demo.'
Expand Down
8 changes: 4 additions & 4 deletions demo/top_down_video_demo_with_mmdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
has_mmdet = False


def process_mmdet_results(mmdet_results, cat_id=0):
def process_mmdet_results(mmdet_results, cat_id=1):
"""Process mmdet results, and return a list of bboxes.
:param mmdet_results:
:param cat_id: category id (default: 0 for human)
:param cat_id: category id (default: 1 for human)
:return: a list of detected bounding boxes
"""
if isinstance(mmdet_results, tuple):
det_results = mmdet_results[0]
else:
det_results = mmdet_results

bboxes = det_results[cat_id]
bboxes = det_results[cat_id - 1]

person_results = []
for bbox in bboxes:
Expand Down Expand Up @@ -69,7 +69,7 @@ def main():
parser.add_argument(
'--det-cat-id',
type=int,
default=0,
default=1,
help='Category id for bounding box detection model')

assert has_mmdet, 'Please install mmdet to run the demo.'
Expand Down
12 changes: 12 additions & 0 deletions mmpose/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def _inference_single_pose_model(model,
elif dataset in 'AnimalZebraDataset':
flip_pairs = [[3, 4], [5, 6]]

elif dataset in 'AnimalPoseDataset':
flip_pairs = [[0, 1], [2, 3], [8, 9], [10, 11], [12, 13], [14, 15],
[16, 17], [18, 19]]
else:
raise NotImplementedError()

Expand Down Expand Up @@ -708,6 +711,15 @@ def vis_pose_result(model,
pose_limb_color = palette[[0] * 8]
pose_kpt_color = palette[[0] * 9]

elif dataset in 'AnimalPoseDataset':
skeleton = [[1, 2], [1, 3], [2, 4], [1, 5], [2, 5], [5, 6], [6, 8],
[7, 8], [6, 9], [9, 13], [13, 17], [6, 10], [10, 14],
[14, 18], [7, 11], [11, 15], [15, 19], [7, 12], [12, 16],
[16, 20]]

pose_limb_color = palette[[0] * 20]
pose_kpt_color = palette[[0] * 20]

else:
raise NotImplementedError()

Expand Down
2 changes: 1 addition & 1 deletion mmpose/datasets/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
'Face300WDataset', 'FaceAFLWDataset', 'FaceWFLWDataset', 'FaceCOFWDataset',
'Body3DH36MDataset', 'AnimalHorse10Dataset', 'AnimalMacaqueDataset',
'AnimalFlyDataset', 'AnimalLocustDataset', 'AnimalZebraDataset',
'AnimalATRWDataset', AnimalPoseDataset
'AnimalATRWDataset', 'AnimalPoseDataset'
]

0 comments on commit 84289b6

Please sign in to comment.