These software codes can be used for non-profit academic research only. They are distributed under the terms of the GNU general public license v3.
Code corresponding to I. Dumeur, Y. Chen, F. Sur, Z.-S. Zhou. Sentinel-2 RGB and NIR bands simulation after fire events using a multi-temporal conditional generative adversarial network. Research report HAL-03327421, 2021, https://hal.archives-ouvertes.fr/hal-03327421
Data used for this research are available in : https://drive.google.com/drive/folders/1PSob58o66WE5l-RDcImVcrc67C7HlDCR?usp=sharing
Use the specific training conda environment : env/training_env.yaml :
conda env create -f env/training_env.yaml
conda activate training_env
python -m ipykernel install --user --name=training_env
Start jupyter notebook. If in a remote machine : add --ip=0.0.0.0 --no-browser
You can open the jupyter Notebook : notebooks/Trainings.ipynb
Modify the constant, defined at the beginning at the notebook and run the training.
The conditional GAN model used is defined in models/clean_gan.py In order to train a model two yaml should be modified, examples available in GAN_confs :
- model.yaml
- train.yaml
Then run
gan_train.sh path_to_model_yaml path_to_train_yaml
The training is also configured to be supervised using Tensorboard.
Open a new terminal window within training_env and run tensorboard.
Local command tensorboard --logdir <path>
If in remote machine : tensorboard --logdir <path> --host 0.0.0.0
Eventually you can also look at how the images look like during the training.
Open the notebook Figure_plot
To run prediction of the model. You can run in python
predict.py --model_path ${model_path} --tr_nber ${train_nber} --dataset ${dataset} --pref ${pref} --weights ${weight}
model_path : path where all the training directories of one model are contained tr_nber: number used to name the training directory dataset : path to the directory which contains the two subdirectories dataX and test pref : string used to name the directory where all the predicted tiles are saved weights: int, corresponds of the weights from the model and training number to use to run the prediction
You can also use the gan_predict.sh or look at the Makefile with make predict
command.
Open Notebooks Assessment_cGAN_CD