Skip to content

SuperKX/PFSegNets

 
 

Repository files navigation

Brief

Forked from lxtGH/PFSegNets, this page to record configuration info.
Paper cvpr-version/arxiv-version

Enviorenmet Config

This version cfged in Win10, I use anaconda to create virtual env. Installing cuda11 & corresponding cudnn version before is necessary.

conda create -n pfsegnet python=3.7.6
pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

other libs are needed:

pip install opencv-python
pip install natsort
pip install tqdm
pip install scikit-image
pip install scipy
pip install tensorboard
pip install tensorboardX

DataSet preparation

1 Download dataset

Potsdam and Vahihigen dataset. ( iSAID didn't be used here.)

2 Select data

I chose 2_Ortho_RGB.zip and 5_Labels_all.zip of Potsdam to do experiments, place them into the folder 'PFSegNets/dataset/'. The data is organized in the following format:

/dataset/
    └── train/
        └── images/
            ├── top_potsdam_2_10_RGB.tif
            ├── top_potsdam_2_11_RGB.tif 
            ...
        └── masks/
            ├── top_potsdam_2_10_label.tif
            ├── top_potsdam_2_11_label.tif
            ...
    └── val/
        ...
    └── test/
        ...

🔥 /val & /test have the same structures as /train .
🔥 I chose top_potsdam_4_13_RGB, top_potsdam_6_12_RGB and top_potsdam_7_8_RGB as verification data, and top_potsdam_3_13_RGB, top_potsdam_5_12_RGB as test data.

3 convert labels to graymask

python convert_isprs_mask2graymask.py --phase train
python convert_isprs_mask2graymask.py --phase val
python convert_isprs_mask2graymask.py --phase test

4 split imgs into patches

python split_isprs.py

🔥 remember to change the paths to yours.

5 change filepaths in config.py

__C.DATASET.POSDAM_DIR = #yourpath#

Pretrained Models

Baidu Pan Link: https://pan.baidu.com/s/1MWzpkI3PwtnEl1LSOyLrLw 4lwf
Google Drive Link: https://drive.google.com/drive/folders/1C7YESlSnqeoJiR8DWpmD4EVWvwf9rreB?usp=sharing

change the model paths of network/resnet_d.py

Model Checkpoints

DatasetBackbonemIoUModel
iSAIDResNet5066.9Google Drive | Baidu Pan(v3oj)
PotsdamResNet5075.4Google Drive | Baidu Pan(lhlf)
VaihigenResNet5070.4Google Drive | Baidu Pan(54qm)

Evaluation

python eval.py --dataset Posdam --arch network.pointflow_resnet_with_max_avg_pool.DeepR50_PF_maxavg_deeply --inference_mode  whole --single_scale --scales 1.0 --split test --cv_split 0 --avgpool_size 9 --edge_points 128 --match_dim 64 --resize_scale 896 --mode semantic --no_flip --ckpt_path CHECKPOINTPATH --snapshot SAVERESULTS

🔥 'CHECKPOINTPATH' is checkpoints path, eg: E:\PFSegNets\checkpoints\pfnet_r50_postdam.pth
🔥 'SAVERESULTS' is results path, eg: E:\PFSegNets\results

For example, when evaluating PFNet on validation set of iSAID dasaset:

sh scripts/pointflow/test/test_iSAID_pfnet_R50.pth path_to_checkpoint path_to_save_results

If you want to save images during evaluating, add args: dump_images, which will take more time.

Training

To be note that, our models are trained on 8 V-100 GPUs with 32GB memory. It is hard to reproduce such best results if you do not have such resources. For example, when training PFNet on iSAID dataset:

sh scripts/pointflow/train_iSAID_pfnet_r50.sh

Citation

If you find this repo is helpful to your research. Please consider cite our work.

@inproceedings{li2021pointflow,
  title={PointFlow: Flowing Semantics Through Points for Aerial Image Segmentation},
  author={Li, Xiangtai and He, Hao and Li, Xia and Li, Duo and Cheng, Guangliang and Shi, Jianping and Weng, Lubin and Tong, Yunhai and Lin, Zhouchen},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={4217--4226},
  year={2021}
}

Acknowledgement

This repo is based on NVIDIA segmentation repo. We fully thank their open-sourced code.

About

PointFlow (CVPR-2021)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.8%
  • Shell 2.2%