Skip to content

Commit 10f82fa

Browse files
Testing backbones for segmentation
Signed-off-by: João Lucas de Sousa Almeida <[email protected]>
1 parent d9bf33a commit 10f82fa

5 files changed

+135
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# lightning.pytorch==2.1.1
2+
seed_everything: 42
3+
trainer:
4+
accelerator: cpu
5+
strategy: auto
6+
devices: auto
7+
num_nodes: 1
8+
# precision: 16-mixed
9+
logger:
10+
class_path: TensorBoardLogger
11+
init_args:
12+
save_dir: tests/
13+
name: all_ecos_random
14+
callbacks:
15+
- class_path: RichProgressBar
16+
- class_path: LearningRateMonitor
17+
init_args:
18+
logging_interval: epoch
19+
- class_path: EarlyStopping
20+
init_args:
21+
monitor: val/loss
22+
patience: 100
23+
max_epochs: 5
24+
check_val_every_n_epoch: 1
25+
log_every_n_steps: 20
26+
enable_checkpointing: true
27+
default_root_dir: tests/
28+
data:
29+
class_path: GenericNonGeoSegmentationDataModule
30+
init_args:
31+
batch_size: 2
32+
num_workers: 4
33+
train_transform:
34+
- class_path: albumentations.HorizontalFlip
35+
init_args:
36+
p: 0.5
37+
- class_path: albumentations.Rotate
38+
init_args:
39+
limit: 30
40+
border_mode: 0 # cv2.BORDER_CONSTANT
41+
value: 0
42+
# mask_value: 1
43+
p: 0.5
44+
- class_path: ToTensorV2
45+
dataset_bands:
46+
- [0, 11]
47+
output_bands:
48+
- [1, 3]
49+
- [4, 6]
50+
rgb_indices:
51+
- 2
52+
- 1
53+
- 0
54+
train_data_root: tests/
55+
train_label_data_root: tests/
56+
val_data_root: tests/
57+
val_label_data_root: tests/
58+
test_data_root: tests/
59+
test_label_data_root: tests/
60+
img_grep: "segmentation*input*.tif"
61+
label_grep: "segmentation*label*.tif"
62+
means:
63+
- 547.36707
64+
- 898.5121
65+
- 1020.9082
66+
- 2665.5352
67+
- 2340.584
68+
- 1610.1407
69+
stds:
70+
- 411.4701
71+
- 558.54065
72+
- 815.94025
73+
- 812.4403
74+
- 1113.7145
75+
- 1067.641
76+
no_label_replace: -1
77+
no_data_replace: 0
78+
num_classes: 2
79+
model:
80+
class_path: terratorch.tasks.SemanticSegmentationTask
81+
init_args:
82+
model_args:
83+
decoder: UperNetDecoder
84+
pretrained: true
85+
backbone: prithvi_swin_B
86+
backbone_pretrained_cfg_overlay:
87+
file: tests/prithvi_swin_B.pt
88+
backbone_drop_path_rate: 0.3
89+
# backbone_window_size: 8
90+
decoder_channels: 256
91+
in_channels: 6
92+
bands:
93+
- BLUE
94+
- GREEN
95+
- RED
96+
- NIR_NARROW
97+
- SWIR_1
98+
- SWIR_2
99+
num_frames: 1
100+
num_classes: 2
101+
head_dropout: 0.5708022831486758
102+
loss: ce
103+
#aux_heads:
104+
# - name: aux_head
105+
# decoder: IdentityDecoder
106+
# decoder_args:
107+
# decoder_out_index: 2
108+
# head_dropout: 0,5
109+
# head_channel_list:
110+
# - 64
111+
# head_final_act: torch.nn.ReLU
112+
#aux_loss:
113+
# aux_head: 0.4
114+
ignore_index: -1
115+
freeze_backbone: true
116+
freeze_decoder: false
117+
model_factory: PrithviModelFactory
118+
119+
# uncomment this block for tiled inference
120+
# tiled_inference_parameters:
121+
# h_crop: 224
122+
# h_stride: 192
123+
# w_crop: 224
124+
# w_stride: 192
125+
# average_patches: true
126+
optimizer:
127+
class_path: torch.optim.AdamW
128+
init_args:
129+
lr: 0.00013524680528283027
130+
weight_decay: 0.047782217873995426
131+
lr_scheduler:
132+
class_path: ReduceLROnPlateau
133+
init_args:
134+
monitor: val/loss
135+

tests/segmentation_test_input.tif

179 KB
Binary file not shown.

tests/segmentation_test_input_1.tif

1.18 MB
Binary file not shown.

tests/segmentation_test_label.tif

385 KB
Binary file not shown.

tests/segmentation_test_label_1.tif

393 KB
Binary file not shown.

0 commit comments

Comments
 (0)