Safemotion Lib
Loading...
Searching...
No Matches
posec3d_cat_mlp_fl_3rd.py
Go to the documentation of this file.
1model = dict(
2 type='ActionRecognitionRunner',
3 backbone=dict(
4 action_feat = dict(
5 type='ResNet3d',
6 in_channels = 17,
7 base_channels = 64,
8 stage_blocks = (4, 6, 3),
9 out_indices = (2, ),
10 spatial_strides = (2, 2, 2),
11 temporal_strides = (1, 1, 2),
12 dilations = (1, 1, 1),
13 conv1_kernel = (1, 7, 7),
14 conv1_stride_s = 1,
15 conv1_stride_t = 1,
16 pool1_stride_s = 1,
17 pool1_stride_t = 1,
18 inflate = (0, 1, 1),
19 inflate_style = '3x1x1',
20 input_key = 'pose_heatmap_for_action'
21 ),
22 pose_feat = dict(
23 type='ResNet3d',
24 in_channels = 17,
25 base_channels = 32,
26 stage_blocks = (4, 6, 3),
27 out_indices = (2, ),
28 spatial_strides = (2, 2, 2),
29 temporal_strides = (1, 1, 2),
30 dilations = (1, 1, 1),
31 conv1_kernel = (1, 7, 7),
32 conv1_stride_s = 1,
33 conv1_stride_t = 1,
34 pool1_stride_s = 1,
35 pool1_stride_t = 1,
36 inflate = (0, 1, 1),
37 inflate_style = '3x1x1',
38 input_key = 'pose_heatmap_for_pose'
39 ),
40 ),
41 fusion=dict(
42 type='I3DFusion',
43 in_channels = 1024+512,
44 out_channels = 0,
45 dropout_ratio=0.5,
46 input_key = ['action_feat', 'pose_feat']
47 ),
48 head=dict(
49 action_upper = dict(
50 type='MLPHead',
51 in_channels=1024+512,
52 num_classes=6,
53 layer_channels=[2048],
54 dropout_ratio=0.5,
55 input_key = 'fusion',
56 ),
57 action_lower = dict(
58 type='MLPHead',
59 in_channels=1024+512,
60 num_classes=12,
61 layer_channels=[2048],
62 dropout_ratio=0.5,
63 input_key = 'fusion',
64 ),
65 pose = dict(
66 type='MLPHead',
67 in_channels=1024+512,
68 num_classes=8,
69 layer_channels=[2048],
70 dropout_ratio=0.5,
71 input_key = 'fusion',
72 ),
73 hand = dict(
74 type='MLPHead',
75 in_channels=1024+512,
76 num_classes=4,
77 layer_channels=[2048],
78 dropout_ratio=0.5,
79 input_key = 'fusion',
80 ),
81 foot = dict(
82 type='MLPHead',
83 in_channels=1024+512,
84 num_classes=2,
85 layer_channels=[2048],
86 dropout_ratio=0.5,
87 input_key = 'fusion',
88 ),
89 aux_action_upper = dict(
90 type='MLPHead',
91 in_channels=1024,
92 num_classes=6,
93 layer_channels=[1024],
94 dropout_ratio=0.5,
95 input_key = 'action_feat',
96 input_type = '3d',
97 ),
98 aux_action_lower = dict(
99 type='MLPHead',
100 in_channels=1024,
101 num_classes=12,
102 layer_channels=[1024],
103 dropout_ratio=0.5,
104 input_key = 'action_feat',
105 input_type = '3d',
106 ),
107 aux_pose = dict(
108 type='MLPHead',
109 in_channels=512,
110 num_classes=8,
111 layer_channels=[1024],
112 dropout_ratio=0.5,
113 input_key = 'pose_feat',
114 input_type = '3d',
115 ),
116 aux_hand = dict(
117 type='MLPHead',
118 in_channels=512,
119 num_classes=4,
120 layer_channels=[1024],
121 dropout_ratio=0.5,
122 input_key = 'pose_feat',
123 input_type = '3d',
124 ),
125 aux_foot = dict(
126 type='MLPHead',
127 in_channels=512,
128 num_classes=2,
129 layer_channels=[1024],
130 dropout_ratio=0.5,
131 input_key = 'pose_feat',
132 input_type = '3d',
133 ),
134 ),
135 predict_keys = dict(
136 #예측한 라벨의 키 = 헤드의 키(스코어의 키)
137 pred_action_upper = 'action_upper',
138 pred_action_lower = 'action_lower',
139 pred_pose = 'pose',
140 pred_hand = 'hand',
141 pred_foot = 'foot',
142 )
143)
144
145score_keys = ['action_upper', 'action_lower', 'pose', 'hand', 'foot', 'aux_action_upper', 'aux_action_lower', 'aux_pose', 'aux_hand', 'aux_foot']
146pred_keys = ['pred_action_upper', 'pred_action_lower', 'pred_pose', 'pred_hand', 'pred_foot']
147gt_keys = ['gt_action_upper', 'gt_action_lower', 'gt_pose', 'gt_hand', 'gt_foot', 'gt_action_upper', 'gt_action_lower', 'gt_pose', 'gt_hand', 'gt_foot']
148target_tasks = ['action_upper', 'action_lower', 'pose', 'hand', 'foot', 'action_upper', 'action_lower', 'pose', 'hand', 'foot']
149train_tasks = ['action_upper', 'action_lower', 'pose', 'hand', 'foot']
150
151
152loss = dict(
153 MutiTaskSigmoidFocalLoss = dict(
154 weight = 1.0,
155 task_key = 'category',
156 pred_keys = score_keys,
157 gt_keys = gt_keys,
158 target_tasks = target_tasks,
159 weights = [1.0, 1.5, 1.0, 1.0, 1.0, 0.25, 0.5, 0.25, 0.25, 0.25],
160 # data_num = dict(action = [100, 100, 100, 24, 100, 34, 3, 100, 100], pose = [98, 517, 11, 35])
161 )
162)
163
164metric_args = dict(pred_key=pred_keys,
165 gt_key=gt_keys[:5],
166 target_tasks=target_tasks[:5],
167 task_key='category')
168
169collect_keys = ['pose_heatmap_for_action', 'pose_heatmap_for_pose', 'gt_action_upper', 'gt_action_lower', 'gt_pose', 'gt_hand', 'gt_foot']
170
171data_loader = dict(
172 type = 'ActionDatasetLoader_mtml',
173 data_folder = '/media/safemotion/HDD5/pjm_test/action_train_dataset_2023/action_mtml_1st_split',
174 category_info = dict(action_upper = 6,
175 action_lower = 12,
176 pose = 8,
177 hand = 4,
178 foot = 2),
179 clip_len_action = 20,
180 clip_len_pose = 6,
181)
182ep_mul = 20
183train = dict(
184 num_workers = 8,
185 init_lr = 0.1,
186 batch_size = 32,
187 epochs = 100*ep_mul,
188 optimizer = 'SGD',
189 optimizer_args = dict(momentum=0.9, nesterov=True, weight_decay=0.0001),
190 scheduler = 'CosineAnnealingLR',
191 # scheduler = 'StepLR',
192 scheduler_args = dict(T_max=30*ep_mul, eta_min=0),
193 adjust_lr_epoch = [10*ep_mul, 50*ep_mul, 100*ep_mul, 130*ep_mul],
194 adjust_lr_rate = [0.5, 0.1, 0.1, 0.1],
195 val_interval = 1,
196
197
198 update_loss_weight = False,
199 update_loss_weight_interval = 20,
200 base_weight = 0.5,
201
202 pretrained = None,#'/media/safemotion/HDD5/pjm_test/action_train_test/9.pth',
203 save_root = '/media/safemotion/HDD5/pjm_test/action_train_result/action_cat_mlp_fl_3rd',
204
205)
206
207test = dict(
208 model_path = None,
209 save_root = '',
210)