-
Notifications
You must be signed in to change notification settings - Fork 186
/
b.py
59 lines (56 loc) · 2.33 KB
/
b.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
modality = 'b'
graph = 'nturgb+d'
work_dir = f'./work_dirs/dgstgcn/ntu120_xsub_3dkp/{modality}'
model = dict(
type='RecognizerGCN',
backbone=dict(
type='DGSTGCN',
gcn_ratio=0.125,
gcn_ctr='T',
gcn_ada='T',
tcn_ms_cfg=[(3, 1), (3, 2), (3, 3), (3, 4), ('max', 3), '1x1'],
graph_cfg=dict(layout=graph, mode='random', num_filter=8, init_off=.04, init_std=.02)),
cls_head=dict(type='GCNHead', num_classes=120, in_channels=256))
dataset_type = 'PoseDataset'
ann_file = 'data/nturgbd/ntu120_3danno.pkl'
train_pipeline = [
dict(type='PreNormalize3D', align_spine=False),
dict(type='RandomRot', theta=0.2),
dict(type='GenSkeFeat', feats=[modality]),
dict(type='UniformSampleDecode', clip_len=100),
dict(type='FormatGCNInput'),
dict(type='Collect', keys=['keypoint', 'label'], meta_keys=[]),
dict(type='ToTensor', keys=['keypoint'])
]
val_pipeline = [
dict(type='PreNormalize3D', align_spine=False),
dict(type='GenSkeFeat', feats=[modality]),
dict(type='UniformSampleDecode', clip_len=100, num_clips=1),
dict(type='FormatGCNInput'),
dict(type='Collect', keys=['keypoint', 'label'], meta_keys=[]),
dict(type='ToTensor', keys=['keypoint'])
]
test_pipeline = [
dict(type='PreNormalize3D', align_spine=False),
dict(type='GenSkeFeat', feats=[modality]),
dict(type='UniformSampleDecode', clip_len=100, num_clips=10),
dict(type='FormatGCNInput'),
dict(type='Collect', keys=['keypoint', 'label'], meta_keys=[]),
dict(type='ToTensor', keys=['keypoint'])
]
data = dict(
videos_per_gpu=16,
workers_per_gpu=4,
test_dataloader=dict(videos_per_gpu=1),
train=dict(type=dataset_type, ann_file=ann_file, pipeline=train_pipeline, split='xsub_train'),
val=dict(type=dataset_type, ann_file=ann_file, pipeline=val_pipeline, split='xsub_val'),
test=dict(type=dataset_type, ann_file=ann_file, pipeline=test_pipeline, split='xsub_val'))
# optimizer, 4GPU
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0005, nesterov=True)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(policy='CosineAnnealing', min_lr=0, by_epoch=False)
total_epochs = 150
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metrics=['top_k_accuracy'])
log_config = dict(interval=100, hooks=[dict(type='TextLoggerHook')])