-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add atrw dataset * add atrw configs * add animal readme * add atrw * update log interval * update readme * update readme * update init
- Loading branch information
Showing
18 changed files
with
1,542 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
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=10, metric='mAP', key_indicator='AP') | ||
|
||
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=1, | ||
hooks=[ | ||
dict(type='TextLoggerHook'), | ||
# dict(type='TensorboardLoggerHook') | ||
]) | ||
|
||
channel_cfg = dict( | ||
num_output_channels=15, | ||
dataset_joints=15, | ||
dataset_channel=[ | ||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], | ||
], | ||
inference_channel=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) | ||
|
||
# model settings | ||
model = dict( | ||
type='TopDown', | ||
pretrained='https://download.openmmlab.com/mmpose/' | ||
'pretrain_models/hrnet_w32-36af842e.pth', | ||
backbone=dict( | ||
type='HRNet', | ||
in_channels=3, | ||
extra=dict( | ||
stage1=dict( | ||
num_modules=1, | ||
num_branches=1, | ||
block='BOTTLENECK', | ||
num_blocks=(4, ), | ||
num_channels=(64, )), | ||
stage2=dict( | ||
num_modules=1, | ||
num_branches=2, | ||
block='BASIC', | ||
num_blocks=(4, 4), | ||
num_channels=(32, 64)), | ||
stage3=dict( | ||
num_modules=4, | ||
num_branches=3, | ||
block='BASIC', | ||
num_blocks=(4, 4, 4), | ||
num_channels=(32, 64, 128)), | ||
stage4=dict( | ||
num_modules=3, | ||
num_branches=4, | ||
block='BASIC', | ||
num_blocks=(4, 4, 4, 4), | ||
num_channels=(32, 64, 128, 256))), | ||
), | ||
keypoint_head=dict( | ||
type='TopDownSimpleHead', | ||
in_channels=32, | ||
out_channels=channel_cfg['num_output_channels'], | ||
num_deconv_layers=0, | ||
extra=dict(final_conv_kernel=1, ), | ||
loss_keypoint=dict(type='JointsMSELoss', use_target_weight=True)), | ||
train_cfg=dict(), | ||
test_cfg=dict( | ||
flip_test=True, | ||
post_process='default', | ||
shift_heatmap=True, | ||
modulate_kernel=11)) | ||
|
||
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'], | ||
soft_nms=False, | ||
nms_thr=1.0, | ||
oks_thr=0.9, | ||
vis_thr=0.2, | ||
use_gt_bbox=True, | ||
det_bbox_thr=0.0, | ||
bbox_file='', | ||
) | ||
|
||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='TopDownRandomFlip', flip_prob=0.5), | ||
dict( | ||
type='TopDownHalfBodyTransform', | ||
num_joints_half_body=8, | ||
prob_half_body=0.3), | ||
dict( | ||
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5), | ||
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', 'bbox_score', 'flip_pairs' | ||
]), | ||
] | ||
|
||
val_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', 'bbox_score', | ||
'flip_pairs' | ||
]), | ||
] | ||
|
||
test_pipeline = val_pipeline | ||
|
||
data_root = 'data/atrw' | ||
data = dict( | ||
samples_per_gpu=64, | ||
workers_per_gpu=2, | ||
val_dataloader=dict(samples_per_gpu=32), | ||
test_dataloader=dict(samples_per_gpu=32), | ||
train=dict( | ||
type='AnimalATRWDataset', | ||
ann_file=f'{data_root}/annotations/keypoint_train.json', | ||
img_prefix=f'{data_root}/images/train/', | ||
data_cfg=data_cfg, | ||
pipeline=train_pipeline), | ||
val=dict( | ||
type='AnimalATRWDataset', | ||
ann_file=f'{data_root}/annotations/keypoint_val.json', | ||
img_prefix=f'{data_root}/images/val/', | ||
data_cfg=data_cfg, | ||
pipeline=val_pipeline), | ||
test=dict( | ||
type='AnimalATRWDataset', | ||
ann_file=f'{data_root}/annotations/keypoint_val.json', | ||
img_prefix=f'{data_root}/images/val/', | ||
data_cfg=data_cfg, | ||
pipeline=val_pipeline), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
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=10, metric='mAP', key_indicator='AP') | ||
|
||
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=1, | ||
hooks=[ | ||
dict(type='TextLoggerHook'), | ||
# dict(type='TensorboardLoggerHook') | ||
]) | ||
|
||
channel_cfg = dict( | ||
num_output_channels=15, | ||
dataset_joints=15, | ||
dataset_channel=[ | ||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], | ||
], | ||
inference_channel=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) | ||
|
||
# model settings | ||
model = dict( | ||
type='TopDown', | ||
pretrained='https://download.openmmlab.com/mmpose/' | ||
'pretrain_models/hrnet_w48-8ef0771d.pth', | ||
backbone=dict( | ||
type='HRNet', | ||
in_channels=3, | ||
extra=dict( | ||
stage1=dict( | ||
num_modules=1, | ||
num_branches=1, | ||
block='BOTTLENECK', | ||
num_blocks=(4, ), | ||
num_channels=(64, )), | ||
stage2=dict( | ||
num_modules=1, | ||
num_branches=2, | ||
block='BASIC', | ||
num_blocks=(4, 4), | ||
num_channels=(48, 96)), | ||
stage3=dict( | ||
num_modules=4, | ||
num_branches=3, | ||
block='BASIC', | ||
num_blocks=(4, 4, 4), | ||
num_channels=(48, 96, 192)), | ||
stage4=dict( | ||
num_modules=3, | ||
num_branches=4, | ||
block='BASIC', | ||
num_blocks=(4, 4, 4, 4), | ||
num_channels=(48, 96, 192, 384))), | ||
), | ||
keypoint_head=dict( | ||
type='TopDownSimpleHead', | ||
in_channels=48, | ||
out_channels=channel_cfg['num_output_channels'], | ||
num_deconv_layers=0, | ||
extra=dict(final_conv_kernel=1, ), | ||
loss_keypoint=dict(type='JointsMSELoss', use_target_weight=True)), | ||
train_cfg=dict(), | ||
test_cfg=dict( | ||
flip_test=True, | ||
post_process='default', | ||
shift_heatmap=True, | ||
modulate_kernel=11)) | ||
|
||
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'], | ||
soft_nms=False, | ||
nms_thr=1.0, | ||
oks_thr=0.9, | ||
vis_thr=0.2, | ||
use_gt_bbox=True, | ||
det_bbox_thr=0.0, | ||
bbox_file='', | ||
) | ||
|
||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='TopDownRandomFlip', flip_prob=0.5), | ||
dict( | ||
type='TopDownHalfBodyTransform', | ||
num_joints_half_body=8, | ||
prob_half_body=0.3), | ||
dict( | ||
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5), | ||
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', 'bbox_score', 'flip_pairs' | ||
]), | ||
] | ||
|
||
val_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', 'bbox_score', | ||
'flip_pairs' | ||
]), | ||
] | ||
|
||
test_pipeline = val_pipeline | ||
|
||
data_root = 'data/atrw' | ||
data = dict( | ||
samples_per_gpu=64, | ||
workers_per_gpu=2, | ||
val_dataloader=dict(samples_per_gpu=32), | ||
test_dataloader=dict(samples_per_gpu=32), | ||
train=dict( | ||
type='AnimalATRWDataset', | ||
ann_file=f'{data_root}/annotations/keypoint_train.json', | ||
img_prefix=f'{data_root}/images/train/', | ||
data_cfg=data_cfg, | ||
pipeline=train_pipeline), | ||
val=dict( | ||
type='AnimalATRWDataset', | ||
ann_file=f'{data_root}/annotations/keypoint_val.json', | ||
img_prefix=f'{data_root}/images/val/', | ||
data_cfg=data_cfg, | ||
pipeline=val_pipeline), | ||
test=dict( | ||
type='AnimalATRWDataset', | ||
ann_file=f'{data_root}/annotations/keypoint_val.json', | ||
img_prefix=f'{data_root}/images/val/', | ||
data_cfg=data_cfg, | ||
pipeline=val_pipeline), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.