dcrey7 commited on
Commit
b3b310f
Β·
verified Β·
1 Parent(s): 5a5683c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +158 -3
README.md CHANGED
@@ -1,3 +1,158 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Wetlands Segmentation Model (DeepLabv3+)
2
+
3
+ ## Model Description
4
+
5
+ This repository contains a DeepLabv3+ model trained for wetlands segmentation from satellite imagery. The model is designed to identify wetland areas in multi-band satellite images, which is crucial for environmental monitoring, conservation planning, and climate change studies.
6
+
7
+ ### Model Architecture
8
+
9
+ - **Base Architecture**: DeepLabv3+ with ResNet-50 backbone
10
+ - **Input**: Multi-band satellite imagery (focusing on RGB bands)
11
+ - **Output**: Binary segmentation mask (Wetland vs Background)
12
+ - **Resolution**: 128Γ—128 pixels
13
+
14
+ ## Use Cases
15
+
16
+ - Environmental monitoring of wetland regions
17
+ - Land use and land cover change analysis
18
+ - Conservation planning and management
19
+ - Climate change impact assessment
20
+ - Hydrological modeling
21
+
22
+ ## Training Data
23
+
24
+ The model was trained on a dataset of satellite imagery patches containing wetland regions. Each patch is 128Γ—128 pixels and includes multiple spectral bands.
25
+
26
+ ### Dataset Structure
27
+ ```
28
+ patches_data_allbands/
29
+ β”œβ”€β”€ train/
30
+ β”‚ β”œβ”€β”€ input/ # Satellite image patches (.tif)
31
+ β”‚ └── output/ # Segmentation masks (.tif)
32
+ β”œβ”€β”€ val/
33
+ β”‚ β”œβ”€β”€ input/
34
+ β”‚ └── output/
35
+ └── test/
36
+ β”œβ”€β”€ input/
37
+ └── output/
38
+ ```
39
+
40
+ ### Data Preprocessing
41
+
42
+ - Each TIF image contains multiple spectral bands
43
+ - For this model, RGB bands (bands 1, 2, 3) were extracted
44
+ - Images were normalized to the range [0, 1]
45
+ - Masks were converted to binary format (0 = background, 1 = wetland)
46
+
47
+ ### Data Augmentation
48
+
49
+ The following augmentations were applied during training:
50
+ - Random horizontal flips (p=0.5)
51
+ - Random vertical flips (p=0.5)
52
+ - Random 90-degree rotations (p=0.5)
53
+ - Padding to ensure 128Γ—128 dimensions
54
+ - Random cropping to maintain consistent size
55
+
56
+ ## Performance Metrics
57
+
58
+ The model was evaluated using the following metrics:
59
+
60
+ ### Training Set
61
+ - Average IoU: 0.2472
62
+ - Background IoU: 0.9379
63
+ - Wetland IoU: 0.2450
64
+ - Mean IoU: 0.5915
65
+ - Precision: 0.2620
66
+ - Recall: 0.7908
67
+ - F1 Score: 0.3936
68
+
69
+ ### Validation Set
70
+ - Average IoU: 0.0489
71
+ - Background IoU: 0.9515
72
+ - Wetland IoU: 0.0481
73
+ - Mean IoU: 0.4998
74
+ - Precision: 0.0533
75
+ - Recall: 0.3313
76
+ - F1 Score: 0.0918
77
+
78
+ ### Test Set
79
+ - Average IoU: 0.1550
80
+ - Background IoU: 0.8977
81
+ - Wetland IoU: 0.1558
82
+ - Mean IoU: 0.5267
83
+ - Precision: 0.1720
84
+ - Recall: 0.6229
85
+ - F1 Score: 0.2695
86
+
87
+ ## Known Limitations
88
+
89
+ - The model shows signs of overfitting, with significantly better performance on the training set compared to validation and test sets
90
+ - Limited to RGB bands analysis (future work could incorporate more spectral bands)
91
+ - Performance varies based on the quality and resolution of input imagery
92
+ - Binary segmentation only (wetland vs. non-wetland)
93
+
94
+ ## Usage
95
+
96
+ Here's how to use the model for inference:
97
+
98
+ ```python
99
+ import torch
100
+ from torchvision import transforms
101
+ import rasterio
102
+ import numpy as np
103
+ from model import DeepLabv3Plus # Import your model architecture
104
+
105
+ # Load the model
106
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
107
+ model = DeepLabv3Plus(num_classes=2) # Adjust based on your model configuration
108
+ model.load_state_dict(torch.load("model_weights.pth", map_location=device))
109
+ model.to(device)
110
+ model.eval()
111
+
112
+ # Function to preprocess and predict
113
+ def predict_wetland(image_path):
114
+ # Read image using rasterio (get RGB bands)
115
+ with rasterio.open(image_path) as src:
116
+ red = src.read(1)
117
+ green = src.read(2)
118
+ blue = src.read(3)
119
+
120
+ # Stack to create RGB image
121
+ image = np.dstack((red, green, blue)).astype(np.float32)
122
+
123
+ # Normalize
124
+ if image.max() > 0:
125
+ image = image / image.max()
126
+
127
+ # Convert to tensor and add batch dimension
128
+ image = torch.from_numpy(image.transpose(2, 0, 1)).float().unsqueeze(0)
129
+ image = image.to(device)
130
+
131
+ # Get prediction
132
+ with torch.no_grad():
133
+ output = model(image)
134
+ prediction = torch.argmax(output, dim=1).squeeze(0).cpu().numpy()
135
+
136
+ return prediction
137
+ ```
138
+
139
+ ## Citation
140
+
141
+ If you use this model in your research, please cite:
142
+
143
+ ```
144
+ @software{wetlands_segmentation_deeplabsv3plus,
145
+ author = {dcrey7},
146
+ title = {Wetlands Segmentation using DeepLabv3+},
147
+ url = {https://huggingface.co/dcrey7/wetlands_segmentation_deeplabsv3plus},
148
+ year = {2025},
149
+ }
150
+ ```
151
+
152
+ ## License
153
+
154
+ This model is available under the Apache 2.0 license.
155
+
156
+ ## Contact
157
+
158
+ For questions or feedback, please open an issue on this repository or contact the repository owner via HuggingFace.