This repository is a fork of flex-gen with the data loader ported from TerraMind.
In this poster, we apply different tokenization schemes to different Sentinel 2 data using VQ-VAE and VQ-GAN. We show that the choice of tokenization scheme has a significant impact on the performance of the compression model.
We show that VQ-VAE is able to retain the spectral information of the data even at very high compression rates of >450x. Using a discriminator in the VQ-GAN, the pixelwise reconstruction performance decreases, as the discriminator forces the model to focus on the perceptual quality of the images.

Lastly, we show that using different parameters such as the embedding dimension, codebook size and the number of downsampling layers, we can find the appropriate trade-off between compression rate and reconstruction quality for each application. We also support the findings of GSQ, which shows that larger latent dimensions are often underutlilized and grouping latent dimensions can lead to significantly higher reconstruction quality.
sh gen_env/setup.sh
source ./gen_env/activate.sh
#! This will run pip install to download all required lib
sh ./gen_env/install_requirements.sh# Single GPU
python -W ignore ./scripts/train_autoencoder.py
# Multi GPU
torchrun --nnodes=1 --nproc_per_node=4 ./scripts/train_autoencoder.py --config-file=PATH/config_name.yaml \
--output_dir=./logs_test/test opts train.num_train_steps=100 train_batch_size=16
# Through slurm
sbatch ./scripts/train_different_quantizers.sbatchScheurer, E., Wang, J., Sedona, R., Maurogiovanni, S., Blumenstiel, B., Jakubik, J., Fraccaro, P., Brunschwiler, T., Kesselheim, S., and Cavallaro, G.: Scalable Efficient Compression in Large-Scale Earth Observation, EGU General Assembly 2025, Vienna, Austria, 27 Apr–2 May 2025, EGU25-19016, https://doi.org/10.5194/egusphere-egu25-19016, 2025.
