P2PFormer: A Primitive-to-polygon Method for Regular Building Contour Extraction from Remote Sensing Images
Tao Zhang, Shiqing Wei, Yikang Zhou, Muying Luo, Wenling Yu, ShunPing Ji
# create the conda env
conda create -n p2pformer python=3.9
conda activate p2pformer
# install the pytorch 1.x,
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
# install the mmcv
pip install opemim
mim install mmcv-full==1.7.2
# install the mmdet and p2pformer
pip install -e .
Download the WHU, WHU-Mix and CrowdAI datastes, then change the data path in whu_line.py, whu-mix_line.py and crowdAI_line.
The pretrained weights are available at here.
# on whu dataset
PYTHONPATH=. bash tools/dist_train.sh p2pformer/configs/retrain/p2p2former_corner_whu.py 8
# on whu-mix dataset
PYTHONPATH=. bash tools/dist_train.sh p2pformer/configs/retrain/p2p2former_corner_whu-mix.py 8
# on crowdai dataset
PYTHONPATH=. bash tools/dist_train.sh p2pformer/configs/retrain/crowdai.py 8
# on whu dataset
PYTHONPATH=. bash tools/dist_test.sh p2pformer/configs/retrain/p2p2former_corner_whu.py /path/to/model.pth 8
# on whu-mix dataset
PYTHONPATH=. bash tools/dist_train.sh p2pformer/configs/retrain/p2p2former_corner_whu-mix.py /path/to/model.pth 8
# on crowdai dataset
PYTHONPATH=. bash tools/dist_train.sh p2pformer/configs/retrain/crowdai.py /path/to/model.pth 8
- Please uncomment lines 229-231 in p2pformer.py, and the polygon prediction results will be stored in
work_dirs/json_preds/
. - Run the test script or demo script.
- Run the polygon_show.py to obtain the visualization results.
@article{zhang2024p2pformer,
title={P2PFormer: A Primitive-to-polygon Method for Regular Building Contour Extraction from Remote Sensing Images},
author={Zhang, Tao and Wei, Shiqing and Zhou, Yikang and Luo, Muying and Yu, Wenling and Ji, Shunping},
journal={IEEE Transactions on Geoscience and Remote Sensing},
year={2024},
publisher={IEEE}
}