☁️ Satellite Cloud Generator
A PyTorch-based tool for simulating clouds in satellite images.
This tool allows for generating artificial clouds in an image using structural noise, such as Perlin noise; intended for applications where pairs of clear-sky and cloudy images are required or useful. For example, it can be used to generate training data for tasks such as cloud detection or cloud removal, or simply as a method of augmentation of satellite image data for other tasks.
The images must be in shape (channel, height, width)
or (batch, channel, height, width)
and are also returned in that format.
If you found this tool useful, please cite accordingly:
@software{7053356,
author = {Mikolaj Czerkawski, Christos Tachtatzis},
title = {Satellite Cloud Generator},
month = sep,
year = 2022,
publisher = {Zenodo},
doi = {10.5281/zenodo.7053356},
url = {https://doi.org/10.5281/zenodo.7053356}
}
Requirements
torch>=1.10.0
torchvision
kornia
numpy
imageio
⚙️ Usage
Basic usage, takes a clear
image and returns a cloudy
version along with a corresponding channel-specific transparency mask
:
cloudy, mask = add_cloud(clear,
min_lvl=0.0,
max_lvl=1.0
)
...resulting in the following:
The min_lvl
and max_lvl
control the range of values of the transparency mask
.
Generator Module
You can also use a CloudGenerator
object that binds a specific configuration (or a set of configurations) with the wrapped generation methods:
my_gen=CloudGenerator(WIDE_CONFIG,cloud_p=1.0,shadow_p=0.5)
my_gen(my_image) # will act just like add_cloud_and_shadow() but will preserve the same configuration!
Selected Features (There's more!)
Apart from synthesizing a random cloud, the tool provides several additional features (switched on by default) to make the appearance of the clouds more realistic, inspired by (Lee2019).
1. Cloud Color
The cloud_color
setting adjusts the color of the base added cloud based on the mean color of the clear ground image. (Disable by passing cloud_color=False
)
2. Channel Offset
Spatial offsets between individual cloud image channels can be achieved by setting channel_offset
to a positive integer value. (Disable by passing channel_offset=0
)
3. Blur-Under-the-Cloud
Blurring of the ground image based on the cloud thickness can be achieved by adjusting the blur_scaling
parameter (with 0.0
disabling the effect). (Disable by passing blur_scaling=0
)
⚠️ The blur operation significantly increases memory footprint (caused by the internalunfold
operation).