Segmenting Cloud Patterns from Satellite Images
In 2019 the Max Planck Institute for Meteorology ran Understanding Clouds from Satellite Images on Kaggle, a competition built on cloud labels made by scientists at two research institutes. Entrants had to outline four kinds of cloud organisation on satellite photographs. I entered it with Kirill A. Vishniakov, as a team of two. This post looks back at that entry: the science behind the task, the data and metric, what we built, what it scored and what our write-ups say about it.
Kirill wrote the code repository and its README, which is the main record of the approach. What follows comes from that README, our poster and our slides. Where they disagree, I say so.
In short
- The task was to segment four subjective cloud patterns (Sugar, Flower, Fish, Gravel) that scientists labelled by hand, scored by a mean Dice coefficient in which a correctly empty mask counts as 1.
- We trained a U-Net in two stages at different resolutions with pseudo-labels, then thresholded and removed small masks.
- It finished 95th of 1,538 teams (top 6.2 per cent) with private and public scores of 0.65800 and 0.67007.
- Heavy colour and noise augmentations hurt the leaderboard, and the share of non-empty masks in the final blend became a tuning target.
The science: why cloud patterns matter
Shallow clouds, the low and often small clouds that sit over the trade-wind oceans, influence the Earth's radiation balance (how much sunlight is reflected and how much heat escapes). The competition organisers' paper and our slides make the same point: these clouds are poorly represented in climate models (Rasp et al.). The Kaggle description adds that better models could reduce the uncertainties in climate projections.
Part of the difficulty is that "shallow cloud" is not one thing. Looking at satellite images, meteorologists describe mesoscale organisation, meaning structure on scales of 20 to 2,000 kilometres. Stevens et al. named four patterns: Sugar, Gravel, Fish and Flowers. In their description Sugar is made of small, low clouds with low reflectivity, Gravel clouds line up along what look like gust fronts, Fish are skeletal, often fishbone-like networks, and Flowers are circular, clumped features defined mainly by stratiform (layered) cloud elements. If an algorithm could find these patterns automatically, scientists could map them across the tropics and ask how they relate to large-scale environmental conditions, which is what the organisers' paper goes on to do.
Labels made by people, and why that matters
The labels came from crowd-sourcing. The organisers' paper reports that 67 scientists at two institutes screened 10,000 satellite images on a crowd-sourcing platform and classified almost 50,000 mesoscale cloud clusters. Our poster, citing the Kaggle page, says 68 scientists took part over cloud labelling days, with each image labelled by approximately three different scientists. The two sources disagree on the head count by one, so treat it as roughly 67 to 68.
The poster also describes how the ground truth was built: it is the union of the areas marked by all labellers of that image, after removing any black band area. A union has a predictable effect. Where labellers disagree, the mask grows. The poster describes the resulting masks as quite noisy, including areas that contain no clouds at all, and notes that masks of different classes can overlap. The organisers call the four patterns subjective, and in this dataset the subjectivity is baked into the targets. That is the central difficulty of the task, more than any choice of architecture.
One consequence is visible in the final standings. According to the EEML 2020 slides, the leaderboard ranking by Dice coefficient differs by no more than about 1.5 per cent between the 1st and the 100th positions. When the top 100 teams sit that close, small decisions about thresholds matter, and so does luck.
The data and the metric
The images come from NASA Worldview and cover three regions spanning 21 degrees of longitude and 14 degrees of latitude (poster). The original resolution is 1400 by 2100 pixels, and we worked with downscaled images at 352 by 512, 512 by 768 and 768 by 1152. The model has to predict a mask for each of the four labels, so every image yields four predictions, and a pixel can belong to more than one label.
The metric is the mean Dice coefficient. For a predicted region Y_pred and a ground-truth region Y_gt it is 2|Y_pred ∩ Y_gt| divided by (|Y_pred| + |Y_gt|), and the poster states that if both are empty the score is 1. Our validation code averages this over images and the four labels, and a perfect model scores 1. The empty-mask rule is easy to overlook and changes a great deal: a correct "no cloud of this type here" earns full marks, while any predicted pixel on an empty truth earns zero. The snippet below shows both effects and the post-processing rule described later. It is a toy example on synthetic arrays, not competition data: a 40 by 60 image with one true region of 500 pixels, a good prediction and a 12 pixel speckle.
import numpy as np
from scipy import ndimage
def dice(pred, truth):
"""Dice for one image and one label; two empty masks score 1."""
pred, truth = pred.astype(bool), truth.astype(bool)
total = pred.sum() + truth.sum()
if total == 0:
return 1.0
return 2.0 * np.logical_and(pred, truth).sum() / total
def post_process(prob, threshold=0.5, min_size=5000):
"""Threshold, then drop connected components of min_size pixels or fewer."""
binary = prob > threshold
labels, n = ndimage.label(binary)
out = np.zeros_like(binary)
for i in range(1, n + 1):
comp = labels == i
if comp.sum() > min_size:
out |= comp
return out
truth = np.zeros((40, 60), bool)
truth[5:25, 5:30] = True # one large region, 500 px
prob = np.zeros((40, 60))
prob[6:25, 6:30] = 0.9 # good prediction
prob[32:35, 50:54] = 0.8 # 12 px speckle
for ms in (0, 20):
pred = post_process(prob, 0.5, ms)
print(f"min_size={ms:>2}: predicted px={pred.sum():>3}, dice={dice(pred, truth):.3f}")
empty = np.zeros_like(truth)
print("empty vs empty:", dice(empty, empty))
print("speckle vs empty truth:", dice(prob > 0.5, empty))
print("empty vs non-empty truth:", dice(empty, truth))
# Output (numpy and scipy, run once):
# min_size= 0: predicted px=468, dice=0.942
# min_size=20: predicted px=456, dice=0.954
# empty vs empty: 1.0
# speckle vs empty truth: 0.0
# empty vs non-empty truth: 0.0
Removing the speckle lifted this toy score from 0.942 to 0.954. The speckle alone against an empty truth scores 0.0, whereas predicting nothing would have scored 1.0. When many label slots are empty, false positives are expensive, and so are false negatives, which is why the ratio of empty predictions becomes a tuning target later.
The approach: two stages and pseudo-labels
We treated the task as semantic segmentation with four output channels and used a U-Net with an EfficientNet encoder, implemented with the segmentation_models.pytorch library and the Catalyst training framework (the README credits the former and runs experiments with catalyst-dl). The EfficientNet family scales network depth, width and input resolution together, and the family runs from the small B0 to larger variants. The DS3 slides say the setup used B0 and that larger encoders did not work because of overfitting. But the final blend described in the README also includes B2 and B5 models, a B1 and a se_resnext50 in one component. Most likely B0 was the main experimental encoder and larger ones were added to the ensemble.
Training had two stages, a form of progressive resizing (training first at a smaller image size, then continuing at a larger one). In the first stage, per the README, we used images at 320 by 640 with pseudo-labels, the Adam optimiser with a learning rate of 1e-4 for the encoder and 1e-3 for the decoder, and a BCE Dice loss with eps=10. Grid-searching that value, the README says, gave +0.003 on the leaderboard. Models in this stage typically overfitted after 21 to 22 epochs. The second stage loads the best-validation-loss weights from the first, trains at 512 by 768 on the training data only (the poster also reports runs with pseudo-labels in both stages), and switches to a different loss described below. The poster and slides give other resolution pairs (352 by 512 up to 768 by 1152), so the README's 320 by 640 setting is one configuration among several in the repository's config folder.
A pseudo-label is a prediction by a trained model on images that have no human label, used as if it were a label. The approach follows, per the poster, the Noisy Student method, in which a model trained on labelled images labels unlabelled ones and a student is trained on the union. Here the unlabelled images were the competition test images, and we tried two sets: only confident pseudo-labels, and all test images. The README defines confident as images with at least 80 per cent of pixels either below 0.2 or above 0.8. The DS3 slides give 0.3 and 0.7 instead, and the inference configs in the repository use 0.3, 0.7 and a pixel-share setting of 70. The documents do not reconcile these figures; most likely the cut-offs changed between experiments.
What the poster table says about resolution and pseudo-labels
Table 1 of the poster holds 24 scores: four pseudo-label settings (confident only or all test images, in stage 1 only or in both stages) across six pairs of stage resolutions. The values range from 0.64518 to 0.65663, and the best, 0.65663, belongs to the setting where both stages were trained with the pseudo-labels of all test images. The poster does not say whether the table reports the public or the private leaderboard, so I use only the numbers above and the conclusions we wrote down. Training at the largest resolution (768 by 1152) did not give the best result, which we called surprising. Confident-only pseudo-labels consistently did not beat using all test images.
Augmentations tried and dropped, and the losses
The README is blunt about augmentation. We first tried a large set of non-geometric transforms from the Albumentations library: Blur, CLAHE, GaussNoise, GaussianBlur, HueSaturationValue, RGBShift, IAAAdditiveGaussianNoise, MedianBlur and MotionBlur. The idea was to mimic different weather and sunlight. The leaderboard result "was very bad", so we removed most of them. What remained were horizontal and vertical flips, ShiftScaleRotate (scale limit 0.3, rotation limit 15 degrees, shift limit 0.1), GridDistortion, OpticalDistortion and RandomBrightnessContrast, with probability 0.5 each. The repository still holds several earlier augmentation sets, including one with ElasticTransform and Solarize.
For losses, the first stage used BCE Dice, a sum of binary cross-entropy and a Dice term. The second stage used a symmetric Lovasz loss applied independently to each of the four channels. The Lovasz-Softmax work by Berman, Rannen Triki and Blaschko (CVPR 2018) proposes a tractable surrogate for optimising the intersection-over-union directly, and Dice and intersection-over-union are both overlap measures. The repository's version averages a Lovasz hinge on the logits with one on the flipped problem, so errors on both foreground and background are penalised. The README lists the independent per-channel loss among the reasons we expected the approach to work.
Post-processing: thresholds and a minimum mask size
Model outputs are probabilities per pixel. Post-processing turns them into masks: apply a sigmoid, threshold, find connected components (groups of touching pixels), and drop components that are too small. The README states a threshold of 0.5 and removal of masks smaller than 5,000 pixels. The poster and slides state a threshold of 0.4 with a minimum size that depends on resolution: 2,500 pixels at 352 by 512, 5,000 at 512 by 768 and 11,000 at 768 by 1152. Most of the repository's pseudo-label inference configs agree with the poster, not the README, although a few older ones (320 by 640, and 512 by 768 with a threshold of 0.35 and a minimum size of 10,000) differ from both. The repository also has a validation callback that grid-searches threshold (0 to 0.9) and minimum size separately for each of the four classes and picks the pair with the best Dice. So the threshold and size were tuned and differed by configuration.
Why remove small masks at all? In an image with empty ground truth, a small speckle turns a score of 1 into 0, as the snippet above showed. A minimum size trades a few missed small patterns for fewer false positives.
Blending and the empty-mask ratio
This is the most unusual part of the approach. Two days before the competition ended, Kirill read a forum message saying that as predictions approach 38.5 per cent non-empty masks, the public leaderboard score exceeds 0.670. Our best submissions at that point produced 36.2 to 36.6 per cent non-empty masks. We reasoned that there were too many false negatives, balanced against a fear of creating false positives.
The final blend took five submissions: EfficientNet-B0 with two-stage training at its last epoch and at its best epoch, B2 at its best epoch, B5 at its best epoch, and one artificial submission. The artificial one was itself a voting blend of five single-fold models (B0 last epoch, B0 best epoch, B1 best, B5 best and se_resnext50 best) with a vote threshold of 2, which produced 38.91 per cent non-empty masks. The vote threshold is how many models must mark a pixel for it to count. Adding the artificial submission raised the non-empty share of the ensemble from 36.5 to 37.45 per cent, and the five-way blend with a vote threshold of 3 became our best public submission.
Two cautions apply. First, 38.5 per cent came from a forum message, and the README reports it as a rule of thumb, not a result. Even with the artificial submission the ensemble stayed below it, at 37.45 per cent. Second, the README gives no figure for the non-empty share of the final submission, and the private score (0.65800) is lower than the public one (0.67007). The README does not explain the gap.
The result
The README states the result as 95th place out of 1,538 teams, top 6.2 per cent, with a private/public score of 0.65800/0.67007 measured as the Sørensen-Dice coefficient. The same figure, a Dice score of 0.658 and top 6.2 per cent at 95th, appears on the EEML 2020 slides. The Zenodo record for the poster says "top 7%" in its abstract, which looks like a rounding up of the same ranking: 95 divided by 1,538 is 6.2 per cent. None of the sources states that the entry won a medal, and this post makes no such claim.
| Item | Value | Source |
|---|---|---|
| Placement | 95th of 1,538 teams, top 6.2 per cent | Team README, EEML 2020 slides |
| Private / public score | 0.65800 / 0.67007 | Team README |
| Poster Table 1 range | 0.64518 to 0.65663 | Poster (leaderboard not stated) |
| Spread of ranks 1 to 100 | No more than about 1.5 per cent | EEML 2020 slides |
What the sources support as lessons
- Heavy non-geometric augmentation hurt. The README says the leaderboard was "very bad" with colour, noise and blur transforms, and we kept geometric ones plus brightness and contrast.
- The biggest input was not the best. The poster reports that 768 by 1152 did not give the best result.
- More pseudo-labels beat selective ones here. Confident-only pseudo-labels consistently failed to outperform using all test images.
- The empty-mask ratio is worth tuning. We built the final blend partly to move the non-empty share towards a forum-quoted figure.
- Noisy targets limit the ceiling. The spread of about 1.5 per cent across the top 100 is consistent with labels that are partly subjective, though the sources do not test that explanation.
- Unfinished ideas. The README lists what we could still do: add a classifier and lower the pixel threshold, remove training images with three or four overlapping masks, average weights across folds or across the best epochs, and ensemble more models. The EEML slides add specific pre-processing for noisy data, bigger images and better threshold selection.
What current practice would add
This section is general practice in 2026 drawn from public sources. It describes options, not anything we did.
- Library churn. The Albumentations repository used for augmentation in this entry was archived on 10 July 2025 and points to a successor, AlbumentationsX, under AGPL-3.0 or a commercial licence (repository). Check the licence before moving a project over.
- More architectures behind one interface. The segmentation_models.pytorch README now lists 12 architectures, including Segformer, UPerNet and DPT alongside U-Net, and hundreds of encoders including timm backbones.
- Transformer segmenters. SegFormer (NeurIPS 2021) pairs a transformer encoder with a light decoder, and its authors say it avoids interpolating positional encodings, which they report hurts accuracy when test and training resolutions differ. That bears on the resolution experiments above.
- Self-supervised backbones. DINOv3 reports high-quality dense features that perform well on many tasks without fine-tuning. Whether such features help with subjective cloud patterns is an open empirical question.
Presented at, and how to cite
According to the project README, the poster was presented at the SMILES 2020 and DS3 2021 summer schools, and the slides at the EEML 2020 summer school and at the DS3 2021 winter school, together with a one-page teaser. The EEML slides are dated 1 July 2020 and the DS3 slides January 2021. The same poster is also hosted by the MLinPL 2020 virtual event. The README lists DS3 as both a summer and winter school, and the slides themselves are headed "DS3 Summer School, January 2021", so the exact label for that event is unclear.
The poster is archived on Zenodo under CC BY 4.0, dated 1 July 2021, with DOI 10.5281/zenodo.5055450. The record lists Kirill A. Vishniakov and Mukharbek Organokov as authors. To cite it, use the BibTeX from the README:
@misc{kirill_a_vishniakov_2021_5055450,
author = {Kirill A. Vishniakov and Mukharbek Organokov},
title = {{Segmentation of cloud patterns from satellite images to improve climate models}},
month = jul,
year = 2021,
note = {{Code is available at GitHub:
https://github.com/LightnessOfBeing/kaggle-understanding-cloud-organization}},
publisher = {Zenodo},
doi = {10.5281/zenodo.5055450},
url = {https://doi.org/10.5281/zenodo.5055450}
}
Limits of this retrospective
- The metric and data descriptions rest on our poster and the organisers' paper rather than on the Kaggle page. The host and year come from the Max Planck Institute for Meteorology announcement.
- No competition imagery is reproduced here. The figures are schematic drawings, and the data licence was not checked.
- The sources disagree on several settings: first-stage resolution, post-processing threshold and size, the pseudo-label confidence cut-offs, and the number of labellers. I have said which source says what and have not chosen between them.
- The poster does not say which leaderboard its Table 1 reports, and the README gives no explanation for the gap between private and public scores.
- The code was not re-run. The only code executed is the toy example above.
Sources
- Team repository (Kirill A. Vishniakov): README with the full approach, source, configs, blending script
- Presentation repository (Mukharbek Organokov): poster, slides, teaser, citation
- Poster PDF (SMILES 2020, DS3 2021)
- EEML 2020 slides
- DS3 2021 slides and teaser
- MLinPL 2020 virtual event poster
- Zenodo record, DOI 10.5281/zenodo.5055450
- Kaggle: Understanding Clouds from Satellite Images
- Max Planck Institute for Meteorology: Understanding cloud organization from satellite images (competition host)
- Rasp, Schulz, Bony, Stevens: Combining crowd-sourcing and deep learning to explore the meso-scale organization of shallow convection (arXiv 1906.01906)
- Stevens et al.: Sugar, gravel, fish and flowers: Mesoscale cloud patterns in the trade winds (QJRMS 2020)
- Buslaev et al.: Albumentations: Fast and Flexible Image Augmentations (Information 11(2):125, 2020)
- Berman, Rannen Triki, Blaschko: The Lovasz-Softmax loss (CVPR 2018)
- Tan and Le: EfficientNet (ICML 2019)
- Xie et al.: Self-training with Noisy Student
- Albumentations repository (archived July 2025)
- segmentation_models.pytorch
- Xie et al.: SegFormer (NeurIPS 2021)
- Simeoni et al.: DINOv3