Python Package to wrap the DynamicWorld model.
Classes:
- Water
- Trees
- Grass
- Crops
- Shrub & Scrub
- Flooded Vegetation
- Built-Up Area
- Bare Ground
- Snow & Ice
./dynamicworld/examples/usage.ipynb
pip install git+https://github.com/DeepCube-org/dynamicworld.git
docker build -t dynamicworld .
docker run --rm --shm-size=1g --ulimit memlock=-1 --gpus all -it -v $PWD:/opt/ml/code/ dynamicworld /bin/bash
cd /opt/ml/code/
pip install -e .
It is possible to address clouds in two different ways by the cloud parameter.
If cloud = None, the cloud prob is not computed and it is not used in the inference process. So the result that is returned is the same of the DynamicWorld model. If cloud = 'mix' the Cloud Mixing strategy is used, if cloud = 'add' the Cloud Adding strategy is used.
The parameter cloud in the inference script allows the "blending" of the DynamicWorld output and the output of the s2cloudless model.
DynamicWorld was trained considering only sentinel-2 images without clouds... it means that cloudy pixels could be condiered OOD for it.
So we could assume that the DynamicWorld model has been trained to approximate the lulc distribution of cloudless pixels (C=0):
But we would like to model the unconditional distribution:
Assuming that it is ok to have an uniform distribution over the lulc classes (1,...K) if the pixel is cloudy (C=1):
And assuming that the model:
is approximated by another model (s2cloudless in our case):
We can approximatge the desidered distribution by:
We can define a new random variable Z that will be as Y but with the additional "cloud" class (K+1):
Now we can try to study the distribution of Z:
Where in the first result we have used the same initial assumption of the Mixing strategy:
The idea is also intuitively very simple, the probability of the cloud class is defined by s2cloudless(x), the rest of the probability mass 1-s2cloudless(x) is distributed in the other classes according to the output of the DynamicWorld model.