Pytorch code for the paper "SMAPGAN: Generative Adversarial Network-Based Semi-Supervised Styled Map Tiles Generation Method" by Xu Chen, Songqiang Chen, Tian Xu, Bangguo Yin, Jian Peng, Xiaoming Mei and Haifeng Li.
This project contains the implements of CycleGAN, Pix2pix, SMAPGAN and its ablation versions.
- Python 3
- PyTorch 0.4+ (check requirements.txt for more detail)
- NVIDIA GPU + CUDA CuDNN
- Clone this repo:
git clone https://github.com/imcsq/SMAPGAN
cd SMAPGAN
- Install PyTorch and other dependencies.
- For pip users, please type the command
pip install -r requirements.txt
.
- For pip users, please type the command
-
Prepare and divide the related datasets. Original datasets could be found at: http://efrosgans.eecs.berkeley.edu/pix2pix/datasets/maps.tar.gz, https://geods.geography.wisc.edu/archives/1192.
-
Train a model:
python train.py --dataroot ./datasets/maps --name maps_smapgan --model smapgan
To see more intermediate results, check out ./checkpoints/maps_smapgan/web/index.html
.
- Test the model:
python test.py --dataroot ./datasets/maps --name maps_smapgan --model smapgan
- The test results will be saved to a html file here:
./results/maps_smapgn/latest_test/index.html
.
-
The pretrained model is saved at
./checkpoints/{name}_pretrained/latest_net_G.pth
. -
Then generate the results using
python test.py --dataroot datasets/maps/testA --name maps_pretrained --model test --no_dropout
- The option
--model test
is used for generating results of SMAPGAN only for one side. This option will automatically set--dataset_mode single
, which only loads the images from one set. On the contrary, using--model smapgan
requires 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. - For your own experiments, you might want to specify
--netG
,--norm
,--no_dropout
to match the generator architecture of the trained model.
Our code is inspired by pytorch-CycleGAN.
If this repository is useful for your research, please kindly consider citing our paper as follow:
@article{chen2020tgrs,
title={SMAPGAN: Generative Adversarial Network Based Semi-Supervised Styled Map Tiles Generating Method},
author={Chen, Xu and Chen, Songqiang and Xu, Tian and Yin, Bangguo and Peng, Jian and Mei, Xiaoming and Li, Haifeng},
journal={IEEE Transactions on Geoscience and Remote Sensing},
DOI = {10.1109/TGRS.2020.3021819},
year={2020},
type = {Journal Article}
}