Skip to content
/ SOLC Public

Remote Sensing Sar-Optical Land-use Classfication Pytorch Pytorch高分辨率遥感语义分割/地物分割/地物分类

Notifications You must be signed in to change notification settings

yisun98/SOLC

Repository files navigation

SOLC (We have released our complete code !)

Remote Sensing Sar-Optical Land-use Classfication Pytorch

如果该仓库对您有用的话,欢迎star和fork,并提出您的疑问。尽量在issues中提问,有时间一定回复。

Source Dataset

Refer to https://github.com/AmberHen/WHU-OPT-SAR-dataset.

Datasets:Sar and Optical

https://pan.baidu.com/s/1sIGsD3lBEogSCqzbDOaclA password:i51o

Paper Link: MCANet: A joint semantic segmentation framework of optical and SAR images for land use classification

https://www.sciencedirect.com/science/article/pii/S0303243421003457

2022-06-01 News

  • Release Crop Code (sar, opt, lbl)
  • Release Convert Label Code
  • Release Split Code (6:2:2) -> (17640:5880:5880)
  • Upload to Server (four GPUs)
  • The project should be organized as:
SOLC
├── dataset
|   |whu-opt-sar-dataset-256     //  root
│   ├──   ├── train
│   ├──   │     ├── sar
│   ├──   │     │     ├── NH49E001013_1.tif
│   ├──   │     ├── opt
│   ├──   │     │     ├── NH49E001013_1.tif
│   ├──   │     ├── lbl
│   ├──   │     │     ├── NH49E001013_1.tif
│   ├──   ├── val
│   ├──   │     ├── sar
│   ├──   │     │     ├── NH49E001013_2.tif
│   ├──   │     ├── opt
│   ├──   │     │     ├── NH49E001013_2.tif
│   ├──   │     ├── lbl
│   ├──   │     │     ├── NH49E001013_2.tif
│   ├──   ├── test
│   ├──   │     ├── sar
│   ├──   │     │     ├── NH49E001013_3.tif
│   ├──   │     ├── opt
│   ├──   │     │     ├── NH49E001013_3.tif
│   ├──   │     ├── lbl
│   ├──   │     │     ├── NH49E001013_3.tif
├── libs     //  utils
├── models     //  model
├── tools     //  preprocessing
├── dataset.py
├── class_names.py
├── palette.py 
├── sync_transforms.py 
├── train.py     
├── _test.py / predict.py

2022-06-02 News

  • Release Deeplabv3+ Code (sar + opt, 5-channels input)
  • Release Learning Strategy Code (step size, gamma)
  • Release Training Torch-Parser Code
  • Release VGG19 Code (based on official implement) weights

2022-06-03 News

  • Release MCANet Code (unofficial implement, based on deeplabv3+)
  • Release FCNs Code (FCN8s, 16s and 32s)
  • Release Resnet-50 weights , Resnet-101 weights, and Restnet-152 weights Code
  • Release Unet Code
  • Release Segnet Code
  • Release PSPnet Code
  • Release SOLC Code (Ours)

2022-06-04 News SOLC (Ours)

  • Release SOLC V1 Code (based on RGB-D and dual-resnet 50)
  • Release SOLC V2 Code (based on dual-stream deeplabv3+)
  • Release Deeplabv3+ Performance (Training 7 hours)
  • Release Train Code
  • Release Predict/Test Code

2022-06-05 News SOLC (Ours)

  • Release SOLC V1 Code Performance
  • Release SOLC V2 Code Performance
  • Release SOLC V3 Code (based on dual-stream deeplabv3+ and SAGate)
  • Release SOLC V4 Code (based on dual2one-stream deeplabv3+)
  • Release SOLC V5 Code (based on dual2one-stream deeplabv3+, SAGate and RFB)
  • Release SOLC V6 Code (based on dual2one-stream deeplabv3+ and Two Enhanced Module)

2022-06-06 News SOLC (Ours)

  • Release SOLC V7 Code (based on dual-stream deeplabv3+, SAGate and ERFB) (successful version, Congratulations!)
  • Retrain Unet, Segnet, and MCANet
  • Retest the performance
  • Release Our SOLC V7 weights solcv7: baiduyun password:solc
  • Release Other model weights others: baiduyun password:solc

2022-06-07 News

  • Release 像素统计
[0, '背景', 11824154.0, 1.0] (忽略)
[1, '农田', 708762053.0, 0.016682825992096393]
[2, '城市', 96237141.0, 0.12286476797975535]
[3, '村庄', 119738993.0, 0.09874940237721894]
[4, '水体', 292127191.0, 0.04047604729817842]
[5, '森林', 774385740.0, 0.015269075073618998]
[6, '道路', 19661970.0, 0.6013717852280317]
[7, '其他', 35164414.0, 0.3362534066400197]
weight in criterion: [1.0, 0.016682825992096393, 0.12286476797975535, 0.09874940237721894, 0.04047604729817842, 0.015269075073618998, 0.6013717852280317, 0.3362534066400197]

2022-06-08 News

  • Release More Results
  • Release Plot Code

SOLC V7 framework

image

Other stragety

  • 设置合适的空洞卷积膨胀率atrous_rates
  • 余弦退火重启动学习率策略warm up
  • 使用更多的数据增强
  • 使用更强的损失函数(focal loss)或者为类别赋予权重(见tools/class_weight.py) 来解决类别不平衡问题

Performance

策略 模型 总体性能
epoch=40, batch size=16,
Random Flip, lr=1e-3, wd=1e-4
deeplabv3+ (pretrained=False) oa=0.8096,mIoU=0.4118,kappa=0.7261
epoch=40, batch size=16,
Random Flip, lr=1e-3, wd=1e-4
unet (pretrained=False) oa=0.7846,mIoU=0.3847,kappa=0.6826
epoch=40, batch size=16,
Random Flip, lr=1e-3, wd=1e-4
segnet (pretrained=False) oa=0.7370,mIoU=0.3139,kappa=0.6148
epoch=40, batch size=16,
Random Flip, lr=1e-3, wd=1e-4
mcanet (pretrained=False) oa=0.8179,mIoU=0.4296,kappa=0.7352
epoch=40, batch size=16,
Random Flip, lr=1e-3, wd=1e-4
solcv7 (pretrained=False) oa=0.8222,mIoU=0.4382,kappa=0.7428
模型 farmland city village water forest road others background(ignored)
deeplabv3+ 0.7951/0.6314 0.9414/0.6578 0.3928/0.3291 0.7856/0.5511 0.9422/0.8843 0.3504/0.2231 0.0269/0.0173 0.0/0.0
unet 0.7970/0.6081 0.5671/0.5174 0.3739/0.2755 0.7517/0.5758 0.9579/0.8418 0.5186/0.2467 0.0216/0.0120 0.0/0.0
segnet 0.7248/0.6122 0.0083/0.0083 0.4314/0.2660 0.8837/0.4845 0.9691/0.8206 0.3984/0.2948 0.14046/0.0249 0.0/0.0
mcanet 0.8320/0.6499 0.8394/0.6575 0.3892/0.3318 0.8177/0.6243 0.9476/0.8724 0.5036/0.2865 0.0169/0.0145 0.0/0.0
dcn(ours) 0.8392/0.6505 0.9051/0.6880 0.3999/0.3337 0.7979/0.6035 0.9425/0.8878 0.5251/0.3250 0.0192/0.0167 0.0/0.0
模型 OA mIOU kappa
deeplabv3 0.8096 0.4118 0.7261
unet 0.7846 0.3847 0.6826
segnet 0.7370 0.3139 0.6148
mcanet 0.8179 0.4296 0.7352
dcn(ours) 0.8222 0.4382 0.7428
左侧为各类别的平均精度OA,右侧为各类别的平均mIou
Note: 0->background,10->farmland,20->city,30->village,40->water,50->forest,60->road,70->others

Installation

  1. Clone this repo.
$ git clone https://github.com/yisun98/SOLC.git
$ cd SOLC
  1. Install Environments
   $ pip install -r requirements.txt
   $ source activate
  1. Dataset
   $ python tools/crop_sar.py
   $ python tools/crop_opt.py
   $ python tools/convert_lbl.py
   $ python tools/crop_lbl.py
   $ python tools/split_data.py
  1. Training
nohup python train.py >> train_<model_name>.out 2>&1 &

Please see train.py for details.

tensorboard --logdir=<your_log_dir> --bind_all 
  1. Test/Predict
nohup python train.py --model solcv7 --num_classes 8 >> train_<model_name>.out 2>&1 &

Please see train.py for details.

python predict.py --model solcv7 --model-path <model_path>

Result

More results please see here password:solc.

classification_25_21

image

classification_82_10

image

classification_94_2

image

classification_137_15

image

Reference

Citation (同等贡献度,排名不分先后)

If you have any questions, welcome to contact us !

Contributors 1: yisun98 - [email protected]
Contributors 2: yiruzzz - [email protected]
Contributors 3: Bismarckwzc - [email protected]
Contributors 4: 917596622 - [email protected]

If the project is helpful to you, please consider citing us.

@misc{SOLC2022,
  author = {Y. Sun, Y. Zhao, Z. Wang, Y. Fan},
  title = {SOLC},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/yisun98/SOLC}},
}