Skip to content

Commit bab3cd0

Browse files
committed
last run
1 parent e29222f commit bab3cd0

6 files changed

Lines changed: 539 additions & 351 deletions

File tree

.DS_Store

-2 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,5 @@ data/
158158
# Exclude not needed notebooks files
159159
notebooks/exploration.ipynb
160160
notebooks/class_template.ipynb
161-
notebooks/few_shot_approaches_setup.ipynb
161+
notebooks/few_shot_approaches_setup.ipynb
162+
.Rproj.user

notebooks/try_few_shot.ipynb

Lines changed: 168 additions & 280 deletions
Large diffs are not rendered by default.
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: "Few-Shot Learning for Rooftop Detection in Satellite Imagery"
3+
subtitle: "Deep Learning Tutorial"
4+
author: "Giorgio Coppala, Nadine Daum, Elena Dreyer, Nico Reichardt"
5+
bibliography: refs.bib
6+
7+
8+
resources:
9+
- img/**
10+
11+
format:
12+
revealjs:
13+
theme: dimmery.scss
14+
slide-number: true
15+
default-image-width: 70%
16+
preview-links: auto
17+
logo: ""
18+
footer: ""
19+
transition: slide
20+
background-transition: fade
21+
self-contained: true
22+
html-math-method:
23+
method: mathjax
24+
url: https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js
25+
include-in-header: include.html
26+
resources:
27+
- img/**
28+
---
29+
30+
31+
## Policy Relevance
32+
33+
- Many public auhorities face the problem of **limited labeled data**
34+
(annotation is expensive, slow, or requires domain expertise)
35+
36+
- **Applications:**
37+
- medical sector: **rare disease detection**
38+
- emergency management: **flood extent mapping**
39+
- climate & energy: **solar PV rooftop assessment**
40+
- urban planning: **building footprints & infrastructure mapping**
41+
42+
- **Few-shot learning (FSL)** can help:
43+
- Learns to **generalize** from *1–5 labeled support examples per class*
44+
- (in our case) learns a **feature embedding** and constructs **class prototypes**
45+
- Enables segmentation in a **new city** with *minimal additional annotation*
46+
47+
48+
49+
## Problem Setting
50+
51+
::: {.columns}
52+
53+
::: {.column width="55%"}
54+
55+
- Goal of the tutorial: apply **Prototypical Networks** to
56+
rooftop segmentation using only a few labeled tiles
57+
58+
- **Few-shot segmentation** allows the model to learn characteristic
59+
rooftop shapes and textures from a small Geneva subset
60+
61+
- Demonstrates how rooftop maps can be produced for solar potential estimation in a **new geographic setting** with limited labels
62+
63+
:::
64+
65+
::: {.column width="45%"}
66+
![](figures/picture_use_case.png){width="100%" style="margin-top: 1rem;"}
67+
68+
<div style="font-size: 0.75rem; color:#666; text-align:center; margin-top:0.2rem;">
69+
Demonstration use case (self-made visualization)
70+
</div>
71+
:::
72+
73+
:::
74+
75+
76+
## Dataset: [Roofs of Geneva](https://huggingface.co/datasets/raphaelattias/overfitteam-geneva-satellite-images)
77+
78+
- **Size**: 1,050 labeled image-mask pairs
79+
80+
- **Task**: Binary segmentation masks (rooftop vs background)
81+
82+
- **Geographic splits**: 3 grids/ neighborhoods (North, Center, South)
83+
84+
- **Image size**: 250x250 pixels
85+
86+
- **Categories**: Industrial, Residential
87+
88+
89+
## Inside the dataset
90+
91+
<div style="text-align:center;">
92+
![](figures/grids_animation.gif){width="50%"}
93+
</div>
94+
95+
<div style="font-size:0.75rem; text-align:center; color:#666; margin-top:0.5rem;">
96+
Geneva Animation: raw image → overlay rooftop → binary mask
97+
</div>
98+
99+
100+
## Discussion
101+
102+
**Room for improvement:**
103+
104+
- Fine-tune / tweak model parameters
105+
- Add regularization
106+
- Increase number of epochs
107+
108+
- Implement rough approximation of solar potential
109+
- e.g. based on IoU over roof area
110+
111+
112+
**Open for discussion:**
113+
114+
- Try a different encoder ?
115+
- e.g. ResNet-50
116+
117+
- Change train / test split strategy ?
118+
- e.g. random shuffle regardless of geographic regions
119+
120+
121+
122+
<div style="text-align:center; margin-top:3.5em; font-size:1.1em;">
123+
<a href="https://github.com/hertie-data-science-lab/tutorial-new-tutorial-group-1/tree/main"
124+
target="_blank"
125+
style="text-decoration:none;">
126+
GitHub Repo
127+
</a>
128+
</div>
129+
130+
131+
132+
## References
133+
134+
::: {.refs-super-small}
135+
136+
- **Alsentzer, E., Li, M. M., Kobren, S. N., Noori, A., Undiagnosed Diseases Network, Kohane, I. S., & Zitnik, M.** (2025). Few shot learning for phenotype-driven diagnosis of patients with rare genetic diseases. *npj Digital Medicine, 8*(1), 380. https://doi.org/10.1038/s41746-025-01749-1
137+
138+
- **Castello, R., Walch, A., Attias, R., Cadei, R., Jiang, S., & Scartezzini, J.-L.** (2021). Quantification of the suitable rooftop area for solar panel installation from overhead imagery using convolutional neural networks. *Journal of Physics: Conference Series, 2042*(1), 012002. https://doi.org/10.1088/1742-6596/2042/1/012002
139+
140+
- **Chen, Y., Wei, C., Wang, D., Ji, C., & Li, B.** (2022). Semi-supervised contrastive learning for few-shot segmentation of remote sensing images. *Remote Sensing, 14*(17), 4254. https://doi.org/10.3390/rs14174254
141+
142+
- **Ding, H., Zhang, H., & Jiang, X.** (2022). Self-regularized prototypical network for few-shot semantic segmentation. *Pattern Recognition, 132*, 109018. https://doi.org/10.1016/j.patcog.2022.109018
143+
144+
- **Finn, C., Abbeel, P., & Levine, S.** (2017). Model-agnostic meta-learning for fast adaptation of deep networks. In *International Conference on Machine Learning* (pp. 1126–1135). https://doi.org/10.48550/arXiv.1703.03400
145+
146+
- **Ge, Z., Fan, X., Zhang, J., & Jin, S.** (2025). SegPPD-FS: Segmenting plant pests and diseases in the wild using few-shot learning. *Plant Phenomics*, 100121. https://doi.org/10.1016/j.plaphe.2025.100121
147+
148+
- **Hu, Y., Liu, C., Li, Z., Xu, J., Han, Z., & Guo, J.** (2022). Few-shot building footprint shape classification with relation network. *ISPRS International Journal of Geo-Information, 11*(5), 311. https://doi.org/10.3390/ijgi11050311
149+
150+
- **Jadon, S.** (2021). COVID-19 detection from scarce chest X-ray image data using few-shot deep learning. In *Medical Imaging 2021* (pp. 161–170). https://doi.org/10.1117/12.2581496
151+
152+
- **Lee, G. Y., Dam, T., Ferdaus, M. M., Poenar, D. P., & Duong, V.** (2025). Enhancing Few-Shot Classification of Benchmark and Disaster Imagery with ATTBHFA-Net. *arXiv preprint* arXiv:2510.18326. https://doi.org/10.48550/arXiv.2510.18326
153+
154+
- **Li, X., He, Z., Zhang, L., Guo, S., Hu, B., & Guo, K.** (2025). CDCNet: Cross-domain few-shot learning with adaptive representation enhancement. *Pattern Recognition, 162*, 111382. https://doi.org/10.1016/j.patcog.2025.111382
155+
156+
- **Puthumanaillam, G., & Verma, U.** (2023). Texture based prototypical network for few-shot semantic segmentation of forest cover: Generalizing for different geographical regions. *Neurocomputing, 538*, 126201. https://doi.org/10.1016/j.neucom.2023.03.062
157+
158+
- **Snell, J., Swersky, K., & Zemel, R.** (2017). Prototypical networks for few-shot learning. *Advances in Neural Information Processing Systems, 30*. https://doi.org/10.48550/arXiv.1703.05175
159+
160+
- **Sung, F., Yang, Y., Zhang, L., Xiang, T., Torr, P. H., & Hospedales, T. M.** (2018). Learning to compare: Relation network for few-shot learning. In *CVPR* (pp. 1199–1208). https://doi.org/10.1109/CVPR.2018.00131
161+
:::
162+
163+

presentation/tutorial-new-tutorial-group-1.html

Lines changed: 106 additions & 37 deletions
Large diffs are not rendered by default.

presentation/tutorial-new-tutorial-group-1.qmd

Lines changed: 100 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ subtitle: "Deep Learning Tutorial"
44
author: "Giorgio Coppola, Nadine Daum, Elena Dreyer, Nico Reichardt"
55
bibliography: refs.bib
66

7-
87
resources:
98
- img/**
109
- figures/**
@@ -28,51 +27,67 @@ format:
2827
- img/**
2928
---
3029

30+
## Policy Relevance
3131

32+
- Many public auhorities face the problem of **limited labeled data**
33+
(annotation is expensive, slow, or requires domain expertise)
3234

33-
## Problem Setting
35+
- **Applications:**
36+
- medical sector: **rare disease detection**
37+
- emergency management: **flood extent mapping**
38+
- climate & energy: **solar PV rooftop assessment**
39+
- urban planning: **building footprints & infrastructure mapping**
40+
41+
- **Few-shot learning (FSL)** can help:
42+
- Learns to **generalize** from *1–5 labeled support examples per class*
43+
- (in our case) learns a **feature embedding** and constructs **class prototypes**
44+
- Enables segmentation in a **new city** with *minimal additional annotation*
3445

35-
::: columns
36-
::: column
37-
- Cities need accurate rooftop maps to plan and scale **solar PV installations**
3846

39-
- Manual rooftop labeling is **slow** and **costly**
47+
## Problem Setting
48+
49+
::: {.column width="55%"}
4050

41-
- Every city looks different → traditional models do not **generalize** well
51+
- Goal of the tutorial: apply **Prototypical Networks** to
52+
rooftop segmentation using only a few labeled tiles
4253

43-
### Idea:
54+
- **Few-shot segmentation** allows the model to learn characteristic
55+
rooftop shapes and textures from a small Geneva subset
4456

45-
- **Few-shot learning** makes segmentation possible with only a handful of labeled examples
57+
- Demonstrates how rooftop maps can be produced for solar potential estimation in a **new geographic setting** with limited labels
4658

4759
:::
4860

49-
::: column
61+
::: {.column width="45%"}
5062
![](figures/picture_use_case.png){width=90% style="margin-left: 30%;"}
63+
<div style="font-size: 0.75rem; color:#666; text-align:center; margin-top:0.2rem;">
64+
Demonstration use case (self-made visualization)
65+
</div>
5166
:::
52-
:::
53-
5467

55-
## Dataset: [Rooftops of Geneva](https://huggingface.co/datasets/raphaelattias/overfitteam-geneva-satellite-images)
5668

57-
::: columns
58-
::: column
69+
## Dataset: [Roofs of Geneva](https://huggingface.co/datasets/raphaelattias/overfitteam-geneva-satellite-images)
5970

60-
- **Satellite Images**: High-resolution RGB satellite images of Geneva available on Huggingface
6171
- **Size**: 1,050 labeled image-mask pairs
72+
6273
- **Task**: Binary segmentation masks (rooftop vs background)
63-
- **Geographic splits**: 3 grids/ neighborhoods (1301_11, 1301_13, 1301_31)
74+
75+
- **Geographic splits**: 3 grids/ neighborhoods (North, Center, South)
76+
6477
- **Image size**: 250x250 pixels
78+
6579
- **Categories**: Industrial, Residential
6680

6781

68-
:::
82+
## Inside the dataset
6983

70-
::: column
71-
![](figures/grids_animation.gif){width=60% style="margin-left: 30%;"}
72-
![](figures/Geneva_grid_map.png){width=82% style="margin-left: 30%;"}
84+
<div style="text-align:center;">
85+
![](figures/grids_animation.gif){width="50%"}
86+
</div>
7387

74-
:::
75-
:::
88+
<div style="font-size:0.75rem; text-align:center; color:#666; margin-top:0.5rem;">
89+
Geneva Animation: raw image → overlay rooftop → binary mask
90+
</div>
7691

7792
## Few Shot Learning in General
7893

@@ -150,29 +165,81 @@ With 5-shot learning, the predicted masks have a mean IoU over 102 test samples
150165

151166
![](figures/predicted_mask.png){width=60% fig-align="center"}
152167

153-
## Wrap-Up/ Discussion
154168

155-
**What we still want to work on**:
169+
## Discussion
170+
171+
**Room for improvement:**
172+
173+
174+
- Fine-tune / tweak model parameters
175+
- Add regularization
176+
- Increase number of epochs
156177

157-
- Testing different kind of pretrained models as our encoder (ResNet-50, ResNet pretrained on satellite images)
178+
- Implement rough approximation of solar potential
179+
- e.g. based on IoU over roof area
158180

159-
- Play around with different distance metrics (Cosine Similarity and Fidelity)
181+
- Play around with different distance metrics
182+
- e.g. Cosine Similarity and Fidelity
160183

161184
- Evaluate different K values and see how they perform
162185

186+
**Open for discussion:**
163187

164-
**Discussion and Key Takeaways**
188+
- Try a different encoder ?
189+
- e.g. ResNet-50, ResNet pretrained on satellite images
165190

166-
- Strong 1-shot performance: even with minimal labeled data, results were impressive
191+
- Change train / test split strategy ?
192+
- e.g. random shuffle regardless of geographic regions
167193

168-
- Dataset brought its own challenges (designed primarily for PV assessment, not general segmentation)
194+
- Strong 1-shot performance
195+
- even with minimal labeled data, results were impressive
169196

170-
- Limited scope: focused only on roofs in Geneva → raises questions of generalizability
197+
- Dataset brought its own challenges
198+
- designed primarily for PV assessment, not general segmentation
171199

172-
- More diverse data or complex models could improve performance
200+
- Limited scope: focused only on roofs in Geneva
201+
- raises questions of generalizability
202+
- more diverse data or complex models could improve performance
173203

204+
<div style="text-align:center; margin-top:3.5em; font-size:1.1em;">
205+
<a href="https://github.com/hertie-data-science-lab/tutorial-new-tutorial-group-1/tree/main"
206+
target="_blank"
207+
style="text-decoration:none;">
208+
GitHub Repo
209+
</a>
210+
</div>
174211

175-
[GitHub Repo](https://github.com/hertie-data-science-lab/tutorial-new-tutorial-group-1/tree/main)
212+
213+
## References
214+
215+
::: {.refs-super-small}
216+
217+
- **Alsentzer, E., Li, M. M., Kobren, S. N., Noori, A., Undiagnosed Diseases Network, Kohane, I. S., & Zitnik, M.** (2025). Few shot learning for phenotype-driven diagnosis of patients with rare genetic diseases. *npj Digital Medicine, 8*(1), 380. https://doi.org/10.1038/s41746-025-01749-1
218+
219+
- **Castello, R., Walch, A., Attias, R., Cadei, R., Jiang, S., & Scartezzini, J.-L.** (2021). Quantification of the suitable rooftop area for solar panel installation from overhead imagery using convolutional neural networks. *Journal of Physics: Conference Series, 2042*(1), 012002. https://doi.org/10.1088/1742-6596/2042/1/012002
220+
221+
- **Chen, Y., Wei, C., Wang, D., Ji, C., & Li, B.** (2022). Semi-supervised contrastive learning for few-shot segmentation of remote sensing images. *Remote Sensing, 14*(17), 4254. https://doi.org/10.3390/rs14174254
222+
223+
- **Ding, H., Zhang, H., & Jiang, X.** (2022). Self-regularized prototypical network for few-shot semantic segmentation. *Pattern Recognition, 132*, 109018. https://doi.org/10.1016/j.patcog.2022.109018
224+
225+
- **Finn, C., Abbeel, P., & Levine, S.** (2017). Model-agnostic meta-learning for fast adaptation of deep networks. In *International Conference on Machine Learning* (pp. 1126–1135). https://doi.org/10.48550/arXiv.1703.03400
226+
227+
- **Ge, Z., Fan, X., Zhang, J., & Jin, S.** (2025). SegPPD-FS: Segmenting plant pests and diseases in the wild using few-shot learning. *Plant Phenomics*, 100121. https://doi.org/10.1016/j.plaphe.2025.100121
228+
229+
- **Hu, Y., Liu, C., Li, Z., Xu, J., Han, Z., & Guo, J.** (2022). Few-shot building footprint shape classification with relation network. *ISPRS International Journal of Geo-Information, 11*(5), 311. https://doi.org/10.3390/ijgi11050311
230+
231+
- **Jadon, S.** (2021). COVID-19 detection from scarce chest X-ray image data using few-shot deep learning. In *Medical Imaging 2021* (pp. 161–170). https://doi.org/10.1117/12.2581496
232+
233+
- **Lee, G. Y., Dam, T., Ferdaus, M. M., Poenar, D. P., & Duong, V.** (2025). Enhancing Few-Shot Classification of Benchmark and Disaster Imagery with ATTBHFA-Net. *arXiv preprint* arXiv:2510.18326. https://doi.org/10.48550/arXiv.2510.18326
234+
235+
- **Li, X., He, Z., Zhang, L., Guo, S., Hu, B., & Guo, K.** (2025). CDCNet: Cross-domain few-shot learning with adaptive representation enhancement. *Pattern Recognition, 162*, 111382. https://doi.org/10.1016/j.patcog.2025.111382
236+
237+
- **Puthumanaillam, G., & Verma, U.** (2023). Texture based prototypical network for few-shot semantic segmentation of forest cover: Generalizing for different geographical regions. *Neurocomputing, 538*, 126201. https://doi.org/10.1016/j.neucom.2023.03.062
238+
239+
- **Snell, J., Swersky, K., & Zemel, R.** (2017). Prototypical networks for few-shot learning. *Advances in Neural Information Processing Systems, 30*. https://doi.org/10.48550/arXiv.1703.05175
240+
241+
- **Sung, F., Yang, Y., Zhang, L., Xiang, T., Torr, P. H., & Hospedales, T. M.** (2018). Learning to compare: Relation network for few-shot learning. In *CVPR* (pp. 1199–1208). https://doi.org/10.1109/CVPR.2018.00131
242+
:::
176243

177244

178245

0 commit comments

Comments
 (0)