Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add OneHand10K dataset #52

Merged
merged 7 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions configs/top_down/resnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@
| Arch | Input Size | Skeleton Acc | Contour Acc | Mean Acc | ckpt | log |
| :--- | :--------: | :------: | :------: |:------: |:------: |:------: |
| [pose_resnet_50](/configs/top_down/resnet/mpii_trb/res50_mpii_trb_256x256.py) | 256x256 | 0.884 | 0.855 | 0.865 | [ckpt](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmpose/top_down/resnet/res50_mpii_trb_256x256-f0305d2e_20200727.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmpose/top_down/resnet/res50_mpii_trb_256x256_20200727.log.json) |


### Results on OneHand10K val set.

| Arch | Input Size | PCK@0.2 | ckpt | log |
| :--- | :--------: | :------: | :------: |:------: |
| [pose_resnet_50](/configs/top_down/resnet/onehand10k/res50_onehand10k_256x256.py) | 256x256 | 0.985 | [ckpt](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmpose/top_down/resnet/res50_onehand10k_256x256-e67998f6_20200813.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmpose/top_down/resnet/res50_onehand10k_256x256_20200813.log.json) |
131 changes: 131 additions & 0 deletions configs/top_down/resnet/onehand10k/res50_onehand10k_256x256.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=10)
evaluation = dict(interval=1, metric='PCK')

optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[170, 200])
total_epochs = 210
log_config = dict(
interval=20,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])

channel_cfg = dict(
num_output_channels=21,
dataset_joints=21,
dataset_channel=[
[
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20
],
],
inference_channel=[
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20
])

# model settings
model = dict(
type='TopDown',
pretrained='models/pytorch/imagenet/resnet50-19c8e357.pth',
backbone=dict(type='ResNet', depth=50),
keypoint_head=dict(
type='TopDownSimpleHead',
in_channels=2048,
out_channels=channel_cfg['num_output_channels'],
),
train_cfg=dict(),
test_cfg=dict(
flip_test=True,
post_process=True,
shift_heatmap=True,
unbiased_decoding=False,
modulate_kernel=11),
loss_pose=dict(type='JointsMSELoss', use_target_weight=True))

data_cfg = dict(
image_size=[256, 256],
heatmap_size=[64, 64],
num_output_channels=channel_cfg['num_output_channels'],
num_joints=channel_cfg['dataset_joints'],
dataset_channel=channel_cfg['dataset_channel'],
inference_channel=channel_cfg['inference_channel'])

train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='TopDownRandomFlip', flip_prob=0.5),
dict(
type='TopDownGetRandomScaleRotation', rot_factor=20, scale_factor=0.3),
dict(type='TopDownAffine'),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(type='TopDownGenerateTarget', sigma=2),
dict(
type='Collect',
keys=['img', 'target', 'target_weight'],
meta_keys=[
'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
'rotation', 'flip_pairs'
]),
]

valid_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='TopDownAffine'),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(
type='Collect',
keys=[
'img',
],
meta_keys=['image_file', 'center', 'scale', 'rotation', 'flip_pairs']),
]

test_pipeline = valid_pipeline

data_root = 'data/onehand10k'
data = dict(
samples_per_gpu=32,
workers_per_gpu=2,
train=dict(
type='TopDownOneHand10KDataset',
ann_file=f'{data_root}/annotations/onehand10k_train.json',
img_prefix=f'{data_root}/',
data_cfg=data_cfg,
pipeline=train_pipeline),
val=dict(
type='TopDownOneHand10KDataset',
ann_file=f'{data_root}/annotations/onehand10k_test.json',
img_prefix=f'{data_root}/',
data_cfg=data_cfg,
pipeline=valid_pipeline),
test=dict(
type='TopDownOneHand10KDataset',
ann_file=f'{data_root}/annotations/onehand10k_test.json',
img_prefix=f'{data_root}/',
data_cfg=data_cfg,
pipeline=valid_pipeline),
)
28 changes: 28 additions & 0 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,34 @@ mmpose

```

**For OneHand10K data**, please download from [OneHand10K Dataset](https://www.yangangwang.com/papers/WANG-MCC-2018-10.html).
Please download the annotation files from [onehand10k_annotations](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmpose/datasets/onehand10k_annotations.tar).
Extract them under {MMPose}/data, and make them look like this:

```
mmpose
├── mmpose
├── docs
├── tests
├── tools
├── configs
`── data
│── onehand10k
|── annotations
| |── onehand10k_train.json
| |── onehand10k_test.json
`── Train
| |── source
| |── 0.jpg
| |── 1.jpg
| ...
`── Test
|── source
|── 0.jpg
|── 1.jpg

```

For using custom datasets, please refer to [Tutorial 2: Adding New Dataset](tutorials/new_dataset.md)

## Prepare Pretrained Models
Expand Down
6 changes: 3 additions & 3 deletions mmpose/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from .builder import build_dataloader, build_dataset
from .datasets import (BottomUpCocoDataset, TopDownCocoDataset,
TopDownMpiiTrbDataset)
TopDownMpiiTrbDataset, TopDownOneHand10KDataset)
jin-s13 marked this conversation as resolved.
Show resolved Hide resolved
from .pipelines import Compose
from .registry import DATASETS, PIPELINES
from .samplers import DistributedSampler

__all__ = [
'TopDownCocoDataset', 'BottomUpCocoDataset', 'TopDownMpiiTrbDataset',
'build_dataloader', 'build_dataset', 'Compose', 'DistributedSampler',
'DATASETS', 'PIPELINES'
'TopDownOneHand10KDataset', 'build_dataloader', 'build_dataset', 'Compose',
'DistributedSampler', 'DATASETS', 'PIPELINES'
]
6 changes: 4 additions & 2 deletions mmpose/datasets/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from .bottom_up import BottomUpCocoDataset
from .top_down import TopDownCocoDataset, TopDownMpiiTrbDataset
from .top_down import (TopDownCocoDataset, TopDownMpiiTrbDataset,
TopDownOneHand10KDataset)

__all__ = [
'TopDownCocoDataset', 'BottomUpCocoDataset', 'TopDownMpiiTrbDataset'
'TopDownCocoDataset', 'BottomUpCocoDataset', 'TopDownMpiiTrbDataset',
'TopDownOneHand10KDataset'
]
5 changes: 4 additions & 1 deletion mmpose/datasets/datasets/top_down/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from .topdown_coco_dataset import TopDownCocoDataset
from .topdown_mpii_trb_dataset import TopDownMpiiTrbDataset
from .topdown_onehand10k_dataset import TopDownOneHand10KDataset

__all__ = ['TopDownCocoDataset', 'TopDownMpiiTrbDataset']
__all__ = [
'TopDownCocoDataset', 'TopDownMpiiTrbDataset', 'TopDownOneHand10KDataset'
]
Loading