Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.8%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: woldier
- License: apache-2.0
- Language: Python
- Default Branch: master
- Size: 24.7 MB
Statistics
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 3
- Releases: 0
Metadata Files
readme-cn.md
SiamSeg: Self-Training with Contrastive Learning for Unsupervised Domain Adaptation in Remote Sensing
News:
- [2024/10/18] The arxiv paper is available.
- [2024/10/13] Update the code and scripts.
1. 创建虚拟环境
安装必要的依赖torch=1.10.2,torchvision=0.11.3 和 mmcv-full=1.5.0
推荐使用conda虚拟环境
shell
conda create -n SiamSeg python==3.8 -y
conda activate SiamSeg
pip 命令安装torch && torchvision && mmcv-full
shell
pip install torch==1.10.2+cu111 torchvision==0.11.3+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full==1.5.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html
pip install kornia matplotlib prettytable timm yapf==0.40.1
for CN user:
shell
pip install torch==1.10.2+cu111 -f https://mirror.sjtu.edu.cn/pytorch-wheels/cu111/?mirror_intel_list
pip install torchvision==0.11.3+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full==1.5.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html
pip install kornia matplotlib prettytable timm yapf==0.40.1
`
安装参考文档refer:
torch与torchvision版本对照
mmcv的版本对照
2.数据集的准备
我们选择 Postsdam, Vaihingen 和 LoveDA 作为基准数据集, 并创建了 train, val, test 列表供研究人员参考.
2.1 文件的下载
ISPRS Potsdam
The Potsdam dataset is for urban semantic segmentation used in the 2D Semantic Labeling Contest - Potsdam.
The dataset can be requested at the challenge homepage. The '2OrthoRGB.zip', '3OrthoIRRG.zip' and '5Labelsall_noBoundary.zip' are required.
ISPRS Vaihingen
The Vaihingen dataset is for urban semantic segmentation used in the 2D Semantic Labeling Contest - Vaihingen.
The dataset can be requested at the challenge homepage. The 'ISPRSsemanticlabelingVaihingen.zip' and 'ISPRSsemanticlabelingVaihingengroundtrutherodedCOMPLETE.zip' are required.
LoveDA
The data could be downloaded from Google Drive here.
Or it can be downloaded from zenodo, you should run the following command:
```shell
cd /{yourprojectbase_path}/SiamSeg/data/LoveDA
Download Train.zip
wget https://zenodo.org/record/5706578/files/Train.zip
Download Val.zip
wget https://zenodo.org/record/5706578/files/Val.zip
Download Test.zip
wget https://zenodo.org/record/5706578/files/Test.zip ```
2.2 数据集预处理
将下载的文件放入对应的路径中 格式如下 ```text SiamSeg/ ├── data/ │ ├── LoveDA/ │ │ ├── Test.zip │ │ ├── Train.zip │ │ └── Val.zip ├── ├── PotsdamIRRGDA/ │ │ ├── 3OrthoIRRG.zip │ │ └── 5LabelsallnoBoundary.zip ├── ├── PotsdamRGBDA/ │ │ ├── 2OrthoRGB.zip │ │ └── 5LabelsallnoBoundary.zip ├── ├── PotsdamIRRGDA/ │ │ ├── ISPRSsemanticlabelingVaihingen.zip │ │ └── ISPRSsemanticlabelingVaihingengroundtrutherodedCOMPLETE.zip
- Potsdam
shell
python tools/convertdatasets/potsdam.py data/PotsdamIRRG/ --clipsize 512 --stridesize 512
python tools/convertdatasets/potsdam.py data/PotsdamRGB/ --clipsize 512 --stridesize 512
- Vaihingen
shell
python tools/convertdatasets/vaihingen.py data/VaihingenIRRG/ --clipsize 512 --stridesize 256
- LoveDA
shell
cd data/LoveDA
unzip Train.zip, Val.zip, Test.zip
```
3.Training
3.1 预训练模型的准备
mitb5.pth :
We provide a script mit2mmseg.py in the tools directory to convert the key of models from the official repo to MMSegmentation style.
```shell
python tools/modelconverters/mit2mmseg.py ${PRETRAIN_PATH} ./pretrained
```
或者可以从 google drive 下载
文件的结构如下
text
SiamSeg/
├── pretrained/
│ ├── mit_b5.pth (needed)
│ └── ohter.pth (option)
3.2 Potsdam IRRG to Vaihingen IRRG
tips
在linux下使用分布式训练脚本时, 由于文件权限的问题, 需要设置下训练脚本的权限
shell cd SiamSeg chmod 777 ./tools/dist_train.sh chmod 777 ./tools/dist_test.sh
```shell
Potsdam IRRG to Vaihingen IRRG
CUDAVISIBLEDEVICES 可见的GPU id 是 0-3 总计四个GPU处理器
PORT 设置分布式训练时master的通信端口
最后的4表示使用的GPU总数
CUDAVISIBLEDEVICES=0,1,2,3 PORT=10985 \ ./tools/disttrain.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kPotsdamIRRG2_VaihingenIRRG.py 4 ```
3.3 Potsdam RGB to Vaihingen IRRG
```shell
Potsdam IRRG to Vaihingen IRRG
CUDAVISIBLEDEVICES 可见的GPU id 是 0-3 总计四个GPU处理器
PORT 设置分布式训练时master的通信端口
最后的4表示使用的GPU总数
CUDAVISIBLEDEVICES=0,1,2,3 PORT=10985 \ ./tools/disttrain.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kPotsdamRGB2_VaihingenIRRG.py 4
```
3.4 Vaihingen IRRG to Potsdam IRRG
```shell
Potsdam IRRG to Vaihingen IRRG
CUDAVISIBLEDEVICES 可见的GPU id 是 0-3 总计四个GPU处理器
PORT 设置分布式训练时master的通信端口
最后的4表示使用的GPU总数
CUDAVISIBLEDEVICES=0,1,2,3 PORT=10985 \ ./tools/disttrain.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kVaihingenIRRG2_PotsdamIRRG.py 4 ```
3.5 Vaihingen IRRG to Potsdam RGB
```shell
Potsdam IRRG to Vaihingen IRRG
CUDAVISIBLEDEVICES 可见的GPU id 是 0-3 总计四个GPU处理器
PORT 设置分布式训练时master的通信端口
最后的4表示使用的GPU总数
CUDAVISIBLEDEVICES=0,1,2,3 PORT=10985 \ ./tools/disttrain.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kVaihingenIRRG2_PotsdamRGB.py 4 ```
3.6 LoveDA Rural to Urban
```shell
Potsdam IRRG to Vaihingen IRRG
CUDAVISIBLEDEVICES 可见的GPU id 是 0-3 总计四个GPU处理器
PORT 设置分布式训练时master的通信端口
最后的4表示使用的GPU总数
CUDAVISIBLEDEVICES=0,1,2,3 PORT=10985 \ ./tools/disttrain.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kRural2_Urban.py 4 ```
4.Testing
4.1 Potsdam IRRG to Vaihingen IRRG
```shell
for dist test
CUDAVISIBLEDEVICES=4,5,6,7 PORT=10985 \ sh tools/disttest.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kPotsdamRGB2VaihingenIRRG.py \ {beastmodel_path} 4 --eval mIoU mFscore
for predict label save
launcher must set to 'none'
opacity between 0 and 1
PYTHONPATH=$(pwd):$PYTHONPATH CUDAVISIBLEDEVICES=0 \ python tools/test.py \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kPotsdamRGB2VaihingenIRRG.py \ {beastmodelpath} --eval mIoU mFscore --launcher none --opacity 1.0 ```
4.2 Potsdam RGB to Vaihingen IRRG
```shell
for dist test
CUDAVISIBLEDEVICES=4,5,6,7 PORT=10985 \ sh tools/disttest.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kPotsdamRGB2VaihingenIRRG.py \ {beastmodel_path} 4 --eval mIoU mFscore
for predict label save
launcher must set to 'none'
opacity between 0 and 1
PYTHONPATH=$(pwd):$PYTHONPATH CUDAVISIBLEDEVICES=0 \ python tools/test.py \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kPotsdamRGB2VaihingenIRRG.py \ {beastmodelpath} --eval mIoU mFscore --launcher none --opacity 1.0 ```
4.3 Vaihingen IRRG to Potsdam IRRG
```shell
for dist test
CUDAVISIBLEDEVICES=4,5,6,7 PORT=10985 \ sh tools/disttest.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kVaihingenIRRG2PotsdamIRRG.py \ {beastmodel_path} 4 --eval mIoU mFscore
for predict label save
launcher must set to 'none'
opacity between 0 and 1
PYTHONPATH=$(pwd):$PYTHONPATH CUDAVISIBLEDEVICES=0 \ python tools/test.py \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kVaihingenIRRG2PotsdamIRRG.py \ {beastmodelpath} --eval mIoU mFscore --launcher none --opacity 1.0 ```
4.4 Vaihingen IRRG to Potsdam RGB
```shell
for dist test
CUDAVISIBLEDEVICES=4,5,6,7 PORT=10985 \ sh tools/disttest.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kVaihingenIRRG2PotsdamRGB.py \ {beastmodel_path} 4 --eval mIoU mFscore
for predict label save
for predict label save
launcher must set to 'none'
opacity between 0 and 1
PYTHONPATH=$(pwd):$PYTHONPATH CUDAVISIBLEDEVICES=0 \ python tools/test.py \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kVaihingenIRRG2PotsdamRGB.py \ {beastmodelpath} --eval mIoU mFscore --launcher none --opacity 1.0 ```
4.5 LoveDA Rural to Urban
```shell
for dist test
CUDAVISIBLEDEVICES=4,5,6,7 PORT=10985 \ sh tools/disttest.sh \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kRural2Urban.py \ {beastmodel_path} 4 --eval mIoU mFscore
for predict label save
launcher must set to 'none'
opacity between 0 and 1
PYTHONPATH=$(pwd):$PYTHONPATH CUDAVISIBLEDEVICES=0 \ python tools/test.py \ configs/SiamSeg/siamsegdaformersepasppmitb5512x51240kRural2Urban.py \ {beastmodelpath} --eval mIoU mFscore --launcher none --opacity 1.0 ```
References
Many thanks to their excellent works * MMSegmentation * DACS * DAFormer
Owner
- Login: woldier
- Kind: user
- Repositories: 2
- Profile: https://github.com/woldier
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - name: "MMSegmentation Contributors" title: "OpenMMLab Semantic Segmentation Toolbox and Benchmark" date-released: 2020-07-10 url: "https://github.com/open-mmlab/mmsegmentation" license: Apache-2.0
GitHub Events
Total
- Issues event: 3
- Watch event: 11
- Delete event: 1
- Issue comment event: 26
- Push event: 12
- Pull request event: 4
- Fork event: 3
- Create event: 2
Last Year
- Issues event: 3
- Watch event: 11
- Delete event: 1
- Issue comment event: 26
- Push event: 12
- Pull request event: 4
- Fork event: 3
- Create event: 2
Dependencies
- pytorch/pytorch ${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel build
- pytorch/pytorch ${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel build
- docutils ==0.16.0
- myst-parser *
- sphinx ==4.0.2
- sphinx_copybutton *
- sphinx_markdown_tables *
- mmcv-full >=1.3.1,<=1.4.0
- cityscapesscripts *
- mmcv *
- prettytable *
- torch *
- torchvision *
- matplotlib *
- numpy *
- packaging *
- prettytable *
- codecov * test
- flake8 * test
- interrogate * test
- isort ==4.3.21 test
- pytest * test
- xdoctest >=0.10.0 test
- yapf * test