This is PyTorch implementation of a GeoGAN network for for dense labeling of RGB+IR optical imagery. The code is based on the pytorch-CycleGAN-and-pix2pix
- Linux or macOS
- Python 2 or 3
- CPU or NVIDIA GPU + CUDA CuDNN
- Install PyTorch 0.4, torchvision, and other dependencies from https://pytorch.org
- Install python libraries visdom and dominate.
pip install visdom dominate
- Alternatively, all dependencies can be installed by
pip install -r requirements.txt
- Clone this repo:
git clone https://github.com/vlkniaz/GeoGAN.git
cd GeoGAN
- For Conda users, we include a script
./scripts/conda_deps.sh
to install PyTorch and other libraries.
- Download a GeoGAN dataset (e.g. maps):
bash ./datasets/download_geogan_dataset.sh maps
- Train a model:
#!./scripts/train_geogan.sh
python train.py --dataroot ./datasets/maps --name maps_geogan --model geo_gan
- To view training results and loss plots, run
python -m visdom.server
and click the URL https://localhost:8097. To see more intermediate results, check out./checkpoints/maps_geogan/web/index.html
- Test the model:
#!./scripts/test_geogan.sh
python test.py --dataroot ./datasets/maps --name maps_geogan --model geo_gan
The test results will be saved to a html file here: ./results/maps_geogan/latest_test/index.html
.
- You can download a pretrained model (e.g. isprs) with the following script:
bash ./scripts/download_geogan_model.sh isprs
The pretrained model is saved at ./checkpoints/{name}_pretrained/latest_net_G.pth
. The available model is isprs.
- To test the model, you also need to download the isprs dataset:
bash ./datasets/download_geogan_dataset.sh horse2zebra
- Then generate the results using
python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test
The option --model test
is used for generating results of GeoGAN only for one side. python test.py --model geo_gan
will require loading and generating results in both directions, which is sometimes unnecessary. The results will be saved at ./results/
. Use --results_dir {directory_path_to_save_result}
to specify the results directory.
Download GeoGAN datasets and create your own datasets.
Best practice for training and testing your models.
If you use this code for your research, please cite our papers.
@inproceedings{Kniaz:2018fq,
author = {Kniaz, V V},
title = {{Conditional GANs for Semantic Segmentation of Multispectral Satellite Images}},
booktitle = {SPIE Remote Sensing},
year = {2018},
publisher = {SPIE},
month = sep
}
CycleGAN-Torch | pix2pix-Torch | pix2pixHD | iGAN | BicycleGAN
Code is inspired by pytorch-DCGAN.