File size: 15,414 Bytes
5769604
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
cudnn_benchmark = True
custom_imports = dict(imports=['geospatial_fm'])
num_frames = 3
img_size = 224
num_workers = 2
pretrained_weights_path = '/home/ubuntu/hls-loss-weights/Prithvi_100M.pt'
num_layers = 6
patch_size = 16
embed_dim = 768
num_heads = 8
tubelet_size = 1
epochs = 80
eval_epoch_interval = 2
experiment = 'multiclass_exp_newSplit'
work_dir = '/home/ubuntu/clark_gfm_eval/multiclass_exp_newSplit'
save_path = '/home/ubuntu/clark_gfm_eval/multiclass_exp_newSplit'
gpu_ids = range(0, 1)
dataset_type = 'GeospatialDataset'
data_root = '/home/ubuntu/hls_cdl_reclassed/'
img_norm_cfg = dict(
    means=[
        494.905781, 815.239594, 924.335066, 2968.881459, 2634.621962,
        1739.579917, 494.905781, 815.239594, 924.335066, 2968.881459,
        2634.621962, 1739.579917, 494.905781, 815.239594, 924.335066,
        2968.881459, 2634.621962, 1739.579917
    ],
    stds=[
        284.925432, 357.84876, 575.566823, 896.601013, 951.900334, 921.407808,
        284.925432, 357.84876, 575.566823, 896.601013, 951.900334, 921.407808,
        284.925432, 357.84876, 575.566823, 896.601013, 951.900334, 921.407808
    ])
splits = dict(
    train=
    '/home/ubuntu/hls-foundation-os/fine-tuning-examples/data_splits/crop_classification/training_data.txt',
    val=
    '/home/ubuntu/hls-foundation-os/fine-tuning-examples/data_splits/crop_classification/validation_data.txt',
    test=
    '/home/ubuntu/hls-foundation-os/fine-tuning-examples/data_splits/crop_classification/validation_data.txt'
)
bands = [0, 1, 2, 3, 4, 5]
tile_size = 224
orig_nsize = 512
crop_size = (224, 224)
train_pipeline = [
    dict(type='LoadGeospatialImageFromFile', to_float32=True),
    dict(type='LoadGeospatialAnnotations', reduce_zero_label=True),
    dict(type='RandomFlip', prob=0.5),
    dict(type='ToTensor', keys=['img', 'gt_semantic_seg']),
    dict(
        type='TorchNormalize',
        means=[
            494.905781, 815.239594, 924.335066, 2968.881459, 2634.621962,
            1739.579917, 494.905781, 815.239594, 924.335066, 2968.881459,
            2634.621962, 1739.579917, 494.905781, 815.239594, 924.335066,
            2968.881459, 2634.621962, 1739.579917
        ],
        stds=[
            284.925432, 357.84876, 575.566823, 896.601013, 951.900334,
            921.407808, 284.925432, 357.84876, 575.566823, 896.601013,
            951.900334, 921.407808, 284.925432, 357.84876, 575.566823,
            896.601013, 951.900334, 921.407808
        ]),
    dict(type='TorchRandomCrop', crop_size=(224, 224)),
    dict(type='Reshape', keys=['img'], new_shape=(6, 3, 224, 224)),
    dict(type='Reshape', keys=['gt_semantic_seg'], new_shape=(1, 224, 224)),
    dict(
        type='CastTensor',
        keys=['gt_semantic_seg'],
        new_type='torch.LongTensor'),
    dict(type='Collect', keys=['img', 'gt_semantic_seg'])
]
val_pipeline = [
    dict(type='LoadGeospatialImageFromFile', to_float32=True),
    dict(type='LoadGeospatialAnnotations', reduce_zero_label=True),
    dict(type='ToTensor', keys=['img', 'gt_semantic_seg']),
    dict(
        type='TorchNormalize',
        means=[
            494.905781, 815.239594, 924.335066, 2968.881459, 2634.621962,
            1739.579917, 494.905781, 815.239594, 924.335066, 2968.881459,
            2634.621962, 1739.579917, 494.905781, 815.239594, 924.335066,
            2968.881459, 2634.621962, 1739.579917
        ],
        stds=[
            284.925432, 357.84876, 575.566823, 896.601013, 951.900334,
            921.407808, 284.925432, 357.84876, 575.566823, 896.601013,
            951.900334, 921.407808, 284.925432, 357.84876, 575.566823,
            896.601013, 951.900334, 921.407808
        ]),
    dict(type='TorchRandomCrop', crop_size=(224, 224)),
    dict(type='Reshape', keys=['img'], new_shape=(6, 3, 224, 224)),
    dict(type='Reshape', keys=['gt_semantic_seg'], new_shape=(1, 224, 224)),
    dict(
        type='CastTensor',
        keys=['gt_semantic_seg'],
        new_type='torch.LongTensor'),
    dict(
        type='Collect',
        keys=['img', 'gt_semantic_seg'],
        meta_keys=[
            'img_info', 'ann_info', 'seg_fields', 'img_prefix', 'seg_prefix',
            'filename', 'ori_filename', 'img', 'img_shape', 'ori_shape',
            'pad_shape', 'scale_factor', 'img_norm_cfg', 'gt_semantic_seg'
        ])
]
test_pipeline = [
    dict(type='LoadGeospatialImageFromFile', to_float32=True),
    dict(type='ToTensor', keys=['img']),
    dict(
        type='TorchNormalize',
        means=[
            494.905781, 815.239594, 924.335066, 2968.881459, 2634.621962,
            1739.579917, 494.905781, 815.239594, 924.335066, 2968.881459,
            2634.621962, 1739.579917, 494.905781, 815.239594, 924.335066,
            2968.881459, 2634.621962, 1739.579917
        ],
        stds=[
            284.925432, 357.84876, 575.566823, 896.601013, 951.900334,
            921.407808, 284.925432, 357.84876, 575.566823, 896.601013,
            951.900334, 921.407808, 284.925432, 357.84876, 575.566823,
            896.601013, 951.900334, 921.407808
        ]),
    dict(
        type='Reshape',
        keys=['img'],
        new_shape=(6, 3, -1, -1),
        look_up=dict({
            '2': 1,
            '3': 2
        })),
    dict(type='CastTensor', keys=['img'], new_type='torch.FloatTensor'),
    dict(
        type='CollectTestList',
        keys=['img'],
        meta_keys=[
            'img_info', 'seg_fields', 'img_prefix', 'seg_prefix', 'filename',
            'ori_filename', 'img', 'img_shape', 'ori_shape', 'pad_shape',
            'scale_factor', 'img_norm_cfg'
        ])
]
CLASSES = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
data = dict(
    samples_per_gpu=2,
    workers_per_gpu=1,
    train=dict(
        type='GeospatialDataset',
        CLASSES=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
        reduce_zero_label=True,
        data_root='/home/ubuntu/hls_cdl_reclassed/',
        img_dir='/home/ubuntu/hls_cdl_reclassed/training_chips',
        ann_dir='/home/ubuntu/hls_cdl_reclassed/training_chips',
        pipeline=[
            dict(type='LoadGeospatialImageFromFile', to_float32=True),
            dict(type='LoadGeospatialAnnotations', reduce_zero_label=True),
            dict(type='RandomFlip', prob=0.5),
            dict(type='ToTensor', keys=['img', 'gt_semantic_seg']),
            dict(
                type='TorchNormalize',
                means=[
                    494.905781, 815.239594, 924.335066, 2968.881459,
                    2634.621962, 1739.579917, 494.905781, 815.239594,
                    924.335066, 2968.881459, 2634.621962, 1739.579917,
                    494.905781, 815.239594, 924.335066, 2968.881459,
                    2634.621962, 1739.579917
                ],
                stds=[
                    284.925432, 357.84876, 575.566823, 896.601013, 951.900334,
                    921.407808, 284.925432, 357.84876, 575.566823, 896.601013,
                    951.900334, 921.407808, 284.925432, 357.84876, 575.566823,
                    896.601013, 951.900334, 921.407808
                ]),
            dict(type='TorchRandomCrop', crop_size=(224, 224)),
            dict(type='Reshape', keys=['img'], new_shape=(6, 3, 224, 224)),
            dict(
                type='Reshape',
                keys=['gt_semantic_seg'],
                new_shape=(1, 224, 224)),
            dict(
                type='CastTensor',
                keys=['gt_semantic_seg'],
                new_type='torch.LongTensor'),
            dict(type='Collect', keys=['img', 'gt_semantic_seg'])
        ],
        img_suffix='_merged.tif',
        seg_map_suffix='.mask.tif',
        split=
        '/home/ubuntu/hls-foundation-os/fine-tuning-examples/data_splits/crop_classification/training_data.txt'
    ),
    val=dict(
        type='GeospatialDataset',
        CLASSES=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
        reduce_zero_label=True,
        data_root='/home/ubuntu/hls_cdl_reclassed/',
        img_dir='/home/ubuntu/hls_cdl_reclassed/validation_chips',
        ann_dir='/home/ubuntu/hls_cdl_reclassed/validation_chips',
        pipeline=[
            dict(type='LoadGeospatialImageFromFile', to_float32=True),
            dict(type='ToTensor', keys=['img']),
            dict(
                type='TorchNormalize',
                means=[
                    494.905781, 815.239594, 924.335066, 2968.881459,
                    2634.621962, 1739.579917, 494.905781, 815.239594,
                    924.335066, 2968.881459, 2634.621962, 1739.579917,
                    494.905781, 815.239594, 924.335066, 2968.881459,
                    2634.621962, 1739.579917
                ],
                stds=[
                    284.925432, 357.84876, 575.566823, 896.601013, 951.900334,
                    921.407808, 284.925432, 357.84876, 575.566823, 896.601013,
                    951.900334, 921.407808, 284.925432, 357.84876, 575.566823,
                    896.601013, 951.900334, 921.407808
                ]),
            dict(
                type='Reshape',
                keys=['img'],
                new_shape=(6, 3, -1, -1),
                look_up=dict({
                    '2': 1,
                    '3': 2
                })),
            dict(
                type='CastTensor', keys=['img'], new_type='torch.FloatTensor'),
            dict(
                type='CollectTestList',
                keys=['img'],
                meta_keys=[
                    'img_info', 'seg_fields', 'img_prefix', 'seg_prefix',
                    'filename', 'ori_filename', 'img', 'img_shape',
                    'ori_shape', 'pad_shape', 'scale_factor', 'img_norm_cfg'
                ])
        ],
        img_suffix='_merged.tif',
        seg_map_suffix='.mask.tif',
        split=
        '/home/ubuntu/hls-foundation-os/fine-tuning-examples/data_splits/crop_classification/validation_data.txt'
    ),
    test=dict(
        type='GeospatialDataset',
        CLASSES=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
        reduce_zero_label=True,
        data_root='/home/ubuntu/hls_cdl_reclassed/',
        img_dir='/home/ubuntu/hls_cdl_reclassed/validation_chips',
        ann_dir='/home/ubuntu/hls_cdl_reclassed/validation_chips',
        pipeline=[
            dict(type='LoadGeospatialImageFromFile', to_float32=True),
            dict(type='ToTensor', keys=['img']),
            dict(
                type='TorchNormalize',
                means=[
                    494.905781, 815.239594, 924.335066, 2968.881459,
                    2634.621962, 1739.579917, 494.905781, 815.239594,
                    924.335066, 2968.881459, 2634.621962, 1739.579917,
                    494.905781, 815.239594, 924.335066, 2968.881459,
                    2634.621962, 1739.579917
                ],
                stds=[
                    284.925432, 357.84876, 575.566823, 896.601013, 951.900334,
                    921.407808, 284.925432, 357.84876, 575.566823, 896.601013,
                    951.900334, 921.407808, 284.925432, 357.84876, 575.566823,
                    896.601013, 951.900334, 921.407808
                ]),
            dict(
                type='Reshape',
                keys=['img'],
                new_shape=(6, 3, -1, -1),
                look_up=dict({
                    '2': 1,
                    '3': 2
                })),
            dict(
                type='CastTensor', keys=['img'], new_type='torch.FloatTensor'),
            dict(
                type='CollectTestList',
                keys=['img'],
                meta_keys=[
                    'img_info', 'seg_fields', 'img_prefix', 'seg_prefix',
                    'filename', 'ori_filename', 'img', 'img_shape',
                    'ori_shape', 'pad_shape', 'scale_factor', 'img_norm_cfg'
                ])
        ],
        img_suffix='_merged.tif',
        seg_map_suffix='.mask.tif',
        split=
        '/home/ubuntu/hls-foundation-os/fine-tuning-examples/data_splits/crop_classification/validation_data.txt'
    ))
optimizer = dict(
    type='Adam', lr=1.5e-05, betas=(0.9, 0.999), weight_decay=0.05)
optimizer_config = dict(grad_clip=None)
lr_config = dict(
    policy='poly',
    warmup='linear',
    warmup_iters=1500,
    warmup_ratio=1e-06,
    power=1.0,
    min_lr=0.0,
    by_epoch=False)
log_config = dict(
    interval=10,
    hooks=[dict(type='TextLoggerHook'),
           dict(type='TensorboardLoggerHook')])
checkpoint_config = dict(
    by_epoch=True,
    interval=10,
    out_dir='/home/ubuntu/clark_gfm_eval/multiclass_exp_newSplit')
evaluation = dict(interval=2, metric='mIoU', pre_eval=True, save_best='mIoU')
reduce_train_set = dict(reduce_train_set=False)
reduce_factor = dict(reduce_factor=1)
runner = dict(type='EpochBasedRunner', max_epochs=80)
workflow = [('train', 1), ('val', 1)]
norm_cfg = dict(type='BN', requires_grad=True)
loss_weights_multi = [
    0.386375, 0.661126, 0.548184, 0.640482, 0.876862, 0.925186, 3.249462,
    1.542289, 2.175141, 2.272419, 3.062762, 3.626097, 1.198702
]
loss_func = dict(
    type='CrossEntropyLoss',
    use_sigmoid=False,
    class_weight=[
        0.386375, 0.661126, 0.548184, 0.640482, 0.876862, 0.925186, 3.249462,
        1.542289, 2.175141, 2.272419, 3.062762, 3.626097, 1.198702
    ],
    avg_non_ignore=True)
output_embed_dim = 2304
model = dict(
    type='TemporalEncoderDecoder',
    frozen_backbone=False,
    backbone=dict(
        type='TemporalViTEncoder',
        pretrained='/home/ubuntu/hls-loss-weights/Prithvi_100M.pt',
        img_size=224,
        patch_size=16,
        num_frames=3,
        tubelet_size=1,
        in_chans=6,
        embed_dim=768,
        depth=6,
        num_heads=8,
        mlp_ratio=4.0,
        norm_pix_loss=False),
    neck=dict(
        type='ConvTransformerTokensToEmbeddingNeck',
        embed_dim=2304,
        output_embed_dim=2304,
        drop_cls_token=True,
        Hp=14,
        Wp=14),
    decode_head=dict(
        num_classes=13,
        in_channels=2304,
        type='FCNHead',
        in_index=-1,
        channels=256,
        num_convs=1,
        concat_input=False,
        dropout_ratio=0.1,
        norm_cfg=dict(type='BN', requires_grad=True),
        align_corners=False,
        loss_decode=dict(
            type='CrossEntropyLoss',
            use_sigmoid=False,
            class_weight=[
                0.386375, 0.661126, 0.548184, 0.640482, 0.876862, 0.925186,
                3.249462, 1.542289, 2.175141, 2.272419, 3.062762, 3.626097,
                1.198702
            ],
            avg_non_ignore=True)),
    auxiliary_head=dict(
        num_classes=13,
        in_channels=2304,
        type='FCNHead',
        in_index=-1,
        channels=256,
        num_convs=2,
        concat_input=False,
        dropout_ratio=0.1,
        norm_cfg=dict(type='BN', requires_grad=True),
        align_corners=False,
        loss_decode=dict(
            type='CrossEntropyLoss',
            use_sigmoid=False,
            class_weight=[
                0.386375, 0.661126, 0.548184, 0.640482, 0.876862, 0.925186,
                3.249462, 1.542289, 2.175141, 2.272419, 3.062762, 3.626097,
                1.198702
            ],
            avg_non_ignore=True)),
    train_cfg=dict(),
    test_cfg=dict(mode='slide', stride=(112, 112), crop_size=(224, 224)))
auto_resume = False